Working some time with webservice
for mobile application I noticed that SOAP
uses XML
and REST
uses JSON
. Using SOAP
means I have to use only XML
?
Working some time with webservice
for mobile application I noticed that SOAP
uses XML
and REST
uses JSON
. Using SOAP
means I have to use only XML
?
Some questions:
Using SOAP does it mean that I have to use only XML?
Yes, SOAP by definition uses XML as the communication format, there is no way to change it.
So there is no way to use JSON with SOAP?
Yes in theory, because the message format is XML, you can add your JSON representation string inside a CDATA tag. Although it is a not very conventional technique yet in theory it is possible.
Is it advisable to use JSON in the SOAP XML message?
Not in theory, my thesis is if you need to use JSON at many times to circumvent the constraints / limitations of XML so why not eliminate SOAP as well. JSON is originally used for ajax calls which probably makes SOAP a very rigid tool for people's needs. It's up to you to decide whether the recurring need to use JSON as a communication format does not make REST the best choice for developing your webservices.