1 Reply Latest reply on Sep 3, 2004 11:52 AM by iamapony

    Can not deserialize complex types

    iamapony

      Sorry, my previous post had cut/paste errors let me try again.

      I'm trying to expose a SessionBean method as a webService that returns a Vector of java objects. Below is my web-services.xml file

      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- -->
      <!-- This JBoss.Net Web Service Descriptor has been generated by XDoclet -->
      <!-- and is brought to you by F. M. Brier, C. G. Jung and J. Essington -->
      <!-- -->
      
      <deployment
       name="webServices"
       xmlns="http://xml.apache.org/axis/wsdd/"
       targetNamespace="http://www.creeksystems.com/webServices"
       xmlns:acservices="http://www.creeksystems.com/webServices"
       xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
      
      <!-- The following are declarations of service endpoints targetted to
       session beans -->
      
       <service name="locationServices" provider="Handler">
       <parameter name="handlerClass" value="org.jboss.net.axis.server.EJBProvider"/>
       <parameter name="beanJndiName" value="ejb/activechain/LocationManager"/>
       <parameter name="allowedMethods" value="submitLocationRecord "/>
       <requestFlow name="locationServicesRequest">
       <handler type="java:org.jboss.net.axis.server.JBossAuthenticationHandler">
       <parameter name="securityDomain" value="java:/jaas/ActiveChain-login"/>
       </handler>
       <handler type="java:org.jboss.net.axis.server.JBossAuthorizationHandler">
       <parameter name="securityDomain" value="java:/jaas/ActiveChain-login"/>
       <parameter name="allowedRoles" value="users"/>
       </handler>
      
       </requestFlow>
       <responseFlow name="locationServicesResponse">
      
       </responseFlow>
       <!-- Operation mapping results -->
      
       <operation name="submitLocationRecord" returnQName="sLocationRecord">
       <parameter name="rlr"/>
       </operation>
      
       </service>
      
       <service name="notificationServices" provider="Handler">
       <parameter name="handlerClass" value="org.jboss.net.axis.server.EJBProvider"/>
       <parameter name="beanJndiName" value="ejb/activechain/NotificationManager"/>
       <parameter name="allowedMethods" value="getNotificationListeners "/>
       <requestFlow name="notificationServicesRequest">
       <handler type="java:org.jboss.net.axis.server.JBossAuthenticationHandler">
       <parameter name="securityDomain" value="java:/jaas/ActiveChain-login"/>
       </handler>
       <handler type="java:org.jboss.net.axis.server.JBossAuthorizationHandler">
       <parameter name="securityDomain" value="java:/jaas/ActiveChain-login"/>
       <parameter name="allowedRoles" value="users"/>
       </handler>
      
       </requestFlow>
       <responseFlow name="notificationServicesResponse">
      
       </responseFlow>
       <!-- Operation mapping results -->
      
       <operation name="getNotificationListeners" returnQName="gNotificationListeners">
       </operation>
      
       </service>
      
      <!-- The following are typemappings for entity beans for implementing
       the implicit web-service value-object pattern -->
      
      <!-- The following are typemappings for bean-type value-objects -->
      
       <typeMapping
       qname="acservices:RemoteLocationRecord"
       type="java:com.creeksystems.activechain.apps.services.location.RemoteLocationRecord"
       serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
       deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      
       <typeMapping
       qname="acservices:RemoteLocationEvent"
       type="java:com.creeksystems.activechain.apps.services.location.RemoteLocationEvent"
       serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
       deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      
       <typeMapping
       qname="acservices:RemoteNotificationListener"
       type="java:com.creeksystems.activechain.apps.services.notification.RemoteNotificationListener"
       serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
       deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      
      <!-- There follow merged custom web service descriptions -->
      
      </deployment>
      
      
      


      Which generates the following wsdl file
      
       <?xml version="1.0" encoding="UTF-8" ?>
      - <wsdl:definitions targetNamespace="http://localhost:8080/jboss-net/services/notificationServices" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/jboss-net/services/notificationServices" xmlns:intf="http://localhost:8080/jboss-net/services/notificationServices" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://net.jboss.org/jmx" xmlns:tns2="http://www.creeksystems.com/webServices" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      - <wsdl:types>
      - <schema targetNamespace="http://net.jboss.org/jmx" xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      - <simpleType name="ObjectNameType">
      - <simpleContent>
       <extension base="xsd:string" />
       </simpleContent>
       </simpleType>
       </schema>
      - <schema targetNamespace="http://www.creeksystems.com/webServices" xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      - <complexType name="RemoteLocationEvent">
      - <sequence>
       <element name="batteryLow" type="xsd:boolean" />
       <element name="eventDesc" nillable="true" type="xsd:string" />
       <element name="eventTime" nillable="true" type="xsd:dateTime" />
       <element name="tagId" nillable="true" type="xsd:string" />
       <element name="tampered" type="xsd:boolean" />
       </sequence>
       </complexType>
      - <complexType name="RemoteLocationRecord">
      - <sequence>
       <element name="checkPointTime" nillable="true" type="xsd:dateTime" />
       <element name="locationId" nillable="true" type="xsd:string" />
       <element name="remoteLocationEvents" nillable="true" type="apachesoap:Vector" />
       </sequence>
       </complexType>
      - <complexType name="RemoteNotificationListener">
      - <sequence>
       <element name="groupIp" nillable="true" type="xsd:string" />
       <element name="locationId" nillable="true" type="xsd:string" />
       </sequence>
       </complexType>
       </schema>
      - <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      - <complexType name="Vector">
      - <sequence>
       <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" />
       </sequence>
       </complexType>
       </schema>
       </wsdl:types>
      - <wsdl:message name="getNotificationListenersResponse">
       <wsdl:part name="gNotificationListeners" type="apachesoap:Vector" />
       </wsdl:message>
       <wsdl:message name="getNotificationListenersRequest" />
      - <wsdl:portType name="NotificationManager">
      - <wsdl:operation name="getNotificationListeners">
       <wsdl:input message="impl:getNotificationListenersRequest" name="getNotificationListenersRequest" />
       <wsdl:output message="impl:getNotificationListenersResponse" name="getNotificationListenersResponse" />
       </wsdl:operation>
       </wsdl:portType>
      - <wsdl:binding name="notificationServicesSoapBinding" type="impl:NotificationManager">
       <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
      - <wsdl:operation name="getNotificationListeners">
       <wsdlsoap:operation soapAction="notificationServices" />
      - <wsdl:input name="getNotificationListenersRequest">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/jboss-net/services/notificationServices" use="encoded" />
       </wsdl:input>
      - <wsdl:output name="getNotificationListenersResponse">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/jboss-net/services/notificationServices" use="encoded" />
       </wsdl:output>
       </wsdl:operation>
       </wsdl:binding>
      - <wsdl:service name="NotificationManagerService">
      - <wsdl:port binding="impl:notificationServicesSoapBinding" name="notificationServices">
       <wsdlsoap:address location="http://localhost:8080/jboss-net/services/notificationServices" />
       </wsdl:port>
       </wsdl:service>
       </wsdl:definitions>
      


      Using Wsdl2Java to generate a client, when I execute the code I get the following error.

      
      Sep 2, 2004 5:42:54 PM org.apache.axis.client.Call invoke
      SEVERE: Exception:
      org.xml.sax.SAXException: No deserializer for {http://www.creeksystems.com/webServices}RemoteNotificationListener
       at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:485)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:323)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
       at org.apache.axis.client.Call.invoke(Call.java:2272)
       at org.apache.axis.client.Call.invoke(Call.java:2171)
       at org.apache.axis.client.Call.invoke(Call.java:1691)
       at localhost.jboss_net.services.notificationServices.NotificationServicesSoapBindingStub.getNotificationListeners(NotificationServicesSoapBindingStub.java:96)
       at com.creeksystems.services.ServiceAdaptor.initGroupSubscriptions(ServiceAdaptor.java:36)
       at com.creeksystems.ui.Client.doIt(Client.java:84)
       at com.creeksystems.ui.Client.main(Client.java:49)
      AxisFault
       faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
       faultSubcode:
       faultString: org.xml.sax.SAXException: No deserializer for {http://www.creeksystems.com/webServices}RemoteNotificationListener
       faultActor:
       faultNode:
       faultDetail:
       {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: No deserializer for {http://www.creeksystems.com/webServices}RemoteNotificationListener
       at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:485)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
       at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
       at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:323)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
       at org.apache.axis.client.Call.invoke(Call.java:2272)
       at org.apache.axis.client.Call.invoke(Call.java:2171)
       at org.apache.axis.client.Call.invoke(Call.java:1691)
       at localhost.jboss_net.services.notificationServices.NotificationServicesSoapBindingStub.getNotificationListeners(NotificationServicesSoapBindingStub.java:96)
       at com.creeksystems.services.ServiceAdaptor.initGroupSubscriptions(ServiceAdaptor.java:36)
       at com.creeksystems.ui.Client.doIt(Client.java:84)
       at com.creeksystems.ui.Client.main(Client.java:49)
      


      Any assistance would be GREATLY appreciated.

      THANKS!!


        • 1. Re: Can not deserialize complex types
          iamapony

          Okay, I was finally able to resolve this myself. I was putting my custom java type inside of a Vector. Apparently, the nesting of the object in the Vector was the problem. As soon as I converted the Vector to a standard Collection, the WSDL2Java mapped it as an object array and it deserialized my objects correctly. Moral of the story is to return Collections as generalized types rather then a Vector.