Nobody knows why Axis 2 client can not correctly interpret complex type returned by an axis 1 server ?
2008/3/17, Richard Fagot <[EMAIL PROTECTED]>: > I would like to add sent soap messages : > > <?xml version='1.0' encoding='UTF-8'?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> > <soapenv:Body> > <ns1:getUrsula xmlns:ns1="http://ws.awas.ext" /> > </soapenv:Body> > </soapenv:Envelope> > > > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <soapenv:Body> > <getUrsulaResponse xmlns="http://ws.awas.ext"> > <getUrsulaReturn> > <values> > <values>une</values> > <values>deux</values> > <values>trois</values> > </values> > <name>ursula</name> > </getUrsulaReturn> > </getUrsulaResponse> > </soapenv:Body> > </soapenv:Envelope> > > 2008/3/17, Richard Fagot <[EMAIL PROTECTED]>: > > > Hi all, > > > > I have to create a web service with a lot of operations. On the > > server side, I must use axis 1.4. On the client side I must use Axis > > 2-1.3. > > For the server I have written an interface representing all > > operations (multiple complex arguments, complex returns) and the > > implementation of these interface and then generated the correspondant > > WSDL. I used this WSDL for the client side in Axis 2. At execution the > > client throw an exception of the type : org.apache.axis2.AxisFault: > > org.apache.axis2.databinding.ADBException: Unexpected subelement > > MyElement > > > > I have generated and used with success a client made with Axis 1.4. > > I have simplified the server interface begining with a method with no > > argument returning a simple string until I encounter the same issue as > > with the complete WS. This exception appears when the return object is > > a complex one containing an array of values. > > > > Here is the minimal sample generating the exception. Help is welcom :) > > > > #### Server Side (Axis 1.4) - Generation of the WSDL #### > > > > <target name="generateWSDL" depends="checkEnv"> > > <mkdir dir="${wsdl.dir}" /> > > <axis-java2wsdl classname="ext.awas.ws.AwasWS" > > serviceelementname="awas" bindingName="awas" style="WRAPPED" > > namespace="http://ws.awas.ext" > > > location="http://${java.rmi.server.hostname}/${wt.server.id}/servlet/service/awas" > > output="${wsdl.file}"> > > <classpath refid="awas.classpath" /> > > <mapping namespace="http://ws.awas.ext" package="ext.awas.ws" /> > > </axis-java2wsdl> > > </target> > > > > #### Server Side (Axis 1.4) - WS Interface Class #### > > package ext.awas.ws; > > > > public interface AwasWS { > > > > SimpleObject getUrsula(); > > } > > > > #### Server Side (Axis 1.4) - Returned type #### > > package ext.awas.ws; > > > > public class SimpleObject { > > private String name; > > private String[] values; > > > > public SimpleObject() { > > name = ""; > > values = new String[0]; > > } > > > > public void setName(String name) { > > this.name = name; > > } > > > > public String getName() { > > return name; > > } > > > > public void setValues(String[] values) { > > this.values = values; > > } > > > > public String[] getValues() { > > return values; > > } > > } > > > > #### Client Side (Axis 2-1.3) - Generation of the client part ####* > > <taskdef name="codegen" > > classname="org.apache.axis2.tool.ant.AntCodegenTask" > > classpathref="axis.classpath"/> > > <target name="default" depends="depends" description="--> > description"> > > <codegen overwrite="yes" > > wsdlfilename="${basedir}/wsdl/awas.wsdl" unpackclasses="true" > > serverside="false" unwrap="yes"/> > > </target> > > > > > > #### Client Side (Axis 2-1.3) - WS call #### > > try { > > ConfigurationContext configContext = > > ConfigurationContextFactory.createDefaultConfigurationContext(); > > > > AwasStub stub = new AwasStub(configContext, > > "http://localhost:9090/servlet/service/awas"); > > > > SimpleObject ursula = stub.getUrsula(new GetUrsula()); > > > > System.out.println(ursula.getName()); > > ArrayOf_xsd_string values = ursula.getValues(); > > String[] item = values.getItem(); > > for (int i = 0; i < item.length; i++) { > > System.out.println(item[i]); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > > > #### The Exception (exists only on the client side) #### > > org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: > > Unexpected subelement values > > at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417) > > at ext.awas.ws.AwasStub.fromOM(AwasStub.java:431) > > at ext.awas.ws.AwasStub.getUrsula(AwasStub.java:146) > > at ext.airbus.axis2.auth.Axis2AuthTest.main(Axis2AuthTest.java:45) > > Caused by: java.lang.Exception: > > org.apache.axis2.databinding.ADBException: Unexpected subelement > > values > > at ext.awas.ws.SimpleObject$Factory.parse(SimpleObject.java:509) > > at > ext.awas.ws.GetUrsulaResponse$Factory.parse(GetUrsulaResponse.java:377) > > at ext.awas.ws.AwasStub.fromOM(AwasStub.java:428) > > ... 2 more > > Caused by: org.apache.axis2.databinding.ADBException: Unexpected > > subelement values > > at ext.awas.ws.SimpleObject$Factory.parse(SimpleObject.java:467) > > ... 4 more > > sincerely, > > Richard Fagot > > > > -- > > > ------------------------------------------------------------------------------------- > > Richard Fagot Mail : [EMAIL PROTECTED] > > > > Genigraph URL : http://www.genigraph.fr > > Tertial II > > 216, route de Saint-Simon Tel : +33 (0)5 34 60 92 81 > > 31100 Toulouse, France Fax : +33 (0)5 34 60 92 89 > > > ------------------------------------------------------------------------------------ > > > > > -- > > ------------------------------------------------------------------------------------- > Richard Fagot Mail : [EMAIL PROTECTED] > > Genigraph URL : http://www.genigraph.fr > Tertial II > 216, route de Saint-Simon Tel : +33 (0)5 34 60 92 81 > 31100 Toulouse, France Fax : +33 (0)5 34 60 92 89 > > ------------------------------------------------------------------------------------ > -- ------------------------------------------------------------------------------------- Richard Fagot Mail : [EMAIL PROTECTED] Genigraph URL : http://www.genigraph.fr Tertial II 216, route de Saint-Simon Tel : +33 (0)5 34 60 92 81 31100 Toulouse, France Fax : +33 (0)5 34 60 92 89 ------------------------------------------------------------------------------------ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
