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

Complex Arguments

Open meowgorithm opened this issue 14 years ago • 10 comments

Is it possible to pass complex arguments along as part of a request (for example, an array)? Not seeing this in the docs and having little luck passing arrays as arguments.

meowgorithm avatar Nov 05 '12 17:11 meowgorithm

Having the same issue... Is this even supported? It could be clearly said Yes/No in the readme...

describe() on my wsdl produces lines like this for each operation: GetServerTime: [Object],

How to structure my args object if so? Only output I'm getting when trying is [undefined] for result and null for err.

bmantoni avatar Jan 17 '13 21:01 bmantoni

Try using JSON.stringify(client) rather than client.describe() for a more complete picture. In general, the expectations for the wsdl object can be harvested from the WSDL file directly and the client is really complicated for any sufficiently size WSDL. For the record I have this library doing both sides for a very complex set of WSDL files, it does work. I think the issue the OP is having is actually solved by passing back an object with names rather than an array.

alanbly avatar Jan 17 '13 22:01 alanbly

Thanks for the reply alan - I tried stringify, but there is quite a bit of output from that, and still not sure what the intention is for complex types, for example: In java, one would call this w/s like: req = new GetServerTimeRequest(); req.x = 'something'; response = client.GetServerTime(req); // being of type GetServerTimeRequest

I'm trying this now: var req = { x = 'something' } client.GetServerTime(req, ...

I assume I'm not structuring the args object properly?

bmantoni avatar Jan 18 '13 15:01 bmantoni

Actually it should look a lot like it does in java, there is still a GetServerTime request object, probably called "GetServerTime" buried in the WSDL. I know there's a lot of output from stringify, but it's worth copying it down and reading it because the object is defined in there. Look under client.wsdl.definitions.schemas for all the type definitions and, from there, under complexTypes for the request object.

alanbly avatar Jan 18 '13 16:01 alanbly

Alright, getting closer it feels like - stringify output does indeed include: "GetServerTimeRequest":{"nsName":"xsd:element", "namespace":"xsd", "name":"element", "children":[{"nsName":"xsd:complexType", ...

So, at the risk of asking a stupid question, how should I instantiate this, if not as a js array/anon object like I was before. I'm now trying this, but get the error that this is an unknown type: var req = new GetServerTimeRequest();

bmantoni avatar Jan 18 '13 16:01 bmantoni

I think you should still be able to use an anon-object, but it has to have the right children, all the way down. I built a parser to recursively harvest the types from the WSDL object so that I had the constructors, but you can do it manually by building the object being described. There should be one of the descendants of type xsd:sequence or something like that that then lists all the expected member names and their types.

alanbly avatar Jan 18 '13 16:01 alanbly

I'm having same problems with passing complex objects...It would be really helpful if anyone who has been able to successfully pass complex object to post a sample.

thanigaiv avatar Feb 09 '13 01:02 thanigaiv

I've got the same problem here too... tried different ways got different errors but could not receive the reponse

arazalip avatar Nov 16 '13 12:11 arazalip

+1 - anyone have a solution to this?

jzabel avatar Nov 30 '13 22:11 jzabel

Closing due to inactivity.

herom avatar Nov 11 '14 00:11 herom