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 "Quinn, Kim John" <KQ...@e-Cognita.com> on 2002/12/14 05:50:05 UTC

Problems with Deserialization

Hello all,

I am having a super frustrating problem with deserializing an object in
Axis.

It says it cannot find the "deserializer for {xxx}YYY".  I can see in the
TCPMonitor though that it seems to be working correctly.  I have a custom
serializer and deserializer that I am using.  I have tried scouring the
newsgroups and saw a lot on the topic but I couldnt seem to find anything
that helped me.

Everything seems to be working fine till i get to the client...



Here is my error:
---------------------------------
org.xml.sax.SAXException: Deserializing parameter 'createPersonReturn':
could not find deserializer
 for type {PersonWorkflowService}Person
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextIm
pl.java:883)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
681)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
        at org.apache.axis.client.Call.invoke(Call.java:1862)
        at org.apache.axis.client.Call.invoke(Call.java:1768)
        at org.apache.axis.client.Call.invoke(Call.java:1306)
        at test.testwf.TestWfWs.testPerson(TestWfWs.java:61)
        at test.testwf.TestWfWs.main(TestWfWs.java:87)
Exception in thread "main" AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: org.xml.sax.SAXException: Deserializing parameter
'createPersonReturn':  could not fin
d deserializer for type {PersonWorkflowService}Person
 faultActor: null
 faultDetail:
        stackTrace: org.xml.sax.SAXException: Deserializing parameter
'createPersonReturn':  could n
ot find deserializer for type {PersonWorkflowService}Person
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextIm
pl.java:883)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
681)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
        at org.apache.axis.client.Call.invoke(Call.java:1862)
        at org.apache.axis.client.Call.invoke(Call.java:1768)
        at org.apache.axis.client.Call.invoke(Call.java:1306)
        at test.testwf.TestWfWs.testPerson(TestWfWs.java:61)
        at test.testwf.TestWfWs.main(TestWfWs.java:87)


org.xml.sax.SAXException: Deserializing parameter 'createPersonReturn':
could not find deserializer
 for type {PersonWorkflowService}Person
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:115)
        at org.apache.axis.client.Call.invoke(Call.java:1865)
        at org.apache.axis.client.Call.invoke(Call.java:1768)
        at org.apache.axis.client.Call.invoke(Call.java:1306)
        at test.testwf.TestWfWs.testPerson(TestWfWs.java:61)
        at test.testwf.TestWfWs.main(TestWfWs.java:87)
Caused by: org.xml.sax.SAXException: Deserializing parameter
'createPersonReturn':  could not find d
eserializer for type {PersonWorkflowService}Person
        at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextIm
pl.java:883)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
681)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
        at org.apache.axis.client.Call.invoke(Call.java:1862)
        ... 4 more


Here is my deploy.wsdd
---------------------------------
<deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

  <!-- Services from PersonWorkflowService WSDL service -->

  <service name="PersonWorkflowService" provider="java:RPC">
      <parameter name="wsdlTargetNamespace"
value="urn:PersonWorkflowService"/>
      <parameter name="wsdlServiceElement" value="PersonWorkflowService"/>
      <parameter name="wsdlServicePort" value="PersonWorkflowService"/>
      <parameter name="className"
value="com.x2.blocks.person.webservice.PersonWorkflowServiceSoapBindingSkele
ton"/>
      <parameter name="wsdlPortType" value="PersonWorkflowPort"/>
      <parameter name="allowedMethods" value="*"/>
      <parameter name="scope" value="Request"/>
			<typeMapping qname="MyNS:Person"
xmlns:MyNS="PersonWorkflowService" 
	
languageSpecificType="java:com.x2.blocks.person.Person" 
	
serializer="com.x2.ext.axis.PersistableSerializerFactory" 
	
deserializer="com.x2.ext.axis.PersistableDeserializerFactory" 
	
encodingStype="http://schema.xmlsoap.org/soap/encoding/" />
  </service>
</deployment>


