0

我使用 nodejs 和 node-soap 作为客户端来使用在 iis 上发布并在 delphi 中开发的 web 服务。Web 服务以文档/文字样式发布。

在节点上,我正在调用并记录这样的操作的响应:

        client[functionName](args, function (err, result) {
            if (err) {
                console.log(err);
            } else {
                console.log(result);
            }
        });

下面是来自 delphi 的部分 xml 结果:

...
  <GetValuesResponse xmlns="urn:WS_TEST">
  <res xmlns="urn:UTest">
    <matrixData>
      <TDoubleDynArray>
        <double>4.32427893698308</double>
        <double>4.40404718921869</double>
        <double>4.50060875771443</double>
        <double>4.56778202275494</double>
        <double>4.61816197153533</double>
        <double>4.73991351442126</double>
        <double>4.78609513413661</double>
        <double>4.8238800957219</double>
        <double>4.8238800957219</double>
        <double>4.81128510852681</double>
        ...

这是从node-soap(响应)获得的json:

  ... 
"matrixData": {
      "TDoubleDynArray": [
        {
          "double": [
            "4.32427893698308",
            "4.40404718921869",
            "4.50060875771443",
            "4.56778202275494",
            "4.61816197153533",
            "4.73991351442126",
            "4.78609513413661",
            "4.8238800957219",
            "4.8238800957219",
            "4.81128510852681",
            ...

我不明白为什么 node-soap 在结果 json 的结构中包含数据类型。另外,我不明白为什么将数组解析为json,就像里面有一个数组的对象,而不仅仅是一个数组。

有没有办法让 node-soap 像简单数组一样包含数据和数组?

这是涉及定义的 wsdl 部分:

<element name="matrixData" type="ns6:TMatOfDouble"/>

<complexType name="TMatOfDouble">
  <complexContent>
    <restriction base="soapenc:Array">
      <sequence/>
      <attribute ref="soapenc:arrayType" n1:arrayType="ns1:TDoubleDynArray[]"/>  
    </restriction>
  </complexContent>
</complexType>

<complexType name="TDoubleDynArray">
  <complexContent>
    <restriction base="soapenc:Array">
      <sequence/>
      <attribute ref="soapenc:arrayType" n1:arrayType="xs:double[]"/>
    </restriction>
  </complexContent>
</complexType>

提前感谢您的帮助

4

1 回答 1

0

结果是 node-soap 库中的一个错误,因此我们正在尝试修复它。

于 2016-04-26T21:44:21.083 回答