0 Replies Latest reply on Dec 8, 2004 1:00 PM by mburbidg

    Error deserializing custom java object (using jboss.net xdoc

    mburbidg

      I'm building a web service using jboss.net and it's associated xdoclet tags. I'm following the example in the article posted at www.nsdev.org/jboss/stories/jboss-net.html.

      One of my web service messages takes a simple custom java object as one of it's parameters. I've followed the example in the before mentioned article to set up my custom java class so that it is correctly serialized and deserialized.

      When I run an axis based client generated from the WSDL exported by my web service I get the following exception:

      org.xml.sax.SAXException: Deserializing parameter 'scriptParameters': could not find deserializer for type {http://sample}RunScriptParameters
      at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
      at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
      ...

      RunScriptParameters is the name of my custom java class.

      I've annotated my custom java class with exdoclet tags as follows:

      package sample;
      
      /** The RunScriptParameters Class
       * @jboss-net.xml-schema urn="sample:RunScriptParameters"
       */
      public class RunScriptParameters implements java.io.Serializable
      {
       private java.lang.String scriptText;
      
       RunScriptParameters()
       {
       }
      
       public java.lang.String getScriptText()
       {
       return scriptText;
       }
      
       public void setScriptText(java.lang.String scriptText)
       {
       this.scriptText = scriptText;
       }
      }

      My build.xml file contains the following element in the xdoclet build rule:

      <jbossnet webDeploymentName="${ejb.build.name}"
       prefix="sample"
       destdir="${jboss-config.dir}/META-INF"
       targetNameSpace="http://localhost:8080/jboss-net/services/${ejb.build.name}" />


      Note the prefix "sample" matches the prefix in the urn attribute in the xdoclet tag on the java class.

      The following web service file is generated by xdoclet:

      <?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="IdsEJB"
       xmlns="http://xml.apache.org/axis/wsdd/"
       targetNamespace="http://localhost:8080/jboss-net/services/IdsEJB"
       xmlns:sample="http://localhost:8080/jboss-net/services/IdsEJB"
       xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
      
      <!-- The following are declarations of service endpoints targetted to
       session beans -->
      
       <service name="IdsEJB" provider="Handler">
       <parameter name="handlerClass" value="org.jboss.net.axis.server.EJBProvider"/>
       <parameter name="beanJndiName" value="ejb/IdsBeanLocal"/>
       <parameter name="allowedMethods" value="about runScript "/>
       <operation name="about" returnQName="AboutString">
       </operation>
       <operation name="runScript">
       <parameter name="scriptParameters"/>
       </operation>
       <requestFlow name="IdsEJBRequest">
       </requestFlow>
       <responseFlow name="IdsEJBResponse">
       </responseFlow>
       </service>
      
       <service name="JmxBrowse" provider="Handler">
       <parameter name="handlerClass" value="org.jboss.net.axis.server.EJBProvider"/>
       <parameter name="beanJndiName" value="ejb/JmxBrowseBeanLocal"/>
       <parameter name="allowedMethods" value="queryNames about "/>
       <operation name="queryNames" returnQName="Queries">
       <parameter name="name"/>
       </operation>
       <operation name="about" returnQName="AboutString">
       </operation>
       <requestFlow name="JmxBrowseRequest">
       </requestFlow>
       <responseFlow name="JmxBrowseResponse">
       </responseFlow>
       </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="sample:RunScriptParameters"
       type="java:sample.RunScriptParameters"
       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>


      The wsdl file that is returned from my service and from which I generated the axis based client is:

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="http://10.51.241.60:8080/jboss-net/services/IdsEJB" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://10.51.241.60:8080/jboss-net/services/IdsEJB" xmlns:intf="http://10.51.241.60:8080/jboss-net/services/IdsEJB" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://net.jboss.org/jmx" xmlns:tns2="http://localhost:8080/jboss-net/services/IdsEJB" 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/"/><complexType name="AttributeType"><attribute name="name" type="xsd:string"/><complexContent><sequence><element name="value" nillable="true" type="xsd:anyType"/></sequence></complexContent></complexType><complexType name="ObjectNameType"><simpleContent><extension base="string"/></simpleContent></complexType></schema><schema targetNamespace="http://localhost:8080/jboss-net/services/IdsEJB" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="RunScriptParameters"><sequence><element name="scriptText" nillable="true" type="xsd:string"/></sequence></complexType></schema></wsdl:types>
       <wsdl:message name="aboutResponse">
       <wsdl:part name="AboutString" type="xsd:string"/>
       </wsdl:message>
       <wsdl:message name="runScriptResponse">
       </wsdl:message>
       <wsdl:message name="aboutRequest">
       </wsdl:message>
       <wsdl:message name="runScriptRequest">
       <wsdl:part name="scriptParameters" type="tns2:RunScriptParameters"/>
       </wsdl:message>
       <wsdl:portType name="IdsBeanLocal">
       <wsdl:operation name="about">
       <wsdl:input message="impl:aboutRequest" name="aboutRequest"/>
       <wsdl:output message="impl:aboutResponse" name="aboutResponse"/>
       </wsdl:operation>
       <wsdl:operation name="runScript" parameterOrder="scriptParameters">
       <wsdl:input message="impl:runScriptRequest" name="runScriptRequest"/>
       <wsdl:output message="impl:runScriptResponse" name="runScriptResponse"/>
       </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="IdsEJBSoapBinding" type="impl:IdsBeanLocal">
       <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="about">
       <wsdlsoap:operation soapAction="IdsEJB"/>
       <wsdl:input name="aboutRequest">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.51.241.60:8080/jboss-net/services/IdsEJB" use="encoded"/>
       </wsdl:input>
       <wsdl:output name="aboutResponse">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.51.241.60:8080/jboss-net/services/IdsEJB" use="encoded"/>
       </wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="runScript">
       <wsdlsoap:operation soapAction="IdsEJB"/>
       <wsdl:input name="runScriptRequest">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.51.241.60:8080/jboss-net/services/IdsEJB" use="encoded"/>
       </wsdl:input>
       <wsdl:output name="runScriptResponse">
       <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.51.241.60:8080/jboss-net/services/IdsEJB" use="encoded"/>
       </wsdl:output>
       </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="IdsBeanLocalService">
       <wsdl:port binding="impl:IdsEJBSoapBinding" name="IdsEJB">
       <wsdlsoap:address location="http://10.51.241.60:8080/jboss-net/services/IdsEJB"/>
       </wsdl:port>
       </wsdl:service>
      </wsdl:definitions>


      I know this is a bunch of code, but I'm at my wits end trying to figure out which little piece I've missed or is not quite right. I'd appreciate any tips or pointers as to what could be wrong.

      Thanks!
      Mike-