I created web service object from wsdl file and call it like in below. I also print result. this code does not work. web server returns error. because, request has not namespace.
soap.createClient(__dirname + '/wsdl/getCustomerDetails.wsdl', function(err, client) {
.
.
var params= {"custId":"123"};
client.getCustomerDetails.getCustomerDetailsPort.getCustomerDetails(params,function(err,result){
console.log("lastRequest:"+client.lastRequest);
if (err != null)
console.log("error:"+JSON.stringfy(error));
});
}
here what I see in the last request
<soap:... xmlns:tns="http://example.com/api/getCustomerDetails/V01" >
....
<soap:Body>
<getCustomerDetailsRequest>
<custId>123</custId>
</getCustomerDetailsRequest>
</soap:Body>...
but it has to be
<soap:... xmlns:tns="http://example.com/api/getCustomerDetails/V01" >
....
<soap:Body>
<tns:getCustomerDetailsRequest>
<tns:custId>123</tns:custId>
</tns:getCustomerDetailsRequest>
</soap:Body>...
as you see, soap module does not add tns
namespace to the request. I tried var params= {"tns:custId":"123"};
, it adds namespace to the parameter, but still it does not add namespace to the request, getCustomerDetailsRequest
. because of that, I get Unexpected element getCustomerDetailsRequest found. Expected {http://example.com/api/getCustomerDetails/V01}getCustomerDetailsRequest
.
how can I force to add this namespace to the method itself ?