web services - ADBException: Unexpected subelement -
i created web service using:
- apache axis 2 codegen wizard v.1.6.2 (binding: adb)
- eclipse juno
- tomcat 7
- java 6
the service returns custom java object (databean) client, stumbled upon exception in client code:
org.apache.axis2.axisfault: org.apache.axis2.databinding.adbexception: unexpected subelement {schematargetns}message from have researched, on n on again ... think common problem haven't yet got conclusive answer should done rectify it.
some posts on , other forums state wsdl needs modified (some name space), or client stub needs modification. state there bug in adb. surely bug in earlier versions of axis there many posts in mail-archives stating bug fixed. mailing-archives related earlier versions of axis2.
now questions are:
- is still bug ?
- what needs changed in wsdl or client stub ?
what worth mentioning created similar web service returns "string" client. works fine ! so, fails when complex data type involved.
there information on apache's website, under heading "known limitations"...
it reads: "adb meant 'simple' databinding framework , not meant compile types of schemas. following limitations highlighted.
- complex type extensions , restrictions."
is problem ?
the following snippet wsdl file might of interest you...
<wsdl:types> <xs:schema xmlns:ax26="http://mywebservice/xsd" attributeformdefault="qualified" elementformdefault="qualified" targetnamespace="schematargetns"> <xs:import namespace="http://mywebservice/xsd"/> <xs:element name="getmsg"> <xs:complextype> <xs:sequence> <xs:element minoccurs="0" name="reqdata" nillable="true" type="ax25:databean"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="getmsgresponse"> <xs:complextype> <xs:sequence> <xs:element minoccurs="0" name="return" nillable="true" type="ax25:databean"/> </xs:sequence> </xs:complextype> </xs:element> </xs:schema> <xs:schema attributeformdefault="qualified" elementformdefault="qualified" targetnamespace="http://mywebservice/xsd"> <xs:complextype name="databean"> <xs:sequence> <xs:element minoccurs="0" name="message" nillable="true" type="xs:string"/> <xs:element minoccurs="0" name="name" nillable="true" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:schema> </wsdl:types> now how fix problem ? should include other code snippets here?
"unexpected subelement" means message received receiver contained xml element receiver wasn't expecting. "{schematargetns}message" name of unexpected element encountered. in other words, sender sent invalid message receiver.
- the sender may have included element wasn't supposed to.
- the sender may have left out mandatory element.
- the sender may have put elements in wrong order.
- the sender may have sent incorrect message.
if server issued exception reported, client sent invalid message server. if client issued exception, error in response server client.
Comments
Post a Comment