Node-soap消费delphi soap webservice

时间:2016-02-05 20:26:27

标签: node.js web-services delphi soap node-soap

我使用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>

提前感谢您提供任何帮助

1 个答案:

答案 0 :(得分:0)

结果是node-soap库中的错误,所以我们正在尝试修复它。

相关问题