There’s a PHP SOAP webservice that needs to be fed with some objects that are created by my java service.
So, imagine I have something like this:
public class Foo {
private String attribute;
// getter/setter
}
...
Foo foo = new Foo();
foo.setAttribute("attr");
String serializedFoo = getJsonSerializer().toJson(foo);
// serialized foo {"attribute": "attr"}
webService.addNewFoo(serializedFoo);
...
The problem is that the webservice is receiving the serialized foo like this:
{attribute: attr}
Sniffing my network I found that all my quotes are being scaped to quot;, like this.
{"attribute":"attr"}
Is there a way that I can avoid that? I would like to send my string wrapped with CDATA. I don’t want it to lose the quotes :/
I am using the
wsimport -keep -Xnocompile WSDL_LOCATION
to generate the client and manager for me to call the webservice. I am running the service in glassfish.
EDIT
I can’t change the receiving end. I understand it should be able to parse the escaped quotes, but unfortunately I am able only to change the serialization from my side.
Using CDATA is not the solution you are looking for. the
"should work just fine for transmitting literal quote chars. something on the receiving end is not correctly parsing the xml.