File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Getting exception org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Getting exception org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected " Watch "Getting exception org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected " New topic
Author

Getting exception org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected

asfak mahamud
Greenhorn

Joined: Apr 17, 2008
Posts: 5
//Class A.java

public class A implements Serializable{

private List childs = new ArrayList();

public A() {

}
public A[] getChilds() {
return childs.toArray(new A[childs.size()]);
}

public void setChilds(List
childs) {
this.childs = childs;
}

public void add(A a){
this.childs.add(a);
}
}

//class B.java
public class B extends A implements Serializable{
private int i = 0;

public B() {
}

public int getI() {
return i;
}

public void setI(int i) {
this.i = i;
}

public A[] getChilds() {
return super.getChilds();
}

public void add(A a){
super.add(a);
}

}

//Class C.java

public class C extends A implements Serializable{

private int j = 0;

public C() {
}

public int getJ() {
return j;
}

public void setJ(int i) {
this.j = i;
}

public A[] getChilds() {
return super.getChilds();
}

public void add(A a){
super.add(a);
}

}


//AService.java
public class AService {

public B[] getB(
String s){
B[] b = Manager.getInstance().getB("5");
return b;
}

public C getC(){
return new C();
}
}

//Manager.java
public class Manager {

private static Manager instance = null;

public static Manager getInstance(){
if(instance == null){
instance = new Manager();
}
return instance;
}

public B[] getB(String s){

List bs = new ArrayList();

B b1 = new B();
b1.setI(1);
C c1 = new C();
c1.setJ(11);
C c2 = new C();
c2.setJ(12);


B b2 = new B();
b2.setI(2);
C c3 = new C();
c3.setJ(21);
C c4 = new C();
c4.setJ(22);

b1.add(c1);
b1.add(c2);

b2.add(c3);
b2.add(c4);

bs.add(b1);
bs.add(b2);

return bs.toArray(new B[bs.size()]);

}
}

//services.xml
<service name="TestService" >
<description>
Please Type your service description here
</description>
<parameter name="ServiceClass" locked="false">pack.AService</parameter>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
</service>


//ClientTest.java
public class ClientTest {

public static void main(String[] args) {

try {
TestServiceStub serviceStub = new TestServiceStub();
GetB getB = new GetB();
getB.setS("test");
GetBResponse b = serviceStub.getB(getB);
B[] barr = b.get_return();
System.out.println(barr);


} catch (Exception e) {
e.printStackTrace();
}

}
}



wsdl file

<wsdl:definitions targetNamespace="http://pack">
<wsdl:documentation>TestService</wsdl:documentation>

<wsdl:types>

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pack">
<xs:import namespace="http://pack/xsd"/>

<xs:element name="getB">

<xs:complexType>

<xs:sequence>
<xs:element minOccurs="0" name="s" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="getBResponse">

<xs:complexType>

<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax22:B"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="getCResponse">

<xs:complexType>

<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ax22:C"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pack/xsd">

<xs:complexType name="A">

<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="childs" nillable="true" type="ax21:A"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="B">

<xs:complexContent>

<xs:extension base="ax21:A">

<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="childs" nillable="true" type="ax21:A"/>
<xs:element minOccurs="0" name="i" type="xs:int"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="C">

<xs:complexContent>

<xs:extension base="ax21:A">

<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="childs" nillable="true" type="ax21:A"/>
<xs:element minOccurs="0" name="j" type="xs:int"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
</wsdl:types>

<wsdl:message name="getBRequest">
<wsdl:part name="parameters" element="ns:getB"/>
</wsdl:message>

<wsdl:message name="getBResponse">
<wsdl:part name="parameters" element="ns:getBResponse"/>
</wsdl:message>
<wsdl:message name="getCRequest"/>

<wsdl:message name="getCResponse">
<wsdl:part name="parameters" element="ns:getCResponse"/>
</wsdl:message>

<wsdl:portType name="TestServicePortType">

<wsdlperation name="getB">
<wsdl:input message="ns:getBRequest" wsaw:Action="urn:getB"/>
<wsdlutput message="ns:getBResponse" wsaw:Action="urn:getBResponse"/>
</wsdlperation>

<wsdlperation name="getC">
<wsdl:input message="ns:getCRequest" wsaw:Action="urn:getC"/>
<wsdlutput message="ns:getCResponse" wsaw:Action="urn:getCResponse"/>
</wsdlperation>
</wsdl:portType>

<wsdl:binding name="TestServiceSoap11Binding" type="ns:TestServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>

<wsdlperation name="getB">
<soapperation soapAction="urn:getB" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdlutput>
<soap:body use="literal"/>
</wsdlutput>
</wsdlperation>

<wsdlperation name="getC">
<soapperation soapAction="urn:getC" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdlutput>
<soap:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>

<wsdl:binding name="TestServiceSoap12Binding" type="ns:TestServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>

<wsdlperation name="getB">
<soap12peration soapAction="urn:getB" style="document"/>

<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>

<wsdlutput>
<soap12:body use="literal"/>
</wsdlutput>
</wsdlperation>

<wsdlperation name="getC">
<soap12peration soapAction="urn:getC" style="document"/>

<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>

<wsdlutput>
<soap12:body use="literal"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>

<wsdl:binding name="TestServiceHttpBinding" type="ns:TestServicePortType">
<http:binding verb="POST"/>

<wsdlperation name="getB">
<httpperation location="TestService/getB"/>

<wsdl:input>
<mime:content type="text/xml" part="getB"/>
</wsdl:input>

<wsdlutput>
<mime:content type="text/xml" part="getB"/>
</wsdlutput>
</wsdlperation>

<wsdlperation name="getC">
<httpperation location="TestService/getC"/>

<wsdl:input>
<mime:content type="text/xml" part="getC"/>
</wsdl:input>

<wsdlutput>
<mime:content type="text/xml" part="getC"/>
</wsdlutput>
</wsdlperation>
</wsdl:binding>

<wsdl:service name="TestService">

<wsdl:port name="TestServiceHttpSoap11Endpoint" binding="ns:TestServiceSoap11Binding">
<soap:address location="http://192.168.0.80:8080/axis2/services/TestService.TestServiceHttpSoap11Endpoint/"/>
</wsdl:port>

<wsdl:port name="TestServiceHttpSoap12Endpoint" binding="ns:TestServiceSoap12Binding">
<soap12:address location="http://192.168.0.80:8080/axis2/services/TestService.TestServiceHttpSoap12Endpoint/"/>
</wsdl:port>

<wsdl:port name="TestServiceHttpEndpoint" binding="ns:TestServiceHttpBinding">
<http:address location="http://192.168.0.80:8080/axis2/services/TestService.TestServiceHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


I have got this exception

[INFO] Deploying module: metadataExchange - file:/D:/workspace/Test-ws-client/WebContent/WEB-INF/lib/mex-1.4.1.jar
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement j
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at pack.TestServiceStub.fromOM(TestServiceStub.java:4728)
at pack.TestServiceStub.getB(TestServiceStub.java:463)
at pack.ClientTest.main(ClientTest.java:15)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement j
at pack.TestServiceStub$A$Factory.parse(TestServiceStub.java:2305)
at pack.TestServiceStub$B$Factory.parse(TestServiceStub.java:3874)
at pack.TestServiceStub$GetBResponse$Factory.parse(TestServiceStub.java:4558)
at pack.TestServiceStub.fromOM(TestServiceStub.java:4722)
... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement j
at pack.TestServiceStub$A$Factory.parse(TestServiceStub.java:2299)
... 5 more






Please help me out.
asfak mahamud
Greenhorn

Joined: Apr 17, 2008
Posts: 5

Please let me know whether it is possible to use inheritance in axis2.

I wrote a new program




















wsdl file:






output:

[INFO] Deploying module: metadataExchange - file:/D:/workspace/TestWsClient/WebContent/WEB-INF/lib/mex-1.4.1.jar
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement j1
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at pack.TestServiceStub.fromOM(TestServiceStub.java:3417)
at pack.TestServiceStub.getAs(TestServiceStub.java:206)
at pack.MyTest.main(MyTest.java:19)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement j1
at pack.TestServiceStub$A$Factory.parse(TestServiceStub.java:2343)
at pack.TestServiceStub$GetAsResponse$Factory.parse(TestServiceStub.java:1726)
at pack.TestServiceStub.fromOM(TestServiceStub.java:3404)
... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement j1
at pack.TestServiceStub$A$Factory.parse(TestServiceStub.java:2337)
... 4 more



Can anybody tell me what's the problem? It's urgent.

Regards.



[Thumbnail for projectsLayout.GIF]

Alan Hampson
Ranch Hand

Joined: Apr 10, 2009
Posts: 31
I'm also looking at a similar issue.

If I read it correctly, this is an open Apache bug: WSAS-627

Hopefully, someone will tell me I'm wrong.

alan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting exception org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected
 
Similar Threads
Axis2 Issue, Please Help!
XmlException on calling WSDL2Java
Axis2 (1.5) - Unable to see POJO deployed as service
axis2/webshpere response != axis2/glassfish response........ why?
Need help in writing WebService client using XMLBeans