Hi guys,
(FYI I'm trying to deploy a axis2 webservice )
I have the following service, bean, descriptor
package au.com;
public class InfoService{
private Person person;
public Person getPerson(
String firstName, String lastname){
person = new Person();
person.setId(101);
person.setName("Mr. " + firstName +" " + lastname);
return person;
}
}
package au.com;
public class Person {
private int id;
private String name;
public int getId() {return id;}
public void setId(int id) {this.id = id;}
public String getName() {return name;}
public void setName(String name) {this.name = name;}
}
service.xml
<service name="InfoService" scope="application">
<description>
Info POJO Service
</description>
<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>
<parameter name="ServiceClass">
au.com.InfoService
</parameter>
<parameter name="useOrignalWSDL">true</parameter>
<parameter name="modifyUserWSDLPortAddress">false</parameter>
</service>
----------------------
using the above stuff I prepared a service archive (InfoService.aar) and deployed to
tomcat and execute the following client
import au.com.infoservice.client.InfoServiceStub.GetPerson;
import au.com.infoservice.client.InfoServiceStub.GetPersonResponse;
import au.com.infoservice.client.InfoServiceStub.Person;
public class InfoServiceClient {public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
InfoServiceStub stub = new InfoServiceStub();
GetPerson person = new GetPerson();
person.setParam0("Raj");
person.setParam1("Dav");
GetPersonResponse resp = stub.getPerson(person);
Person realperson = resp.get_return();
System.out.println(realperson.getId());
}
}
It worked well.
Later I have copied the default wsdl (axis2 autogenerated one) in to the META-INF folder and create the service archive and deployed to the same tomcat.
now the above client gives the following error :
Exception in
thread "main" org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement id
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at au.com.infoservice.client.InfoServiceStub.fromOM(InfoServiceStub.java:3632)
at au.com.infoservice.client.InfoServiceStub.getPerson(InfoServiceStub.java:473)
at au.com.infoservice.client.InfoServiceClient.main(InfoServiceClient.java:19)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement id
at au.com.infoservice.client.InfoServiceStub$Person$Factory.parse(InfoServiceStub.java:3475)
at au.com.infoservice.client.InfoServiceStub$GetPersonResponse$Factory.parse(InfoServiceStub.java:1159)
at au.com.infoservice.client.InfoServiceStub.fromOM(InfoServiceStub.java:3626)
... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement id
at au.com.infoservice.client.InfoServiceStub$Person$Factory.parse(InfoServiceStub.java:3469)
... 4 more
------------------------------
if I remove the wsdl file from the .aar and restart then the client works fine. What is this problem?
I have tried a couple of similar application - result is same. How to overcome this problem?
Cheers,
Raj