axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Devauld" <...@devauld.ca>
Subject Nested Elements - ????
Date Wed, 05 Feb 2003 22:49:04 GMT
Hello,


   I need help.  I have a service that returns a Java Bean.  My problem is
that the de-serializer doesn't appear to grab the right element.  My service
returns a connectivityReturn bean, and within that bean is the GMML object I
really want.  But if I return a connectivityReturn with just a GMML object
inside, I get a deserialization error.  If I modify the WSDL so that you can
nest connectivityReturn objects (and regenerate the Java classes) and put
the connectivityReturn with the GMML inside of another connectivityReturn it
works, but then I have two namespaces (that are the same) and repetition for
no reason on the wire.  I tried modifying the WSDL to expect a <return>
object between the <connectivityReturn> and the <GMML> but when WSDL2Java
creates the new classes I get the same de-serialization error.




I'm thinking a work around would be to leave the WSDL without the nesting,
and take the generated beans and place the padding <return> bean within the
connectivityReturn class.  This seems rather round-a-bout, and I would have
to manually edit a lot of classes.




Any ideas as to why this happens?  Am I expecting the wrong type of object
on the client side, or sending the wrong type from the server side?
Insanity check on my work-around?




Thanks


-W




Some code:


---------------START ConnectivityTest------




public class ConnectivityTest {


   public ConnectivityReturn connectivity () {


	   GMML toReturn = new GMML();


	   Child1 childLevel1 = new Child1();


         //Set some stuff on the child


         //Snipped


         toReturn.setChild1(childLevel1);


         ConnectivityReturn CR = new ConnectivityReturn();


         CR.setGMML(toReturn);


         //This does not work....


         //return CR


	   ConnectivityReturn CR2 = new ConnectivityReturn();


         CR2.setConnectivityReturn(CR);


         //But this does...


         return CR2;


   }


}


---------------END ConnectivityTest ------




My 'working' WSDL looks like:




-------- WSDL File ----------


<wsdl:definitions targetNamespace="http://blah/GMML"
xmlns:impl="http://blah/GMML" xmlns:intf="http://metsoautomation.com/GMML"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">


	<wsdl:types>


        <xs:schema elementFormDefault="qualified"
targetNamespace="http://blah/GMML">


	<xs:element name="ConnectivityReturn">


			   <xs:complexType>


					<xs:sequence>


					    <xs:element minOccurs="1" maxOccurs="1" ref="impl:GMML"/>


					    <xs:element minOccurs="0" maxOccurs="1"
ref="impl:ConnectivityReturn"/>


					</xs:sequence>


			   </xs:complexType>


			</xs:element>


	<xs:element name="GMML">


		<xs:complexType>


                <xs:element name="Child1" type="xs:string">


                ....


            </xs:complexType>


      </xs:element>


</xs:schema>


	</wsdl:types>


	<wsdl:message name="connectivityResponse">


		<wsdl:part name="connectivityReturn"
element="intf:ConnectivityReturn"/>


	</wsdl:message>


	<wsdl:message name="connectivityRequest"/>


	<wsdl:portType name="ConnectivityTest">


		<wsdl:operation name="connectivity">


			<wsdl:input name="connectivityRequest"
message="impl:connectivityRequest"/>


			<wsdl:output name="connectivityResponse"
message="impl:connectivityResponse"/>


		</wsdl:operation>


	</wsdl:portType>


	<wsdl:binding name="ConnectivitySoapBinding"
type="impl:ConnectivityTest">


		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>


		<wsdl:operation name="connectivity">


			<soap:operation soapAction=""/>


			<wsdl:input name="connectivityRequest">


				<soap:body use="literal" namespace="http://blah/GMML"/>


			</wsdl:input>


			<wsdl:output name="connectivityResponse">


				<soap:body use="literal" namespace="http://blah/GMML"/>


			</wsdl:output>


		</wsdl:operation>


	</wsdl:binding>


	<wsdl:service name="ConnectivityTestService">


		<wsdl:port name="Connectivity"
binding="impl:ConnectivitySoapBinding">


			<soap:address
location="http://localhost:8080/axis/services/Connectivity"/>


		</wsdl:port>


	</wsdl:service>


</wsdl:definitions>


-------------END WSDL---------------




Finally my wsdd:




------------Start WSDD-------------


<deployment xmlns="http://xml.apache.org/axis/wsdd/">


   <service name="Connectivity" provider="java:RPC" style="document"
use="literal">


      <wsdlFile>/GMML.wsdl</wsdlFile>


      <parameter name="className" value="ConnectivityTest"/>


      <parameter name="allowedMethods" value="*"/>


   </service>


</deployment>


-----------End WSDD----------------




this doesn't work, and I think it should


----------On the Wire--------------


<?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>


  <connectivityReturn xmlns="">


   <ns1:GMML xmlns:ns1="http://blah/GMML">


    <ns1:Child1>


      ...


    </ns1:Child1>


   </ns1:GMML>


  </connectivityReturn>


 </soapenv:Body>


</soapenv:Envelope>


----------End On the Wire------------




this Does work, and i think it shouldn't




------------On the wire--------------


<?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>


  <connectivityReturn xmlns="">


   <ns1:GMML xsi:nil="true" xmlns:ns1="http://blah/GMML"/>


   <ns2:ConnectivityReturn xmlns:ns2="http://blah/GMML">


    <ns2:GMML>


     <ns2:Child1>


       ....


     </ns2:Child1>


    </ns2:GMML>


   </ns2:ConnectivityReturn>


  </connectivityReturn>


 </soapenv:Body>


</soapenv:Envelope>


-----------End On the Wire--------




If you made it this far, I thank you. :-)






Mime
View raw message