nodejs - SOAP call is failing with 500 error using npm package strong soap

1.2k Views Asked by At

I am trying utilize the npm strong-soap package to execute a SOAP call in nodejs.

I am getting an error as below (first few lines of error is below)

"statusCode":500,"body":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:
Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <SOA
P-ENV:Body>\n        <SOAP-ENV:Fault>\n            <faultcode>BWENGINE-100031</f
aultcode>\n            <faultstring>Output data invalid</faultstring>\n
   <faultactor>JOBID_15734</faultactor>\n            <detail>\n                <
ns0:Error_Short_Message xmlns:ns0=\"http://xmlns.example.com/unique/default/name
space/1073503881527\">\n                    <ns0:key>JOBID_15734</ns0:key>\n
                <ns0:msg_code>BWENGINE-100031</ns0:msg_code>\n
  <ns0:message>Output data invalid</ns0:message>\n 

The client code is as below:

var soap = require('strong-soap').soap;
 var url = 'D:/Workspace/Projects/Sample.wsdl';
  var args = {arg1: '6564',arg2:'ONE'};
    var soapHeader = {
        'header1': 'value1',
        'header2': 'value2',
        'header3': 'value3',
    };
var options = {};
  soap.createClient(url,options,function (err, client) {
      client.setEndpoint('http://hostname:Port/SampleService/Service');
      var method = client['GetDataMethod'];
      method(args,function (err, result, envelope, soapHeader) {
          //response envelope
          //console.log('Response Envelope: \n' + envelope);
          //'result' is the response body
          console.log('Result: \n' + JSON.stringify(result));
      })
  });

Any suggestions on the reason for this error would be helpful.

UPDATE:

I was able to fire the request and get response if I build the args as something like below:

var args = {
   "namespace":{
        "requestHeader":{
            "header1": "value1",
            "header2": "value2",
            "header3": "value3"
            },
        "arg1": "6564",
        "arg2":"ONE"}
   };

But any reason why strong-soap is unable to setup the namespace based on wsdl content? Programmatically identifying the exact namespace among 20-30 namespaces in wsdl seems to be cumbersome task.

0

There are 0 best solutions below