I've got a restful service that behaves differently with different
clients/sources. Let me illustrate-
The POST request is expecting an xml payload such as this:
<payload>
<searchRequest>
<searchTerm>Foo</searchTerm>
<constraint>bar</constraint>
...
</searchRequest>
</payload>
To get the request, I use xdmp:unquote(xdmp:get-request-body())/node()
This works fine from a Firefox plugin rest client I use. I am able to
traverse the xml and all is well. However, when I use SoapUI, there's a
problem. Performing the unquote results in all the element names being
stripped out so instead of-
<searchRequest>
<searchTerm>Foo</searchTerm>
<constraint>bar</constraint>
...
</searchRequest>
I see something like-
|
Foo
bar
...
|
(pipes show beginning and end)
If I don't use unquote on this request from SoapUI, the code works.
In the end, I found that the difference is in the content-type header
value. The requests that work properly with the xdmp:unquote call have
content-type of "text/plain; charset=UTF-8" but those that don't are
"text/plain". I have a work-around to check this value and set the payload
variable accordingly, but I'd like to understand what is going on. What
should I be doing differently to prevent this sort of issue?
Thanks,
Harry
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general