本文介绍了使用 nodejs 的 SOAP 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮帮我.

如何请求soap web服务并获得xml响应.赛纳里奥:使用soap ui即时发送带有用户名、密码身份验证的wsdl url,并且我将发送soap xml数据并得到响应.同样的事情如何使用 nodejs 或sails 实现.

在SoapUi中我的soap xml请求就像

<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><层:UnisysMB_Dispatch><PayLoad>SomeData</PayLoad></tier:UnisysMB_Dispatch></soapenv:Body></soapenv:信封>

我的 Soap 身份验证就像

$用户名:xyz &密码:xyz

我的 wsdl 网址是http://esbuatt1wm.ito.xyz.com:7001/ws/Tier1ICLStd_New:Tier1ICLMB_StdDispatch_New?WSDL

提供此信息后,我收到了 xml 响应

<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"><通讯确认><MB_UUID>cbbb683d-e9b1-4d12-b0db-8006134aad27</MB_UUID><ServiceID>麦当劳</ServiceID><确认>0</确认><Comment>Payload 不包含模式匹配 xpath.</Comment></CommAck></ser-root:CommAck>

我的问题是如何使用 node easy soap 获得上述 xml 响应,我是肥皂概念的新手.任何人都可以帮我给我上面senario的正确片段.....

解决方案

你可以使用这个包 https://www.npmjs.com/package/soap.示例在同一链接中.我在下面粘贴了一些内容:

使用 npm 安装:

 npm install soap

示例:

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) {控制台日志(结果);});});

基本身份验证安全

 client.setSecurity(new soap.BasicAuthSecurity('username', 'password'));

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.

<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>

$UserName : xyz & password:xyz

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'));

这篇关于使用 nodejs 的 SOAP 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:27