首页 > 解决方案 > Node.js Soap 方法参数解析为字符串而不是相关对象

问题描述

我正在使用 node-soap 来使用 WebService。我以前多次使用过这个库并使用过这个服务,但是这次我遇到了以下情况。

我使用包含方法、输入等的 WSDL 创建客户端:

const soap = require("soap");

const url = "https://servintp.latinoseguros.com.mx:8071/wsCotizadorAutos/cotizador/CotizadorLatino.svc?wsdl";
soap.createClient(url, {}, (error, client) => {
    if (error) {
        callback(error);
    } else {
      const describe = client.describe()["CotizadorLatino"]["BasicHttpBinding_ICotizadorLatino"];
      console.log(describe["ObtenerMarcas"])
   }
});

请求成功并创建了客户端,但是当我描述方法“ObtenerMarcas”时,我收到以下对象:

{
  input: { datos: 'q17:DatosRequeridos' },
  output: { ObtenerMarcasResult: 'q18:ListMarca' }
}

其唯一的输入参数仅显示为字符串,而它应该是具有不同对象和属性的对象。

当使用Soap Client并输入完全相同的 WSDL 端点时,该方法会按应有的方式进行描述,其中包含预期要传递的所有子项和属性:

肥皂客户端截图

这让我相信这与客户端配置有关,或者可能是我没有考虑到的非常基本的东西。

谁能指出我做错了什么?

谢谢!

标签: node.jsweb-servicessoapnode-soap

解决方案


推荐阅读