1 Reply Latest reply on Jan 24, 2005 4:52 PM by Steven Lamb

    Client deserialization error

    Steven Lamb Newbie

      I am getting the following exception in my web services client:

      2005-01-21 17:07:54,820 WARN org.jboss.webservice.deployment.TypeMappingDescription[main] - Class not found: hr.ejb.ark.al.com.StaffArray
      2005-01-21 17:08:47,898 ERROR org.apache.axis.client.Call[main] - Exception:
      org.xml.sax.SAXException: Deserializing parameter 'result': could not find deserializer for type {http://com.al.ark.ejb.hr/types}StaffArray
       at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:330)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1188)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1407)
       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:263)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:397)
       at org.apache.axis.client.Call.invoke(Call.java:2652)
       at org.apache.axis.client.Call.invoke(Call.java:2524)
       at org.apache.axis.client.Call.invokeInternal(Call.java:1976)
       at org.apache.axis.client.Call.invoke(Call.java:1917)
       at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:175)
       at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:251)
       at $Proxy0.getSimpleStaff(Unknown Source)
       at WebServicesTest.main(WebServicesTest.java:34)


      My client looks like the following:

       URL url = new URL("http://metal:8080/ark-web-ears-ark-ejb-SNAPSHOT/services/HRFacade?wsdl");
       QName qname = new QName("http://com.al.ark.ejb.hr", "HRService");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
       HREndpoint endpoint = (HREndpoint)service.getPort(HREndpoint.class);
      
       StaffArray entries = endpoint.getSimpleStaff();
       System.out.println("Number of entries: " + entries.getStaffArray().length);


      My wsdl:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <definitions name="HRService" targetNamespace="http://com.al.ark.ejb.hr" xmlns:tns="http://com.al.ark.ejb.hr" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://com.al.ark.ejb.hr/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <schema targetNamespace="http://com.al.ark.ejb.hr/types" xmlns:tns="http://com.al.ark.ejb.hr/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
       <complexType name="StaffArray">
       <sequence>
       <element name="staffArray" type="tns:SimpleStaffEntry" nillable="true" minOccurs="0" maxOccurs="unbounded"/></sequence></complexType>
       <complexType name="SimpleStaffEntry">
       <sequence>
       <element name="address" type="string" nillable="true"/>
       <element name="email" type="string" nillable="true"/>
       <element name="firstName" type="string" nillable="true"/>
       <element name="homePhone" type="string" nillable="true"/>
       <element name="id" type="int" nillable="true"/>
       <element name="lastName" type="string" nillable="true"/>
       <element name="location" type="string" nillable="true"/>
       <element name="mobilePhone" type="string" nillable="true"/>
       <element name="userName" type="string" nillable="true"/>
       <element name="workPhone" type="string" nillable="true"/>
       <element name="workRole" type="string" nillable="true"/></sequence></complexType></schema></types>
       <message name="HREndpoint_getSimpleStaff"/>
       <message name="HREndpoint_getSimpleStaffResponse">
       <part name="result" type="ns2:StaffArray"/></message>
       <portType name="HREndpoint">
       <operation name="getSimpleStaff">
       <input message="tns:HREndpoint_getSimpleStaff"/>
       <output message="tns:HREndpoint_getSimpleStaffResponse"/></operation></portType>
       <binding name="HREndpointBinding" type="tns:HREndpoint">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
       <operation name="getSimpleStaff">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal" namespace="http://com.al.ark.ejb.hr"/></input>
       <output>
       <soap:body use="literal" namespace="http://com.al.ark.ejb.hr"/></output></operation></binding>
       <service name="HRService">
       <port name="HREndpointPort" binding="tns:HREndpointBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>
      


      Mapping file:
      <?xml version="1.0" encoding="UTF-8"?>
      <java-wsdl-mapping version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
      <package-mapping>
      <package-type>com.al.ark.ejb.hr</package-type>
      <namespaceURI>http://com.al.ark.ejb.hr/types</namespaceURI>
      </package-mapping>
      <package-mapping>
      <package-type>com.al.ark.ejb.hr</package-type>
      <namespaceURI>http://com.al.ark.ejb.hr</namespaceURI>
      </package-mapping>
      <java-xml-type-mapping>
      <java-type>com.al.ark.ejb.staff.SimpleStaffEntry</java-type>
      <root-type-qname xmlns:typeNS="http://com.al.ark.ejb.hr/types">typeNS:SimpleStaffEntry</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>address</java-variable-name>
      <xml-element-name>address</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>email</java-variable-name>
      <xml-element-name>email</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>firstName</java-variable-name>
      <xml-element-name>firstName</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>homePhone</java-variable-name>
      <xml-element-name>homePhone</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>id</java-variable-name>
      <xml-element-name>id</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>lastName</java-variable-name>
      <xml-element-name>lastName</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>location</java-variable-name>
      <xml-element-name>location</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>mobilePhone</java-variable-name>
      <xml-element-name>mobilePhone</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>userName</java-variable-name>
      <xml-element-name>userName</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>workPhone</java-variable-name>
      <xml-element-name>workPhone</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>workRole</java-variable-name>
      <xml-element-name>workRole</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>com.al.ark.ejb.staff.StaffArray</java-type>
      <root-type-qname xmlns:typeNS="http://com.al.ark.ejb.hr/types">typeNS:StaffArray</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>staffArray</java-variable-name>
      <xml-element-name>staffArray</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <service-interface-mapping>
      <service-interface>com.al.ark.ejb.hr.HRService</service-interface>
      <wsdl-service-name xmlns:serviceNS="http://com.al.ark.ejb.hr">serviceNS:HRService</wsdl-service-name>
      <port-mapping>
      <port-name>HREndpointPort</port-name>
      <java-port-name>HREndpointPort</java-port-name>
      </port-mapping>
      </service-interface-mapping>
      <service-endpoint-interface-mapping>
      <service-endpoint-interface>com.al.ark.ejb.hr.HREndpoint</service-endpoint-interface>
      <wsdl-port-type xmlns:portTypeNS="http://com.al.ark.ejb.hr">portTypeNS:HREndpoint</wsdl-port-type>
      <wsdl-binding xmlns:bindingNS="http://com.al.ark.ejb.hr">bindingNS:HREndpointBinding</wsdl-binding>
      <service-endpoint-method-mapping>
      <java-method-name>getSimpleStaff</java-method-name>
      <wsdl-operation>getSimpleStaff</wsdl-operation>
      <wsdl-return-value-mapping>
      <method-return-value>com.al.ark.ejb.staff.StaffArray</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://com.al.ark.ejb.hr">wsdlMsgNS:HREndpoint_getSimpleStaffResponse</wsdl-message>
      <wsdl-message-part-name>result</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      </service-endpoint-interface-mapping>
      </java-wsdl-mapping>
      


      My ws4ee-deployment.xml file:
      <deployment
      xmlns='http://xml.apache.org/axis/wsdd/'
      xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
      xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
      xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
      
      <typeMapping
      qname="ns2:SimpleStaffEntry"
      xmlns:ns2="urn:BeanService"
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      type="java:com.al.ark.ejb.staff.SimpleStaffEntry"
      encodingStyle=''
      />
      </deployment>


      My SEI:
      public interface HREndpoint extends Remote {
       public StaffArray getSimpleStaff() throws RemoteException;
      }


      My StaffArray object:
      public class StaffArray implements Serializable {
       private SimpleStaffEntry[] staffArray;
       public SimpleStaffEntry[] getStaffArray() {
       return staffArray;
       }
       public void setStaffArray(SimpleStaffEntry[] staffArray) {
       this.staffArray = staffArray;
       }
      }
      


      My wsdd file:
      <deployment
       xmlns='http://xml.apache.org/axis/wsdd/'
       xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
       xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
       xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
       xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
      
      <service name='HRFacade' style='rpc' use='literal' provider='Handler'>
      
       <parameter name='webservice-identifier' value='ark-web-ears-ark-ejb-SNAPSHOT.jar#HR' />
       <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB' />
      
       <operation name='getSimpleStaff' qname='ns1:getSimpleStaff' returnQName='result' returnType='ns2:StaffArray' xmlns:ns1='http://com.al.ark.ejb.hr' xmlns:ns2='http://com.al.ark.ejb.hr/types' >
       </operation>
      
       <typeMapping
       qname='ns2:SimpleStaffEntry' xmlns:ns2='urn:BeanService'
       type='java:com.al.ark.ejb.staff.SimpleStaffEntry'
       serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
       deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
       encodingStyle=''>
       </typeMapping>
      
       <typeMapping
       qname='ns2:StaffArray' xmlns:ns2='http://com.al.ark.ejb.hr/types'
       type='java:com.al.ark.ejb.staff.StaffArray'
       serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
       deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
       encodingStyle=''>
       </typeMapping>
      
      
      </service>
      </deployment>
      


      I am getting no exceptions on the server. I have turned up the Axis debug level on Jboss and am seeing the SOAP response correctly however I am still getting this exception on the client:

      2005-01-21 17:07:54,820 WARN org.jboss.webservice.deployment.TypeMappingDescription[main] - Class not found: hr.ejb.ark.al.com.StaffArray
      2005-01-21 17:08:47,898 ERROR org.apache.axis.client.Call[main] - Exception:
      org.xml.sax.SAXException: Deserializing parameter 'result': could not find deserializer for type {http://com.al.ark.ejb.hr/types}StaffArray
       at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:330)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1188)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1407)
       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:263)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:397)
       at org.apache.axis.client.Call.invoke(Call.java:2652)
       at org.apache.axis.client.Call.invoke(Call.java:2524)
       at org.apache.axis.client.Call.invokeInternal(Call.java:1976)
       at org.apache.axis.client.Call.invoke(Call.java:1917)
       at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:175)
       at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:251)
       at $Proxy0.getSimpleStaff(Unknown Source)
       at WebServicesTest.main(WebServicesTest.java:34)


      Any help is appreciated.

      Steve

        • 1. Re: Client deserialization error
          Steven Lamb Newbie

          Just to close the loop on this one I did this in my client and it worked!

           File file=new File("HRMapping.xml");
           URL mappinglocation =file.toURL();
          
           file=new File("ws4ee-deployment.xml");
           URL ws4eeMetaData =file.toURL();
          
           URL url = new URL("http://metal:8080/ark-web-ears-ark-ejb-SNAPSHOT/services/HRFacade?wsdl");
           QName qname = new QName("http://com.al.ark.ejb.hr", "HRService");
           String portName = "HREndpoint";
           ServiceFactoryImpl factory = (ServiceFactoryImpl)ServiceFactory.newInstance();
           Service service = factory.createService(url, mappinglocation, ws4eeMetaData, qname, null );
           HREndpoint endpoint = (HREndpoint)service.getPort(HREndpoint.class);