tardoandre tardoandre - 1 month ago 14
reST (reStructuredText) Question

How do I convert a SOAP Envelop into JSON?

I'm trying to convert this SOAP Envelop into a http POST Request to send via DHC Restlet (or any other engine).

Soap Envelop



<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xx="http://xx.webservice.company.com/">
<soapenv:Header/>
<soapenv:Body>
<xx:MyMethodName>
<!--Optional:-->
<firstParameter>xx</firstParameter>
<!--Optional:-->
<secondParameter>zz</secondParameter>
</xx:MyMethodName>
</soapenv:Body>
</soapenv:Envelope>


DHC Implementation



enter image description here

I'm getting 200 OK but the response is empty.

What could I be missing?

Answer

Although we can get a result from a GET request, it's not possible to POST a JSON request if your server is using SOAP architecture from behind.

The solution is to POST a SOAP envelop using XML and the following header parameters:

Content-Type : text/xml; charset=utf-8

SOAPAction : (empty)

Comments