L
L
lex2018-09-26 08:31:51
SOAP
lex, 2018-09-26 08:31:51

How to properly pass parameter string to SOAP?

Good afternoon! Please tell me how to correctly pass parameters in a soap message through nodejs. I am passing the soap package to
nodejs in the usual way

const str = 'Hello, im string';

client.TestConnect(str, function(err, result, rawResponse, soapHeader, rawRequest) { 
    console.log(rawRequest);
});

The request looks something like this
<?xml version="1.0" encoding="utf-8"?><soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"><soap:Body><TestConnect xmlns="http://tempuri.org/">Hello, im string</TestConnect></soap:Body></soap:Envelope>

But judging by the answers, a string format error. I'm wondering if it's possible to pass the parameters differently? How ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2018-09-26
bem @bemdev

If you use the wsdl analysis tools (for example , www.wsdl-analyzer.com ), you can see that the TestConnect method accepts a request in the form

<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
  <s11:Body>
    <ns1:TestConnect xmlns:ns1='http://tempuri.org/'>
<!-- optional -->
      <ns1:s>?XXX?</ns1:s>
    </ns1:TestConnect>
  </s11:Body>
</s11:Envelope>

Accordingly, in the code you need to call the method like this
client.TestConnect({s:str}, function(err, result, rawResponse, soapHeader, rawRequest) { 
    console.log(rawRequest);
});

where s is the parameter name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question