Version 2

    Deprecated - Mapping complex schema types

     

    When you deploy a service endpoint, JBossWS4EE generates the Apache-Axis specific web service deployment descriptor (wsdd) from the information given in

     

    • wsdl file

    • jaxrpc-mapping file

    • service endpoint interface

     

    For standard types, axis uses the appropriate serializer/deserializer automatically. JBossWS4EE generates some additional serializer/deserializers based on introspection of the type.

     

     

    For a detailed discussion on Axis serialization see the Axis User Guide

     

     

     

     

    The mapping of the J2EE specific deployment descriptors to the Axis native format is a non trivial issue. We therefore provide you with the ability to partially override the generated wsdd.

     

     

    Lets look at an example class from a forum post

       CustomerOrder
         - orderId
         - customerId
         - CustomerOrderPosition[] positions
    

    The generated wsdd correctly contains a bean serializer/deserializer for the CustomerOrder and its return element.

    Axis does not know about CustomerOrderPostition and will complain accordingly.

      <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='CustomerOrderService' style='document' use='literal' provider='Handler'>
    
          <parameter name='webservice-identifier' value='samples-complexbean.jar#CustomerOrder'></parameter>
          <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB'></parameter>
    
          <operation name='echoCustomerOrder' qname='ns1:echoCustomerOrder' returnQName='ns1:echoCustomerOrderReturn' returnType='ns1:echoCustomerOrderReturn' xmlns:ns1='http://org.jboss.webservice/complexbean'>
            <parameter name='in0' qname='ns1:in0' mode='IN' type='ns1:in0' xmlns:ns1='http://org.jboss.webservice/complexbean'></parameter>
          </operation>
    
          <typeMapping
            qname='ns1:in0' xmlns:ns1='http://org.jboss.webservice/complexbean'
            type='java:org.jboss.webservice.complexbean.CustomerOrder'
            serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
            deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
            encodingStyle=''
            ></typeMapping>
          <typeMapping
            qname='ns1:echoCustomerOrderReturn' xmlns:ns1='http://org.jboss.webservice/complexbean'
            type='java:org.jboss.webservice.complexbean.CustomerOrder'
            serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
            deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
            encodingStyle=''
            ></typeMapping>
        </service>
      </deployment>
    

    When generating the wsdd, JBossWS4EE looks for additional META-INF/ws4ee-deployment.xml descriptor and when found merges the

    operations and type mappings with the generated wsdd. For java service endpoints this descriptor should be located

    in WEB-INF/ws4ee-deployment.xml.

     

     

     

     

    In our case the ws4ee-deployment.xml would look simmilar to

      <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='ns1:CustomerOrder' xmlns:ns1='http://org.jboss.webservice/complexbean'
          type='java:org.jboss.webservice.complexbean.CustomerOrder'
          serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
          deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
          encodingStyle=''
          ></typeMapping>
    
        <typeMapping
          qname='ns1:CustomerOrderPosition' xmlns:ns1='http://org.jboss.webservice/complexbean'
          type='java:org.jboss.webservice.complexbean.CustomerOrderPosition'
          serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
          deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
          encodingStyle=''
          ></typeMapping>
    
      </deployment>
    

    Set the log level on package org.jboss.webservice to debug, to see whether JBossWS4EE can see your

    ws4ee-deployment.xml and how it merges the descriptors.

      <category name="org.jboss.webservice">
         <priority value="DEBUG"></priority>
      </category>
    

     

    Mapping XML element names

     

    The Axis BeanSerializer is agnostic of the XML type definitions in your wsdl file. It uses the java reflection mechanism to determine the name and order of bean properties.

     

    Use the org.jboss.webservice.encoding.ser.MetaDataBeanSerializer to influence the way your bean properties are mapped to XML elements in your SOAP message.

     

     

     

     

    If you have a bean that contains a property javaBean and you want it to appear as &lt;JavaBean&gt; in your SOAP message, you can have a type mapping like this in your ws4ee-deployment.xml

      <typeMapping
        qname='ns1:JavaBeanTest' xmlns:ns1='http://marshalltestservice.org/types'
        type='java:com.sun.ts.tests.jaxrpc.ee.wsi.document.literal.marshalltest.JavaBeanTest'
        serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
        deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
        encodingStyle=''>
        <typeDesc xmlType='ns1:JavaBeanTest'>
          <elementDesc fieldName="javaBean" xmlName="JavaBean" xmlType="ns1:JavaBean"></elementDesc>
        </typeDesc>
      </typeMapping>
    

     

    Mapping the element order

     

    If you have a bean that contains multiple properties and you want to specify a particular order for them  in your SOAP message, you can do this:

      <typeMapping
        qname='ns1:JavaBean' xmlns:ns1='http://marshalltestservice.org/types'
        type='java:com.sun.ts.tests.jaxrpc.ee.wsi.document.literal.marshalltest.JavaBean'
        serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
        deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
        encodingStyle=''>
        <typeDesc xmlType='ns1:JavaBean'>
          <elementOrder>
            <element name="myBigDecimal"></element>
            <element name="myDouble" ></element>
            <element name="myLong" ></element>
            <element name="myJavaBean" ></element>
            <element name="myShort" ></element>
            <element name="myInt" ></element>
            <element name="myCalendar"></element>
            <element name="myByte" ></element>
            <element name="myBoolean" ></element>
            <element name="myString" ></element>
            <element name="myBigInteger" ></element>
            <element name="myFloat" ></element>
          </elementOrder>
        </typeDesc>
      </typeMapping>
    

     

     

    Using a mapping per port

     

    If you need to define mapping on a per port basis, you can do this:

    <deployment>
    
      <documentation> TypeMapping meta data for marshalling tests document/literal. </documentation>
    
      <port name="MarshallTestPort1">
        <import>ws4ee-deployment1.xml</import>
      </port>
    
      <port name="MarshallTestPort2">
        <import>ws4ee-deployment2.xml</import>
      </port>
    
      <port name="MarshallTestPort3">
        <import>ws4ee-deployment3.xml</import>
      </port>
    
      <port name="MarshallTestPort4">
        <import>ws4ee-deployment4.xml</import>
      </port>
    
    </deployment>