Skip to content
Advertisement

how to edit the response fields in node-soap

I have the following WSDL definition:

JavaScript

and the following handler definition:

JavaScript

Currently, when receiving the following request:

JavaScript

it returns:

JavaScript

But I want the response to look like:

JavaScript

I have tried different approaches but none to seem to have effect on the response type. I feel like I am missing something in the WSDL or the handler..

Advertisement

Answer

Omit the RPC tag in your WSDL definition and change it from

<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

to

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

because you’re using RPC as style it’s adding app: to the output message and the parts, ignoring your outputName and replacing it with SoapQueryResponse as well. Removing the RPC tag will give you this output

JavaScript

By default node-soap will remove all targetNamespace prefix from the message and message parts if is not stylized RPC. I have created a pull request here which will allow users to add optional targetNamespace on the output message to be prefixed on the output only not the parts. So with the suggested pull request, you’d add targetNamespace to your message

JavaScript

and you’ll get your desired output

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement