Spring-WS WSA header contains hardcoded mustUnderstand attribute - spring-ws

When sending WSA headers with Spring-WS, the wsa:To field always contains the attribute mustUnderstand="true". By looking at the source code, I found that this attribute is hardcoded in AbstractAddressingVersion.java. Based on the W3 standard the mustUnderstand attribute is not mandatory I think.
Is there a reason why Spring-WS hardcodes it? We have difficulties when integrating Spring-WS with some other SOAP stacks because of this attribute.

If you file a JIRA here, we can make it customizable.

Related

Adding dynamic path parameters into Orbeon Form HTTP Service

I'm trying to add a dynamic path parameter into an HTTP service in Orbeon forms, ie call a specific URL based on the content of a form field. I know we can change the query string parameters but I need to change the URL itself - the one in this field:
I've read that this is possible in newer version of Orbeon forms by using
{fr:control-string-value('testField')}
but we are stuck on an older version.
I saw another question on Stack Overflow from a few years ago: Orbeon Form HTTP Service where #ebruchez explained xpath is executed in the Resource URL field and gave the example:
http://localhost/RESTFUL/GETADDRESS/{/*/bar/foo}
However, I can't get this to work.
I have been able to successfully execute XPath, eg:
{string-join("test", "value")}
But I don't seem to be able to work out the correct Xpath syntax to dynamically select the value of a sample field and insert it into this box. I think I'm missing something in how I construct the XPath to retrieve the value.
This is what I've tried so far:
{xxf:value('testField')}
{xxf:value($testField)}
{fr:control-value($testField)}
{fr:control-value('testField')}
{xxf:property('testField')}
{xxf:property($testField)}
{$testField}
{'testField'}
{xxf:get-request-parameter('testField')}
{xxf:bind('testField')}
{/*/testField/}
{/*/content/testField/}
{//testField/}
{//*:testField/}
{//:testField/}
{(//testField)[1].text()}
{//form/content/testField/text()}
{(//testField)[1]/text()}
If anyone has any hints of advice on what I'm doing wrong or could give me an example of the syntax I put in here to retrieve a value, I'd be eternally grateful.
You can use AVT (Attribute Value Templates) https://doc.orbeon.com/xforms/core/attribute-value-templates?q=avt. In resource in <xf:submission> or HTTP service wizard use e.g. {instance('fr-form-instance')//url} or if you want edit only some part of URL you can use http://httpbin.org/{instance('fr-form-instance')//url}. I make simple form for you https://demo.orbeon.com/demo/fr/orbeon/builder/edit/18c4bee259fd9f398238b3c72041ee43ea691aa7 witch save respose to dataset and have second example in resource.
Hope this help you

Microsoft.OData.Client: is there a way to turn on the URI Literal suffixes for numeric types?

There was a change "3.2.10 Pruned: URI Literal suffixes for numeric types" in OData v4 specification. Now OData.Client for OData v4 sends double literals without these sfuffixes, but we need them for our proejct to work correctly. I can't find a legal way to turn back this OData v3 behaviour, except brancing OData.Client. Does anybody know a way to change this behaviour using the generated T4 client proxies or something?
It can't fallback to old numeric format (with suffix) . You may consider hooking up DataServiceContext's SendingRequest2 event, modify the request URL to meet the server side's expectation.
However, the server side should have numeric value's type information (either in model or in CLR types) just like client has for building the request, so theoretically, suffix is unnecessary.

Send HTTP header from Orbeon XForm submission

I have an API that depends on certain HTTP Headers for specific behavior. Example would be HTTP Header If-Matches on a POST to support updating only if version matches the value of If-Matches.
How would I send these HTTP headers from an Orbeon XForms submission?
The xf:submission element supports a nested xf:header element, which allows you to set custom headers. For example:
<xf:header>
<xf:name>If-Matches</xf:name>
<xf:value>whatever value</xf:value>
</xf:header>
The name and value can be dynamic using the value attribute. You can use many xf:header children elements. For more, see The header Element from the XForms 1.1 specification.

Returning JSON format from ASP.NET web API

I know this question is been discussed many times but for me those solutions are not working. I want to return JSON data from my ASP.NET web API. I am hitting the end point using Firefox REST client plugin.
What I have tried:
I have specific accept header : Accept: application/json. Use accept header
Removed the XML formatter on Application_Start method
var formatters = GlobalConfiguration.Configuration.Formatters;
formatters.Remove(formatters.XmlFormatter);
This is how I return data at the end
return myModel.OrderBy(d => d.SortOrder);
Where myModel is just a class with few public property. I am not decorating this class or its property with any attribute.
But these two approach's are not working. I am still getting data in XML format :(
Please provide your suggestions.
I would like to introduce you to http://www.servicestack.net/
This is rest API framework that hooks up with .net.
It does everything what you require .
https://docs.google.com/presentation/d/16ey0MrpHOSz5N5sjctAliOgYWO3ZYeJe070fLZlPdrE/present#slide=id.i27
FROM COMMENT
Check that the application/json header is the first header and has a q=1 quality attribute: "application/json;q=1".
You can read more about quality attributes in the specs. Basically they are a way for a client of providing a preference system on the returned datatype.
To answer your other question (when I have explicitly removed the XML format in the code, why I was getting the data in XML format?), I can only guess what was going on: either the header was not setup correctly or the client was defaulting the other header to a different quality value.
Another guess could be that your way of removing the formatter is wrong: you can check this answer on SO or this article for alternative methods and see if they do the trick for you as well.

How do you change the default format to XML in Symfony?

I'm writing a restful XML API for a university assignment, the spec requires no HTML frontend.
There doesn't seem to be any documentation (or guessable functionality) regarding how to change the default format? Whilst thus far I have created all templates as ...Success.xml.php it would be easier to just use the regular ones and set this globally; I really expected this functionality to be configurable from YAML.. yet I have found some hard coded references to the HTML format.
The main issue I'm encountering is that part of the assessment is returning a 404 in a certain way (not as a 404 :/), but importantly it must always return XML, and the default setup of a missing route is a HTML 404 not XML (so it only works when I use forward404 from an action running via a XML route.
So in summary, is there a way to do this / what class(es) do I have to override?
Try putting this in factories.yml
all:
request:
class: sfWebRequest
param:
default_format: xml
That will still need the template names changing though. It will just mean that urls that don't specify a format will revert to xml instead of html.
You can subclass sfPHPView and override the initialise method to affect this (copy paste the initialise method from sfView) - the lines like this need changing:
if ('html' != $format)
You then need to change the view class used ... try this:
http://mirmodynamics.com/post/2009/02/23/symfony%3A-use-your-own-View-class

Resources