You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sameer Bombatkar <sa...@hotmail.com> on 2003/06/26 10:57:34 UTC

Re: [axis] Serializing embedded complex types

Could you also post your deploy.wsdd and the class which  all the operations 
for youre web-service??



Sameer.
.....................................................
"If a server crashes in a server farm and no one pings it, does it still 
cost four figures to fix?"






>From: Rhett.DeWall@sybase.com
>Reply-To: axis-user@ws.apache.org
>To: <ax...@xml.apache.org>
>Subject: [axis]  Serializing embedded complex types
>Date: Wed, 25 Jun 2003 15:51:18 -0600
>MIME-Version: 1.0
>Received: from apache.org ([208.185.179.12]) by mc7-f15.law1.hotmail.com 
>with Microsoft SMTPSVC(5.0.2195.5600); Wed, 25 Jun 2003 14:51:42 -0700
>Received: (qmail 78050 invoked by uid 500); 25 Jun 2003 21:51:16 -0000
>Received: (qmail 77992 invoked by uid 500); 25 Jun 2003 21:51:16 -0000
>X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
>Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm
>Precedence: bulk
>list-help: <ma...@ws.apache.org>
>list-unsubscribe: <ma...@ws.apache.org>
>list-post: <ma...@xml.apache.org>
>Delivered-To: mailing list axis-user@ws.apache.org
>Delivered-To: apmail-xml-axis-user@xml.apache.org
>X-Mailer: Lotus Notes Release 5.0.8  June 18, 2001
>Message-ID: <OF...@sybase.com>
>X-MIMETrack: Serialize by Router on BoulderNotes2/SYBASE(Release 5.0.12  
>|February 13, 2003) at 06/25/2003 03:51:18 PM
>X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
>Return-Path: axis-user-return-15952-sameer_bom=hotmail.com@ws.apache.org
>X-OriginalArrivalTime: 25 Jun 2003 21:51:43.0343 (UTC) 
>FILETIME=[F74E97F0:01C33B63]
>
>Has anyone had luck with embedded complex types with Axis.  Taking the
>Address example one step further, I have WSDL describes an address to have
>a phone that is a complex type, such as:
>
>   <EmployeeVO>
>     <firstName>John</firstName>
>     <lastName>Doe</lastName>
>     <phone>
>        <area>999</area>
>        <location>9999</location>
>        <prefix>999</prefix>
>     </phone>
>   </EmployeeVO>
>
>The WSDL, SOAP request, SOAP response and Java code follow.  Basically,
>AXIS cannot serialize the response because it interprets "EmployeeVO" as
>containing "area"...
>
>============= WSDL ==============
><?xml version="1.0" encoding="UTF-8"?>
><wsdl:definitions targetNamespace="urn:OtherTestEJB"
>xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>xmlns:apachesoap="http://xml.apache.org/xml-soap"
>xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>xmlns:tns1="http://util.test.sybase.com" xmlns:intf="urn:OtherTestEJB"
>xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:impl="urn:OtherTestEJB"
>xmlns="http://schemas.xmlsoap.org/wsdl/">
>  <wsdl:types>
>   <schema xmlns="http://www.w3.org/2001/XMLSchema"
>targetNamespace="http://util.test.sybase.com">
>    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>    <complexType name="EmployeeVO">
>     <sequence>
>      <element name="firstName" nillable="true" type="xsd:string"/>
>      <element name="lastName" nillable="true" type="xsd:string"/>
>      <element name="phone" nillable="true" type="tns1:PhoneVO"/>
>     </sequence>
>    </complexType>
>    <complexType name="PhoneVO">
>     <sequence>
>      <element name="area" nillable="true" type="xsd:string"/>
>      <element name="location" nillable="true" type="xsd:string"/>
>      <element name="prefix" nillable="true" type="xsd:string"/>
>     </sequence>
>    </complexType>
>    <element name="EmployeeVO" nillable="true" type="tns1:EmployeeVO"/>
>   </schema>
>  </wsdl:types>
>
>    <wsdl:message name="noParmsOrReturnResponse">
>
>    </wsdl:message>
>
>    <wsdl:message name="getEmployeeInfoRequest">
>
>       <wsdl:part name="employeeVO" type="tns1:EmployeeVO"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="OverloadedTestRequest1">
>
>       <wsdl:part name="value" type="xsd:string"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="OverloadedTestResponse">
>
>       <wsdl:part name="OverloadedTestReturn" type="xsd:string"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="getEmployeeInfoResponse">
>
>       <wsdl:part name="getEmployeeInfoReturn" type="tns1:EmployeeVO"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="twoParameterTestResponse">
>
>       <wsdl:part name="twoParameterTestReturn" type="xsd:string"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="twoParameterTestRequest">
>
>       <wsdl:part name="s1" type="xsd:string"/>
>
>       <wsdl:part name="s2" type="xsd:string"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="noParmsOrReturnRequest">
>
>    </wsdl:message>
>
>    <wsdl:message name="OverloadedTestResponse1">
>
>       <wsdl:part name="OverloadedTestReturn" type="xsd:string"/>
>
>    </wsdl:message>
>
>    <wsdl:message name="OverloadedTestRequest">
>
>       <wsdl:part name="value" type="xsd:int"/>
>
>    </wsdl:message>
>
>    <wsdl:portType name="OtherTestEJBImpl">
>
>       <wsdl:operation name="OverloadedTest" parameterOrder="value">
>
>          <wsdl:input name="OverloadedTestRequest"
>message="intf:OverloadedTestRequest"/>
>
>          <wsdl:output name="OverloadedTestResponse"
>message="intf:OverloadedTestResponse"/>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="OverloadedTest" parameterOrder="value">
>
>          <wsdl:input name="OverloadedTestRequest1"
>message="intf:OverloadedTestRequest1"/>
>
>          <wsdl:output name="OverloadedTestResponse1"
>message="intf:OverloadedTestResponse1"/>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="noParmsOrReturn">
>
>          <wsdl:input name="noParmsOrReturnRequest"
>message="intf:noParmsOrReturnRequest"/>
>
>          <wsdl:output name="noParmsOrReturnResponse"
>message="intf:noParmsOrReturnResponse"/>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="twoParameterTest" parameterOrder="s1 s2">
>
>          <wsdl:input name="twoParameterTestRequest"
>message="intf:twoParameterTestRequest"/>
>
>          <wsdl:output name="twoParameterTestResponse"
>message="intf:twoParameterTestResponse"/>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="getEmployeeInfo" parameterOrder="employeeVO">
>
>          <wsdl:input name="getEmployeeInfoRequest"
>message="intf:getEmployeeInfoRequest"/>
>
>          <wsdl:output name="getEmployeeInfoResponse"
>message="intf:getEmployeeInfoResponse"/>
>
>       </wsdl:operation>
>
>    </wsdl:portType>
>
>    <wsdl:binding name="AxisServletSoapBinding"
>type="intf:OtherTestEJBImpl">
>
>       <wsdlsoap:binding style="rpc"
>transport="http://schemas.xmlsoap.org/soap/http"/>
>
>       <wsdl:operation name="OverloadedTest">
>
>          <wsdlsoap:operation soapAction=""/>
>
>          <wsdl:input name="OverloadedTestRequest">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:input>
>
>          <wsdl:output name="OverloadedTestResponse">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:output>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="OverloadedTest">
>
>          <wsdlsoap:operation soapAction=""/>
>
>          <wsdl:input name="OverloadedTestRequest1">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:input>
>
>          <wsdl:output name="OverloadedTestResponse1">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:output>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="noParmsOrReturn">
>
>          <wsdlsoap:operation soapAction=""/>
>
>          <wsdl:input name="noParmsOrReturnRequest">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:input>
>
>          <wsdl:output name="noParmsOrReturnResponse">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:output>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="twoParameterTest">
>
>          <wsdlsoap:operation soapAction=""/>
>
>          <wsdl:input name="twoParameterTestRequest">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:input>
>
>          <wsdl:output name="twoParameterTestResponse">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:output>
>
>       </wsdl:operation>
>
>       <wsdl:operation name="getEmployeeInfo">
>
>          <wsdlsoap:operation soapAction=""/>
>
>          <wsdl:input name="getEmployeeInfoRequest">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:input>
>
>          <wsdl:output name="getEmployeeInfoResponse">
>
>             <wsdlsoap:body use="encoded"
>encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>namespace="urn:OtherTestEJB"/>
>
>          </wsdl:output>
>
>       </wsdl:operation>
>
>    </wsdl:binding>
>
>    <wsdl:service name="OtherTestEJBImplService">
>
>       <wsdl:port name="AxisServlet" binding="intf:AxisServletSoapBinding">
>
>          <wsdlsoap:address
>location="http://localhost:8090/axis/servlet/AxisServlet"/>
>
>       </wsdl:port>
>
>    </wsdl:service>
>
></wsdl:definitions>
>
>============= SOAP REQUEST ==============
>
>POST /axis/servlet/AxisServlet HTTP/1.0 Content-Type: text/xml;
>charset=utf-8 Accept: application/soap+xml, application/dime,
>multipart/related, text/* User-Agent: Axis/1.0 Host: localhost:8090
>Cache-Control: no-cache Pragma: no-cache SOAPAction: "" Content-Length:
>1073  <?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>
>   <ns1:getEmployeeInfo
>soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>xmlns:ns1="urn:OtherTestEJB">
>    <ns1:employeeVO href="#id0"/>
>   </ns1:getEmployeeInfo>
>   <multiRef id="id0" soapenc:root="0"
>soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>xsi:type="ns2:EmployeeVO"
>xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>xmlns:ns2="http://util.test.sybase.com">
>    <firstName xsi:type="xsd:string">John</firstName>
>    <lastName xsi:type="xsd:string">Doe</lastName>
>    <phone id="id0" soapenc:root="0"
>soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>xsi:type="ns2:EmployeeVO">
>     <area xsi:type="xsd:string">303</area>
>     <location xsi:type="xsd:string">4100</location>
>     <prefix xsi:type="xsd:string">413</prefix>
>    </phone>
>   </multiRef>
>  </soapenv:Body>
></soapenv:Envelope>
>
>============== SOAP Response ================
>HTTP/1.1 500 Internal Server Error Server: Jaguar Server Version 4.2
>Connection: Close Content-Type: text/xml; charset=utf-8  <?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>
>   <soapenv:Fault>
>    <faultcode
>xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>
>    <faultstring>org.xml.sax.SAXException: Invalid element in
>com.sybase.test.util.EmployeeVO - area</faultstring>
>    <detail>
>     <ns2:stackTrace
>xmlns:ns2="http://xml.apache.org/axis/">org.xml.sax.SAXException: Invalid
>element in com.sybase.test.util.EmployeeVO - area     at
>org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:252)
>       at
>org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:893)
>       at
>org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
>       at
>org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:684)
>       at
>org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:370)
>       at
>org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:169)
>       at
>org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:906)
>       at
>org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
>       at
>org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:684)
>       at
>org.apache.axis.message.RPCElement.deserialize(RPCElement.java:207)     at
>org.apache.axis.message.RPCElement.getParams(RPCElement.java:265)       at
>org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:190)
>       at
>org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:276)
>at
>org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
>       at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)   at
>org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)    at
>org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:437)  at
>org.apache.axis.server.AxisServer.invoke(AxisServer.java:316)     at
>org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:701)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)   at
>org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:335)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at
>com.sybase.jaguar.servlet.JagServlet.service(JagServlet.java:655)       at
>com.sybase.jaguar.servlet.JagRequestDispatcher.service(JagRequestDispatcher.java:922)
>       at
>com.sybase.jaguar.servlet.JagWebResource.service(JagWebResource.java:90)
>at
>com.sybase.jaguar.servlet.JagFilterChain.doFilter(JagFilterChain.java:131)
>at com.sybase.jaguar.servlet.ServletEngine._service(ServletEngine.java:804)
>       at
>com.sybase.jaguar.servlet.ServletEngine.service(ServletEngine.java:338)
>at
>com.sybase.jaguar.servlet.ServletServiceImpl.doService(ServletServiceImpl.java:52)
>       at
>com.sybase.jaguar.servlet._sk_JaguarServlet_ServletService.invoke(_sk_JaguarServlet_ServletService.java:151)
>  </ns2:stackTrace>
>    </detail>
>   </soapenv:Fault>
>  </soapenv:Body>
></soapenv:Envelope>
>
>================ Java code =================
>
>import java.io.Serializable;
>
>/*
>  * Value Object to test user defined types.
>*/
>public class EmployeeVO implements Serializable
>{
>    private String _firstName = "";
>    private String _lastName = "";
>    private PhoneVO _phone = null;
>
>    public EmployeeVO(){}
>
>
>    public EmployeeVO(String firstName, String lastName, PhoneVO phone)
>    {
>       _firstName = firstName;
>       _lastName  = lastName;
>       _phone     = phone;
>    }
>
>    public String getFirstName()
>    {
>       return _firstName;
>    }
>    public void setFirstName(String firstName)
>    {
>       _firstName = firstName;
>    }
>    public String getLastName()
>    {
>       return _lastName;
>    }
>    public void setLastName(String lastName)
>    {
>        _lastName = lastName;
>    }
>    public PhoneVO getPhone()
>    {
>       return _phone;
>    }
>    public void setPhone(PhoneVO phone)
>    {
>       _phone = phone;
>    }
>
>}
>
>class PhoneVO implements Serializable
>{
>    private String _area = "";
>    private String _prefix = "";
>    private String _location = "";
>
>    public PhoneVO(){}
>
>    public PhoneVO(String area, String prefix, String location)
>    {
>       _area = area;
>       _prefix  = prefix;
>       _location = location;
>    }
>
>    public String getArea()
>    {
>       return _area;
>    }
>    public void setArea(String area)
>    {
>       _area = area;
>    }
>    public String getPrefix()
>    {
>       return _prefix;
>    }
>    public void setPrefix(String prefix)
>    {
>        _prefix = prefix;
>    }
>    public String getLocation()
>    {
>       return _location;
>    }
>    public void setLocation(String location)
>    {
>       _location = location;
>    }
>
>}
>
>

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus