node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

return arrays 0.1.2 -> 0.1.3 ?

Open 0x80 opened this issue 14 years ago • 4 comments

I'm getting a lot of array wrappers around single items in the soap response using 0.1.3. In the previous version this doesn't occur. What happened and what's the idea behind it?

0x80 avatar Apr 02 '12 17:04 0x80

This may be a bug. Will take a look. On Apr 2, 2012 10:19 AM, "0x80" < [email protected]> wrote:

I'm getting a lot of arrays wrappers around items in the soap response using 0.1.3. In the previous version this doesn't occur. What happened and what's the idea behind it?


Reply to this email directly or view it on GitHub: https://github.com/milewise/node-soap/issues/32

vpulim avatar Apr 02 '12 19:04 vpulim

I am now trying to use the latest git version but the same issue is there. I had a closer look at the response and wsdl. In version 0.1.2 my service returned a single object. Now it's wrapped in an array. The wsdl looks like this:

 <xs:complexType name="getSourceByIdResponse">
      <xs:sequence>
         <xs:element minOccurs="0" name="octoFile" type="tns:octoFile"/>
      </xs:sequence>
   </xs:complexType>

Before this resulted in the following response:

{"octoFile":{"fileName":"Jimi.mp3","fileSize":"3347281","id":"31507","md5Hash":"6e39d391c11c6219de0b67d6cd391a61","mimeType":"audio/mpeg"}}

but since 0.1.3 its wrapped like this:

{"octoFile":[{"fileName":"Jimi.mp3","fileSize":"3347281","id":"31507","md5Hash":"6e39d391c11c6219de0b67d6cd391a61","mimeType":"audio/mpeg"}]}

Should I adapt to this new response or is this a bug?

0x80 avatar May 23 '12 08:05 0x80

@0x80 is the example you show a response from a node-soap server that you are hosting or is it the response that is coming back from a remote soap server via node-soap client?

milewise avatar May 23 '12 23:05 milewise

Yes the last one. I make a call to a remote soap server which has the wsdl as shown. The node-soap client returns an array where it was a single object before. I think the newer versions of node-soap are maybe just be more strict, because looking at the wsdl it make sense that it returns an array?

0x80 avatar May 24 '12 08:05 0x80