How can I configure the Root Element of a node-soap request body?

a 夏天 提交于 2019-12-10 15:17:33

问题


I'm trying to call a SOAP method using the node-soap package. My service's WSDL is:

<wsdl:definitions name="PublicoService" targetNamespace="http://tempuri.org/">
    <wsdl:import namespace="" location="http://10.10.0.45:56777/Services/PublicoService.svc?wsdl=wsdl0"/>
    <wsdl:types/>
    <wsdl:binding name="CustomBinding_PublicoService" type="PublicoService">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetAllDepartamento">
            <soap:operation soapAction="urn:PublicoService/GetAllDepartamento" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        .....

And my client code:

soap.createClient(url, {}, function(err, client) {
    client.GetAllDepartamento({}, function(err, result, raw, soapHeader) {
        console.log(result);
    });
});

The request is made, but I get this Envelope body:

<soap:Body>
    <PublicoService_GetAllDepartamento_InputMessage></PublicoService_GetAllDepartamento_InputMessage>
</soap:Body>

Which results in an error, because <PublicoService_GetAllDepartamento_InputMessage> should be <GetAllDepartamento>.

I've tried but couldn't change that tag, it's created automatically. Any help?

来源:https://stackoverflow.com/questions/45636977/how-can-i-configure-the-root-element-of-a-node-soap-request-body

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!