web services - Axis java to wsdl and complexType list -


i'm facing wsdl missmatch between entity , wsdl definition. seems ignore list of complex type. i'm using axis 2 generate wsdl entities generated xsd file.

here part of xsd file :

<xs:element name="funds">       <xs:complextype>         <xs:sequence>           <xs:element name="fund" maxoccurs="unbounded" minoccurs="0">             <xs:complextype>               <xs:sequence>                 <xs:element type="xs:string" name="code" />                 <xs:element type="xs:string" name="status" />               </xs:sequence>             </xs:complextype>           </xs:element>         </xs:sequence>       </xs:complextype>     </xs:element> 

this generates following entities :

@xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = {     "fund" }) public static class funds {      @xmlelement(name = "fund")     @xmlanyelement(lax=true)     protected list<request.funds.fund> fund;      public list<request.funds.fund> getfund() {         if (fund == null) {             fund = new arraylist<request.funds.fund>();         }         return this.fund;     }       public void setfund(list<request.funds.fund> fund) {         this.fund = fund;     }      @xmlaccessortype(xmlaccesstype.field)     @xmltype(name = "", proporder = {         "code",         "status"     })     public static class fund {          @xmlelement(name = "code", required = true)         protected string code;         @xmlelement(name = "status", required = true)         protected string status;          public string getcode() {             return code;         }          public void setcode(string value) {             this.code = value;         }          public string getstatus() {             return status;         }          public void setstatus(string value) {             this.status = value;         }     } } 

this generated code gives following wsdl :

<xs:complextype name="request_funds"> <xs:sequence> <xs:element minoccurs="0" name="fund" nillable="true" type="xs:anytype"/> </xs:sequence> </xs:complextype> 

the list typed anytype when unmarshalled following error :

 java.lang.classcastexception: org.apache.axiom.om.impl.llom.omelementimpl cannot cast com.legalsuite.services.start.importxml.request$funds$fund 

what can avoid behavior ?

as didn't declare funds xmlelement, it's not part of wsdl. it's container.

i think should declare funds explicitly there's no confusion wsdl follow :

@xmlelement(name = "funds") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = {     "fund" }) public static class funds {      @xmlelement(name = "fund")     @xmlanyelement(lax=true)     protected list<request.funds.fund> fund;      public list<request.funds.fund> getfund() {         if (fund == null) {             fund = new arraylist<request.funds.fund>();         }         return this.fund;     }       public void setfund(list<request.funds.fund> fund) {         this.fund = fund;     }      @xmlaccessortype(xmlaccesstype.field)     @xmltype(name = "", proporder = {         "code",         "status"     })     public static class fund {          @xmlelement(name = "code", required = true)         protected string code;         @xmlelement(name = "status", required = true)         protected string status;          public string getcode() {             return code;         }          public void setcode(string value) {             this.code = value;         }          public string getstatus() {             return status;         }          public void setstatus(string value) {             this.status = value;         }     } } 

Comments