Author Message
YoshihikoTashiro
Joined: Mar 10, 2014
Messages: 22
Offline
Dear experts,
I'd like to write URL-encoded request in 'Message Body' in Web Service Operational File (REST) like:
token=abcdefg&phonenumber=12345890

I write it as-is then OD shows error message "Content is not allowed in prolog".
Any keyword is needed like 'JSON' for JSON format?

Thank you in advance.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
You can use Java code to URL encode it in the Java class for the REST operation. Put the custom code below the line "//}}END:CLASS:CONSTRUCTOR" so that it won't get overwritten by the code generator.
YoshihikoTashiro
Joined: Mar 10, 2014
Messages: 22
Offline
Hi Wilson,
Thank you for your response.

I'd like to make sure one thing -
does WSO object allow only XML and JSON in 'Message Body'?

Regards,
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
The problem is not whether it supports XML/JSON. It should support any text. The message body is treated like regular text being sent over the web. However sending text over the web means certain characters has to be escaped or URL encoded. That's what the error seems to me. I suspect it's the "&" character here.
YoshihikoTashiro
Joined: Mar 10, 2014
Messages: 22
Offline
I'm afraid the error did not disappear even I got rid of all signs ('&', '%' and '=') from Message Body text.
As far as I tested with OD 7.2.1, the error disappeared only when Message Body
- begins with start tag and ends with end tag
- begins with 'JSON'

Regards,
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Sorry, I've never done any REST call that requires a message body. I wasn't sure. Since this goes through the Axis 2 API, and it looks like the error comes from there, I guess Axis2 needs it to be XML or JSON format.
YoshihikoTashiro
Joined: Mar 10, 2014
Messages: 22
Offline
Thank you for your reply.
I got it.
Go to:   
Mobile view