Hi, you must use <xs:sequence> then <xs:choice> to do what you need, something like this:
<xs:element name="multiply"> <xs:complexType> <xs:sequence maxOccurs="unbounded"> <xs:choice> <xs:element minOccurs="0" name="a" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="b" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="c" nillable="true" type="xs:string"/> <xs:choice> </xs:sequence> </xs:complexType> </xs:element> On Mon, Nov 29, 2010 at 3:18 AM, Narendra Kadali < narendra_kad...@hotmail.com> wrote: > Hi All, > > I am using axis2 for my webservices. Today when i tried to use my own wsdl > file instead of axis2 default generated i observer unexpected behaviour.Here > goes the details. > This is the original wsdl file part. > <xs:element name="multiply"> > <xs:complexType> > <xs:sequence> > <xs:element minOccurs="0" name="a" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="b" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="c" nillable="true" > type="xs:string"/> > </xs:sequence> > </xs:complexType> > </xs:element> > I changed <xs:sequence> to <xs:all> so that i can send elements in > any order in soap request.Below is the changed one. > <xs:element name="multiply"> > <xs:complexType> > <xs:all> > <xs:element minOccurs="0" name="a" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="b" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="c" nillable="true" > type="xs:string"/> > </xs:all> > </xs:complexType> > </xs:element> > When I am executing this one I am getting value for a is blanck and for b > and c null. > Below is the soap request i am sending to server. > > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:axis="http://axis.apache.org/axis2"> > <soapenv:Header/> > <soapenv:Body> > <axis:multiply> > <!--You may enter the following 3 items in any order--> > <!--Optional:--> > <axis:a>a</axis:a> > <!--Optional:--> > <axis:b>b</axis:b> > <!--Optional:--> > <axis:c>c</axis:c> > </axis:multiply> > </soapenv:Body> > </soapenv:Envelope> > > Here is the code snippet i am using at server side > public String multiply(String a, String b, String c) > throws Exception > { > LogHelper.info(logger, "Begin - Multiply"); > if (a.trim().equals("")) > LogHelper.info(logger, "value fo a is a=\"\""); > if (b == null) > LogHelper.info(logger, "value fo b is null"); > if (c == null) > LogHelper.info(logger, "value fo c is null"); > > return "Hellow World"; > } > on the console for loggers Iam getting below out put: > 19:47:20,227 INFO [STDOUT] INFO [SampleWebService] Begin > - Multiply > 19:47:20,227 INFO [STDOUT] INFO [SampleWebService] value > fo a is a="" > 19:47:20,227 INFO [STDOUT] INFO [SampleWebService] value > fo b is null > 19:47:20,228 INFO [STDOUT] INFO [SampleWebService] value > fo c is null > Can any one tell why i am receivng values as blanck or null even i am > supplying values. > > Thanks, > Narendra > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org >