SOAP Request using nodejs
Hi can anyone help me out.
how to request soap web service and get the xml response. Senario: Using soap ui im sending wsdl url with username, password authentication and also i will send soap xml data and i gets reponse. Same thing how to achive using nodejs or sails.
In SoapUi My soap xml request is like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tier="http://HCSLN9191-GMS.gois.ito.unisys.com/Tier1ICLStd:Tier1ICLMB_StdDispatch">
<soapenv:Header/>
<soapenv:Body>
<tier:UnisysMB_Dispatch>
<PayLoad>SomeData</PayLoad>
</tier:UnisysMB_Dispatch>
</soapenv:Body>
</soapenv:Envelope>
And My Soap Authentication is like
$UserName : xyz & password:xyz
My wsdl url is http://esbuatt1wm.ito.xyz.com:7001/ws/Tier1ICLStd_New:Tier1ICLMB_StdDispatch_New?WSDL
After provides this information i am getting xml response like
<ser-root:CommAck xmlns:ser-root="http://HCSLN1181-GMS.gois.ito.unisys.com/Tier1ICLStd_New:Tier1ICLMB_StdDispatch_New" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CommAck>
<MB_UUID>cbbb683d-e9b1-4d12-b0db-8006134aad27</MB_UUID>
<ServiceID>McDonalds</ServiceID>
<Acknowledge>0</Acknowledge>
<Comment>Payload does not contain the pattermatch xpath.</Comment>
</CommAck>
</ser-root:CommAck>
My Question is How to get that above xml response using node easy soap, i am new to soap concept. can anyboud help me out to give me the proper snippet for the above senario.....
You can use this package https://www.npmjs.com/package/soap. Examples are in the same link. I have pasted below some of the contents:
Install with npm:
npm install soap
Example:
var soap = require('soap');
var url = 'http://example.com/wsdl?wsdl';
var args = {name: 'value'};
soap.createClient(url, function(err, client) {
client.MyFunction(args, function(err, result) {
console.log(result);
});
});
BasicAuthSecurity
client.setSecurity(new soap.BasicAuthSecurity('username', 'password'));
链接地址: http://www.djcxy.com/p/35312.html
上一篇: 可能的SOAP版本不匹配:Envelope名称空间
下一篇: SOAP请求使用nodejs