Search code examples
node.jsweb-servicesdelphisoapnode-soap

Node-soap consuming delphi soap webservice


I'm using nodejs and node-soap as client to consume a webservice published on iis and developed in delphi. The webservice is published with document/literal style.

On Node I'm invoking and logging the response of the operations like this:

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

Here is a portion of the xml result from delphi:

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

And this is the json obtained from node-soap (response):

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

I dont understand why node-soap includes the types of the data in the structure of the resulting json. Also, I don`t understand why arrays are parsed to json like an object with an array inside, instead of just an array.

Is there any way to ask node-soap just to include the data and the arrays just like simple arrays?

Here is the wsdl portion with the defines involved:

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

Thanks in advance for any help


Solution

  • It result to be a bug in the node-soap library so we are trying to fix it.