aspose file tools*
The moose likes Web Services and the fly likes org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement " Watch "org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement " New topic
Author

org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement

paritosh pandey
Greenhorn

Joined: Jan 08, 2008
Posts: 10
Hi,
While parsing the webservice response I am getting org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement

I am using axis 1.5.1 version My WSDL, request and response Strings are as following
Request
"<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:doBillerRegistration xmlns:ns1="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration"><in0>pin</in0><in1>pinelabs</in1><in2>000000000528</in2><in3>5632547895623|9920958120</in3><in4>KK|chirag test</in4><in5>N</in5></ns1:doBillerRegistration></soapenv:Body></soapenv:Envelope>"

Response
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:doBillerRegistrationResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration">
<doBillerRegistrationResult xsi:type="xsd:string">pin<<>>pinelabs<<>>000000000528<<>>5632547895623|9920958120<<>>KK|chirag test<<>>1000046394<<>>N<<>>F<<>>200024<<>>BILLER ALREADY PRESENT.<<>></doBillerRegistrationResult>
</ns1:doBillerRegistrationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


BillerRegistrationServiceStub.DoBillerRegistration func = new BillerRegistrationServiceStub.DoBillerRegistration();


try {


} catch (Exception e) {
logger.trace(e,e);
e.printStackTrace();
throw new Exception("Marshalling failed");
}

func.setIn0("pin");
func.setIn1("pinelabs");
func.setIn2("000000000528");
func.setIn3("5632547895623|9920958120");
func.setIn4("KK|chirag test");
func.setIn5("N");

//wsdl version
//axis version
//encoded response
//look at sample response of SOAP envelope from one of our service
BillerRegistrationServiceStub.DoBillerRegistrationResponse result = stub.doBillerRegistration(func); //getting error in this line
String responseStr = result.get_return();

wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration" xmlns:impl="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration-impl" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:intf="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:message name="doBillerRegistrationRequest">
<wsdl:part name="in0" type="xsd:string"/>
<wsdl:part name="in1" type="xsd:string"/>
<wsdl:part name="in2" type="xsd:string"/>
<wsdl:part name="in3" type="xsd:string"/>
<wsdl:part name="in4" type="xsd:string"/>
<wsdl:part name="in5" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="doBillerRegistrationResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="BillerRegistration">
<wsdlperation name="doBillerRegistration" parameterOrder="in0 in1 in2 in3 in4 in5">
<wsdl:input message="intf:doBillerRegistrationRequest"/>
<wsdlutput message="intf:doBillerRegistrationResponse"/>
</wsdlperation>
</wsdl:portType>
<wsdl:binding name="WebServiceBillerRegistrationSoapBinding" type="intf:BillerRegistration">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="doBillerRegistration">
<wsdlsoapperation soapAction=""/>
<wsdl:input>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration"/>
</wsdl:input>
<wsdlutput>
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="BillerRegistrationService">
<wsdl:port name="WebServiceBillerRegistration" binding="intf:WebServiceBillerRegistrationSoapBinding">
<wsdlsoap:address location="http://121.241.242.73:8101/wsBillerReg/services/WebServiceBillerRegistration"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

kindly help to solve this issue.
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi. I put your response XML in NewFile.xml. And I got this program (adapted from this) to read it:



When the text is this (from your original response xml):

pin<<>>pinelabs<<>>000000000528<<>>5632547895623|9920958120<<>>KK|chiragtest<<>>1000046394<<>>N<<>>F<<>>200024<<>>BILLER ALREADYPRESENT.<<>>

I get this error:
[Fatal Error] NewFile.xml:8:58: The content of elements must consist of well-formed character data or markup.
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at XMLReader.main(XMLReader.java:17)

But when I change the text to a regular string like "message", then it read the xml ok. So based on this, maybe the problem is with all the <<>> characters, because if I remove all of them, then the program works fine. Now, if the strange text were to be wrapped inside a CDATA tag like this, then it works fine:

<![CDATA[pin><<>>pinelabs<<>>000000000528<<>>5632547895623|9920958120<<>>KK|chiragtest<<>>1000046394<<>>N<<>>F<<>>200024<<>>BILLER ALREADYPRESENT.<<>>]]>

Hope that helps, though I am not so sure . If you have a resolution, kindly share it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement