Forums Register Login

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

+Pie Number of slices to send: Send
//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">

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

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

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

<wsdl:operation name="getB">
<soap:operation soapAction="urn:getB" style="document"/>

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

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="getC">
<soap:operation soapAction="urn:getC" style="document"/>

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

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

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

<wsdl:operation name="getB">
<soap12:operation soapAction="urn:getB" style="document"/>

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

<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="getC">
<soap12:operation soapAction="urn:getC" style="document"/>

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

<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

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

<wsdl:operation name="getB">
<http:operation location="TestService/getB"/>

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

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

<wsdl:operation name="getC">
<http:operation location="TestService/getC"/>

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

<wsdl:output>
<mime:content type="text/xml" part="getC"/>
</wsdl:output>
</wsdl:operation>
</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.
+Pie Number of slices to send: Send

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.
projectsLayout.GIF
ProjectLayout
[Thumbnail for projectsLayout.GIF]
+Pie Number of slices to send: Send
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
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
This thread has been viewed 18851 times.

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:34:48.