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 ae...@rbc.com on 2005/03/15 15:04:15 UTC

Custom De/Serializers and Wrapped/Literal Axis services

This is a follow on from the mail I posted with subject .NET and Axis. 

I am experiencing Serialization problems when exposing my service as Wrapped/Literal.  I don't have these problems with rpc/encoded.

Axis generates customer serialization code in the JavaBean classes which is fine, but if I don't use these Axis generated classes but use my own simple JavaBean classes containing no custom serialization code, there are namespace issues in the XML - see Soap Envelopes below and attached WSDL.  

Notice that in the example using the custom serializer the getCustomerReturn is in the <http://inquiry.webservice.gpb.rbc.com> namespace, as the WSDL specifies, and the child elements of that element are all in the <http://customer.util.gpb.rbc.com> namespace, again, as the WSDL specifies.  However in the example where the custom serializer is not used, the child elements of getCustomerReturn do not specify a namespace so will be in the namespace of their parent, <http://inquiry.webservice.gpb.rbc.com>, which is incorrect. .

<<inquiry.wsdl>> 
As I said I didn't have to use the custom serialization code for my rpc/encoded service but could just specify the org.apache.axis.encoding.ser.BeanDe/SerializerFactory as the de/serializer in the server-config.wsdd as shown below 

<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns5:BankIdentifier" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.rbc.gpb.util.BankIdentifier" xmlns:ns5="http://util.gpb.rbc.com"/>

<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns6:Code" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.rbc.gpb.util.Code" xmlns:ns6="http://util.gpb.rbc.com"/>

I would like help on how I can continue to use my existing Java classes (and there are a lot of them) without having to cut and paste the de/serializer code into each of them.

The Soap Envelope for the two scenarios are below... 
//Not using custom serializer 
<?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><getCustomerResponse xmlns="http://inquiry.webservice.gpb.rbc.com"><getCustomerReturn><isBooksKept>false</isBooksKept><officerCode xsi:nil="true"/><hasWarnings>false</hasWarnings><type xsi:nil="true"/><isRestrained>false</isRestrained><state xsi:nil="true"/><currency xsi:nil="true"/><shortName xsi:nil="true"/><postalCode xsi:nil="true"/><legalName xsi:nil="true"/><id><bank>1</bank><transit>1880</transit><key xsi:nil="true"/><number>1000017</number></id><status xsi:nil="true"/><address4 xsi:nil="true"/><dateOpened xsi:nil="true"/><address3 xsi:nil="true"/><dateOfBirth xsi:nil="true"/><address2 xsi:nil="true"/><address1 xsi:nil="true"/><messages xsi:nil="true"/><name>Test Name</name></getCustomerReturn></getCustomerResponse></soapenv:Body></soapenv:Envelope>

//using custom serializer 
<?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><getCustomerResponse xmlns="http://inquiry.webservice.gpb.rbc.com"><getCustomerReturn><ns1:shortName xsi:nil="true" xmlns:ns1="http://customer.util.gpb.rbc.com"/><ns2:currency xsi:nil="true" xmlns:ns2="http://customer.util.gpb.rbc.com"/><ns3:isRestrained xmlns:ns3="http://customer.util.gpb.rbc.com">false</ns3:isRestrained><ns4:status xmlns:ns4="http://customer.util.gpb.rbc.com">Bankrupt</ns4:status><ns5:hasWarnings xmlns:ns5="http://customer.util.gpb.rbc.com">false</ns5:hasWarnings><ns6:id xmlns:ns6="http://customer.util.gpb.rbc.com"><ns7:bank xmlns:ns7="http://util.gpb.rbc.com">1</ns7:bank><ns8:transit xmlns:ns8="http://util.gpb.rbc.com">1880</ns8:transit><ns9:key xsi:nil="true" xmlns:ns9="http://util.gpb.rbc.com"/><ns10:number xmlns:ns10="http://util.gpb.rbc.com">1000017</ns10:number></ns6:id><ns11:isBooksKept xmlns:ns11="http://customer.util.gpb.rbc.com">false</ns11:isBooksKept><ns12:officerCode xsi:nil="true" xmlns:ns12="http://customer.util.gpb.rbc.com"/><ns13:type xsi:nil="true" xmlns:ns13="http://customer.util.gpb.rbc.com"/><ns14:state xmlns:ns14="http://customer.util.gpb.rbc.com">Inactive</ns14:state><ns15:postalCode xsi:nil="true" xmlns:ns15="http://customer.util.gpb.rbc.com"/><ns16:legalName xsi:nil="true" xmlns:ns16="http://customer.util.gpb.rbc.com"/><ns17:address4 xsi:nil="true" xmlns:ns17="http://customer.util.gpb.rbc.com"/><ns18:dateOpened xmlns:ns18="http://customer.util.gpb.rbc.com">2005-03-15T13:53:33.873Z</ns18:dateOpened><ns19:address3 xsi:nil="true" xmlns:ns19="http://customer.util.gpb.rbc.com"/><ns20:dateOfBirth xmlns:ns20="http://customer.util.gpb.rbc.com">2005-03-15T13:53:33.873Z</ns20:dateOfBirth><ns21:address2 xsi:nil="true" xmlns:ns21="http://customer.util.gpb.rbc.com"/><ns22:address1 xsi:nil="true" xmlns:ns22="http://customer.util.gpb.rbc.com"/><ns23:messages xsi:nil="true" xmlns:ns23="http://customer.util.gpb.rbc.com"/><ns24:name xmlns:ns24="http://customer.util.gpb.rbc.com">Test Name</ns24:name></getCustomerReturn></getCustomerResponse></soapenv:Body></soapenv:Envelope>


------------------------------------------------------------

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

============================================================