Here is my WSDL file:
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
      targetNamespace="urn:PersonWorkflowService" 
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
          xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
          xmlns:tns2="http://person.blocks.x2.com"
          xmlns:typens="urn:PersonWorkflowService"
          xmlns:apachesoap="http://xml.apache.org/xml-soap" 
          xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
          xmlns:intf="urn:PersonWorkflowService" 
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
          xmlns:impl="urn:PersonWorkflowService" 
      xmlns="http://schemas.xmlsoap.org/wsdl/">
 <wsdl:types/>

 <!--
   <types>
      <xsd:schema targetNamespace="urn:PersonWorkflowService"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      <xsd:complexType name="Person">
        <xsd:all>
            <xsd:element name="PersonID" type="xsd:int"/>
            <xsd:element name="FirstName" type="xsd:string"/>
            <xsd:element name="LastName" type="xsd:string"/>
        </xsd:all>
      </xsd:complexType>
    </xsd:schema>
  </types>
-->

   <wsdl:message name="testResponse">

      <wsdl:part name="testReturn" type="xsd:string"/>

   </wsdl:message>

   <wsdl:message name="createPersonResponse">

      <wsdl:part name="createPersonReturn" type="xsd:anyType"/>

   </wsdl:message>

   <wsdl:message name="createPersonRequest">

   </wsdl:message>

   <wsdl:message name="testRequest">

   </wsdl:message>

   <wsdl:portType name="PersonWorkflowPort">

      <wsdl:operation name="test">

         <wsdl:input name="testRequest" message="intf:testRequest"/>

         <wsdl:output name="testResponse" message="intf:testResponse"/>

      </wsdl:operation>

      <wsdl:operation name="createPerson">

         <wsdl:input name="createPersonRequest"
message="intf:createPersonRequest"/>

         <wsdl:output name="createPersonResponse"
message="intf:createPersonResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="PersonWorkflowServiceSoapBinding"
type="intf:PersonWorkflowPort">

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

      <wsdl:operation name="test">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="testRequest">

            <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PersonWorkflowService"/>

         </wsdl:input>

         <wsdl:output name="testResponse">

            <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PersonWorkflowService"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="createPerson">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="createPersonRequest">

            <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PersonWorkflowService"/>

         </wsdl:input>

         <wsdl:output name="createPersonResponse">

            <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PersonWorkflowService"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="PersonWorkflowService">

      <wsdl:port name="PersonWorkflowService"
binding="intf:PersonWorkflowServiceSoapBinding">

         <wsdlsoap:address
location="http://localhost:8080/axis/services/PersonWorkflowService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>


Here is my TCPMonitor Report:
------------------------------------------
Listen Port: 8070
Target Host: localhost
Target Port: 8080
==== Request ====
POST /axis/services/PersonWorkflowService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/beta3
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 389

<?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:createPerson
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="PersonWorkflowService"/>
 </soapenv:Body>
</soapenv:Envelope>==== Response ====
HTTP/1.1 200 OK
Date: Sat, 14 Dec 2002 04:50:48 GMT
Server: Jetty/4.1.0 (Windows 2000 5.0 x86)
Servlet-Engine: Jetty/4.1.0 (Servlet 2.3; JSP 1.2; java 1.4.0)
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>
  <ns1:createPersonResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="PersonWorkflowService">
   <createPersonReturn href="#id0"/>
  </ns1:createPersonResponse>
  <multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:Person"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="PersonWorkflowService">
   <PersonID xsi:type="xsd:int">1177</PersonID>
   <FisrtName xsi:type="xsd:string">Super</FisrtName>
   <LastName xsi:type="xsd:string">Man</LastName>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>


Here is my test:
---------------------------------------------
public void testPerson() throws Exception
    {
        String endpoint =
"http://localhost:8070/axis/services/PersonWorkflowService";
        
        Service srvc = new Service();
        
        Call    call = (Call)srvc.createCall();
        
        call.setTargetEndpointAddress ( new java.net.URL(endpoint) );
        
        call.setOperationName         ( new QName("PersonWorkflowService",
"createPerson") );
				
				/*
				QName qname = new
QName("PersonWorkflowService", "Person");
				Class clz =
com.x2.blocks.person.Person.class;
				call.registerTypeMapping(clz, qname,
com.x2.ext.axis.PersistableSerializerFactory.class,
com.x2.ext.axis.PersistableDeserializerFactory.class);
				call.setReturnType(XMLType.XSD_ANYTYPE);
				*/
				
				Person p = (Person)call.invoke( new Object[]
{} );
				
				System.out.println("Person: " +
p.getPersonID() + " = " + p.getFirstName() + ", " + p.getLastName() + "\n");
		}


Gad, any help or tips or suggestions would be really appreciated, I've been
banging my head against the wall on this one for some time now...

Thanks.

KJQ
kjq@ecognita.com