You're right. The array within the array should be mapped to this: <login xmlns="http://some/namespace"> <username>tim</username> <password>tim</password> <options> <name>dummy1</name> <value xsi:type="xsd:string">dummy_val1</value> </options> <options> <name>dummy2</name> <value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace"> <name>dummy2-1</name> <value xsi:type="xsd:string">val2-1</value> <name>dummy2-2</name> <value xsi:type="xsd:int">314</value> </value> </options> </login>
I suggest you file a bug report, because Axis is not generating the right message structure per the WSDL. Anne On 4/13/05, Tim K. (Gmane) <[EMAIL PROTECTED]> wrote: > Hi Anne, > > I actually started from Java classes using Java2WSDL (I know this is not > the best practice, but if there's something wrong with the WSDL I could try > and fix it by hand). > > The ArrayOfNamedValue is defined like below, but it does not seem to come > into play at all: > > > > - <complexType name="ArrayOfNamedValue"> > > > - <sequence> > > > <element name="item" type="impl:NamedValue" minOccurs="0" > maxOccurs="unbounded" /> > </sequence> > </complexType> > I exposed this method: > NamedValue[] login(String username, String password, NamedValue[] options) > Which in the WSDL the request looks like this: > > > > - <element name="login"> > > > - <complexType> > > > - <sequence> > > > <element name="username" type="xsd:string" /> > > <element name="password" type="xsd:string" /> > > <element name="options" type="impl:NamedValue" > maxOccurs="unbounded" /> > </sequence> > </complexType> > </element> > And the response like this: > > > > - <element name="loginResponse"> > > > - <complexType> > > > - <sequence> > > > <element name="loginReturn" type="impl:NamedValue" > maxOccurs="unbounded" /> > </sequence> > </complexType> > </element> > This seems OK so far, even though ArrayOfNamedValue is defined but it does > not seem to be used. > > This is exactly what I want to pass back and forth: > > NamedValue object: > name: "dummy-2" > value: NamedValue[] > > But it doesn't look like that's what I get on the server side, it seems that > I get: > > NamedValue object: > name: "dummy-2" > value: NamedValue <--- Note no array [] here > > And the value of the red NamedValue is the last value sent, in my example > below it's 314 > > How would Axis know that it needs to convert the request below into a > NamedValue[] on the server side? What if the sequence of values would not be > homogeneus, would it convert it into an Object[] instead (if it worked at > all)? > > <login xmlns="http://some/namespace"> > <username>tim</username> > <password>tim</password> > <options> > <name>dummy1</name> > <value xsi:type="xsd:string">dummy_val1</value> > </options> > <options> > <name>dummy2</name> > <value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace"> > <name>dummy2-1</name> > <value xsi:type="xsd:string">val2-1</value> > </value> > <value xsi:type="ns2:NamedValue" xmlns:ns2="http://some/namespace"> > <name>dummy2-2</name> > <value xsi:type="xsd:int">314</value> > </value> > </options> > </login> > > The part in red above does not seem to map to this: > NamedValue object: > name: "dummy-2" > value: NamedValue[] > > This confuses me greatly, I'm not sure whether what I'm trying to do is > allowed/supported over wrapped doc/literal at all, if it is not I should > then switch back to rpc/encoded or it's just a bug in Axis. > > Btw, .NET doesn't seem to be able to convert the red fragment above into a > NamedValue[] so I suspect the message generated by Axis is not correct when > it comes to arrays inside arrays. > > Thanks. > > Tim > > > Anne Thomas Manes wrote: > Tim, > > How did you define the array of NamedValue in the schema (where did > the <options> tag come from)? > > It looks to me as if the message corresponds to the request. Because > you're using <xsd:anytype>, the value element may contain an array of > the NameValue. Hence the dummy-2 object is defined thus: > > NamedValue object: > name: "dummy-2" > value: NamedValue[] > > Is this not what you want? > > Anne > > On 4/13/05, Tim K. (Gmane) <[EMAIL PROTECTED]> wrote: > > > Hello, > > If someone could please help me with this issue I would appreciate it. I > recently converted my web service from rpc/encoded to wrapped > document/literal so that it works with .NET (before the change everything > still worked even with .NET, except for problems with custom > exceptions/faults). > > I have a data type defined as: > > <complexType name="NamedValue"> > <sequence> > <element name="name" nillable="true" type="xsd:string" /> > <element name="value" nillable="true" type="xsd:anyType" /> > </sequence> > </complexType> > > I need the value to be xsd:anyType so that I can send arrays of NamedValue > with various types for value. > > On the server side I have a method defined as: > > NamedValue[] login(String username, String password, NamedValue[] options) > > If I create on the client side an options array that looks like this: > > NamedValue[] options = new NamedValue[] > { > new NamedValue("dummy1", "dummy_val1"), > > new NamedValue("dummy2", > new NamedValue[] > { > new NamedValue("dummy2-1", "val2-1"), > new NamedValue("dummy2-2", new Integer(314)) > }) > }; > > Note the array inside the array above. > > A request to the server from an Axis client (latest CVS version of 1.2RC3) > looks like this: > > <login xmlns="http://some/namespace"> > <username>tim</username> > <password>tim</password> > <options> > <name>dummy1</name> > <value xsi:type="xsd:string">dummy_val1</value> > </options> > <options> > <name>dummy2</name> > <value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace"> > <name>dummy2-1</name> > <value xsi:type="xsd:string">val2-1</value> > </value> > <value xsi:type="ns2:NamedValue" xmlns:ns2="http://some/namespace"> > <name>dummy2-2</name> > <value xsi:type="xsd:int">314</value> > </value> > </options> > </login> > > The encoding of the array inside the array does not seem right to me, the > server ends up with a NamedValue value for "dummy2" instead of a > NamedValue[]. > > If the message is not correct, what should it look like? I assume it would > need a wrapper, something like ArrayOfNamedValue ... but then this type > would have to be defined in the schema (which in this case it is), but what > about say ArrayOfLong, ArrayOfString, etc. which are not defined in the > schema and could be sent at runtime because the value type is xsd:anyType? > > Is this supposed to work the way I want it with wrapped doc/literal? It > worked fine before with rpc/encoded. > > If so, is this a bug in Axis? Any available patches for it? > > Thank you for any help you may provide. > -- > Tim > > > >
