2

I'm facing a pretty annoying problem regarding sending soap-requests.

If I use a tool like SOAP-UI, i can easily build a proper soap-request in XML. But if I'm trying to use node-soap to send this soap-request I am not able to get the right xml-string...

I don't know why, but the node-soap plugin appends the string "SoapIn" to the method name (GetArrBoardWithDetail). See the following code snippet:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://thalesgroup.com/RTTI/2017-02-02/ldb/" xmlns:tok="http://thalesgroup.com/RTTI/2013-11-28/Token/types" xmlns:ct2007="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes"
  xmlns:ct2015="http://thalesgroup.com/RTTI/2015-11-27/ldb/commontypes" xmlns:ldbt2017="http://thalesgroup.com/RTTI/2017-02-02/ldb/types">
  <soapenv:Header>
    <tok:AccessToken>
      <tok:TokenValue>asdf</tok:TokenValue>
    </tok:AccessToken>
  </soapenv:Header>
  <soapenv:Body>
    <tns:**GetArrBoardWithDetailsSoapIn**>
      <tns:numRows>50</tns:numRows>
      <tns:crs>ACY</tns:crs>
      <tns:filterCrs></tns:filterCrs>
      <tns:filterType>to</tns:filterType>
      <tns:timeOffset>0</tns:timeOffset>
      <tns:timeWindow>120</tns:timeWindow>
    </tns:**GetArrBoardWithDetailsSoapIn**>
  </soapenv:Body>
</soapenv:Envelope>

The external tool SoapUI do not append a string like "SoapIn". Soap UI appends the string "Request" (see the following snippet).

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://thalesgroup.com/RTTI/2017-02-02/ldb/" xmlns:tok="http://thalesgroup.com/RTTI/2013-11-28/Token/types" xmlns:ct2007="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes"
  xmlns:ct2015="http://thalesgroup.com/RTTI/2015-11-27/ldb/commontypes" xmlns:ldbt2017="http://thalesgroup.com/RTTI/2017-02-02/ldb/types">
  <soapenv:Header>
    <tok:AccessToken>
      <tok:TokenValue>asdf</tok:TokenValue>
    </tok:AccessToken>
  </soapenv:Header>
  <soapenv:Body>
    <tns:**GetArrBoardWithDetailsRequest**>
      <tns:numRows>50</tns:numRows>
      <tns:crs>ACY</tns:crs>
      <tns:filterCrs></tns:filterCrs>
      <tns:filterType>to</tns:filterType>
      <tns:timeOffset>0</tns:timeOffset>
      <tns:timeWindow>120</tns:timeWindow>
    </tns:**GetArrBoardWithDetailsRequest**>
  </soapenv:Body>
</soapenv:Envelope>

The request generated by Soap UI works properly. Does anyone knows how to adjust this part of the XML-string according to the Soap-UI request ?

Source Code:

soap.WSDL.prototype.ignoredNamespaces = ['targetNamespace', 'typedNamespace'];

// several options to modify the xml code of the soap request
const wsdlOptions = {
  envelopeKey: 'soapenv',
  'overrideRootElement': {
    'namespace': 'tns',
  }
};

// // creates the soapClient
soap.createClient(wsdlUrl, wsdlOptions, function(err, client) {

  // adds the needed SoapHeader to the requests
  client.addSoapHeader(soapHeaderXML);

  // specific soap-request
  client.GetArrBoardWithDetails(soapParams, function(result, err) {
    var lRequest = client.lastRequest;
    var prettyLRequest = prettyData.xml(lRequest);
    console.log(prettyLRequest);
    console.log(result);
  })
})

Kindest Regards

SamSampleman
  • 65
  • 2
  • 8
  • My body tags are ' FirstBusiness1 ' What options do i set using soap npm? I get this error: 'Undeclared namespace prefix sup ' Any help will be great – Anish Aug 31 '18 at 11:27
  • You can use `_xml` from the `node soap` documentation to override the soap body that gets sent. – codeyard Dec 19 '17 at 08:56

0 Answers0