Search code examples
javascriptnode.jsweb-servicessoapnode-soap

Listen to SOAP request in Express


I'm using node-soap to make a SOAP call through an Express NodeJS application. I have very basic SOAP services wired up, most of which work perfectly.

There is one however that is returning a "resource not found" message (note this is a valid message from the service). Yet when I use the exact same header and body in Boomerang the resource is returning nicely. Is there a way of logging the full request that is being sent via node-soap itself (...rather than installing sniffer like fiddler)?

Sample of code I'm using:

soap.createClient(config.wsdl, (error, client) => {
  client.addSoapHeader(config.soapHeader());
  client[config.webMethodName](config.soapBody(policyNumber, agentNumber), (error, soapResponse) => {
    //do stuff
  });
});

Solution

  • This might help:

    https://github.com/vpulim/node-soap#clientlastrequest---the-property-that-contains-last-full-soap-request-for-client-logging

    Although I'm sure there is a normal request object buried in the node-soap implementation somewhere, the soapResponse object in your final callback might be of use for debugging as well.