axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Thorpe" <timothy.tho...@criticalpath.net>
Subject RE: Converting RPC/Enc web service to RPC/Lit - SimpleDeserializer exception
Date Fri, 15 Apr 2005 13:54:02 GMT
Could the problem here be that the parameter to the client method invoked is
of type 'java.util.HashMap' & so I have to inform the web service to use an
appropriate deserializer for the resultant '<hUserDtls>' node in the SOAP
Body (otherwise it will just use a default, & inappropriate in this case,
SimpleDeserializer) ?

 

If so, I how do I inform the web service which deserializer to use for a
given method parameter ?

 

Fuller extract of client 'SoapBindingStub' generated by WSDLToJava:

 

    public TSMAdapter_RPC_Lit.TSMAdapterResponse addUser(java.util.HashMap
hUserDtls) throws java.rmi.RemoteException,
TSMAdapter_RPC_Lit.TSMAdapterFault {

        if (super.cachedEndpoint == null) {

            throw new org.apache.axis.NoEndPointException();

        }

        org.apache.axis.client.Call _call = createCall();

        _call.setOperation(_operations[0]);

        _call.setUseSOAPAction(true);

        _call.setSOAPActionURI("");

        _call.setEncodingStyle(null);

        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);

        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);

 
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);

        _call.setOperationName(new
javax.xml.namespace.QName("urn:TSMAdapter_RPC_Lit", "addUser"));

 

        setRequestHeaders(_call);

        setAttachments(_call);

        java.lang.Object _resp = _call.invoke(new java.lang.Object[]
{hUserDtls});

 

        if (_resp instanceof java.rmi.RemoteException) {

            throw (java.rmi.RemoteException)_resp;

        }

        else {

            extractAttachments(_call);

            try {

                return (TSMAdapter_RPC_Lit.TSMAdapterResponse) _resp;

            } catch (java.lang.Exception _exception) {

                return (TSMAdapter_RPC_Lit.TSMAdapterResponse)
org.apache.axis.utils.JavaUtils.convert(_resp,
TSMAdapter_RPC_Lit.TSMAdapterResponse.class);

            }

        }

    }

 

Tim  

 

-----Original Message-----
From: Timothy Thorpe [mailto:timothy.thorpe@criticalpath.net] 
Sent: 15 April 2005 14:36
To: axis-user@ws.apache.org
Subject: Converting RPC/Enc web service to RPC/Lit - SimpleDeserializer
exception

 

Hello all

 

My web service is running AXIS 1.1.

 

To improve performance of my AXIS web service I have converted it, and its
client, from RPC/Encoded to RPC/Literal, in an effort to reduce message size
by dropping the 'over-the-top' multiRefs & types.

 

Now my client (which was working with the web service fine when using
RPC/Encoded) gets the following exception back from the web service:

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

Axis Fault code:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException 

Axis Fault string: org.xml.sax.SAXException: SimpleDeserializer encountered
a child element, which is NOT expected, in something it was trying to
deserialize. 

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

 

I will summarise below what I have done to convert service & client from
RPC/Encoded to RPC/Literal - perhaps someone can tell me the glaringly
obvious step I have failed to do ?

 

Many Thanks,

Tim 

 

Step 1: I re-deployed the web service to use 'RPC/Lit' by specifying the
'user' attribute to the <service> node in my WSDD file, thus:

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

<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" 

    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 

  <service name="TSMAdapter_RPC_Lit" style="RPC" use="literal">

    <parameter name="className" value="net.cp.adapter.TSMAdapter"/>

    <parameter name="allowedMethods" value="addUser, modifyUser, deleteUser,
renameUser"/>

    <parameter name="allowedRoles" value="memum"/>

    <parameter name="wsdlServicePort" value="TSMAdapter_RPC_Lit"/>

 

    <operation name="addUser">

       <parameter name="hUserDtls"/>

    </operation>

 

    <operation name="modifyUser">

       <parameter name="hUserDtls"/>

    </operation>

 

    <operation name="deleteUser">

       <parameter name="hUserDtls"/>

    </operation>

 

    <operation name="renameUser">

       <parameter name="hUserToRenameDtls"/>

       <parameter name="hUserNewDtls"/>

    </operation>

 

    <beanMapping qname="responseNS:TSMAdapterFault"
xmlns:responseNS="urn:TSMAdapter"

               languageSpecificType="java:net.cp.adapter.TSMAdapterFault"/>

    <beanMapping qname="responseNS:TSMAdapterResponse"
xmlns:responseNS="urn:TSMAdapter"

 
languageSpecificType="java:net.cp.adapter.TSMAdapterResponse"/>

 

      <typeMapping

        xmlns:ns="http://content.services.hrs.harris.com/"

        qname="ns:ProgramContent"

        type="java:com.harris.hrs.services.content.ProgramContent"

        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"

        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

        encodingStyle=""

      />

 

    <requestFlow name="checks">

      <handler
type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>

      <handler
type="java:org.apache.axis.handlers.SimpleAuthorizationHandler"/>

    </requestFlow>

  </service>

 

</deployment> 

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

 

Step 2: I used JavaToWSDL with the "-y RPC -u LITERAL" parameters to create
a new 'RPC/Lit' WSDL for the service.

Step 3: I used WSDLToJava to build client stubs from this 'RPC/Lit' WSDL
file.

 

I can now see the following reassuring settings in my new client
'SoapBindStub':

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

        org.apache.axis.client.Call _call = createCall();

        _call.setOperation(_operations[0]);

        _call.setUseSOAPAction(true);

        _call.setSOAPActionURI("");

        _call.setEncodingStyle(null);

        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);

        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);

 
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);

        _call.setOperationName(new
javax.xml.namespace.QName("urn:TSMAdapter_RPC_Lit", "addUser")); 

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

 

I have used the AXIS TCP monitor to check on the client's SOAP Request and
see the following, which matches the old RPC/Enc version BUT WITHOUT the
multiRefs & types:

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

POST /TSMAdapter_RPC_Lit/services/TSMAdapter HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.1

Host: 127.0.0.1

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 1826

Authorization: Basic bWVtdW06U2NvdHQxc2g=

 

<?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>

  <addUser xmlns="urn:TSMAdapter_RPC_Lit">

   <hUserDtls xmlns="">

    <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://xml.apache.org/xml-soap">

     <key>password</key>

     <value>p</value>

    </item>

    <item>

     <key>diskquota</key>

     <value>2048</value>

    </item>

    <item>

     <key>contextID</key>

     <value>qwerty1234_1113550647291</value>

    </item>

    <item>

     <key>userID</key>

     <value>qwerty1234</value>

    </item>

    <item>

     <key>notifyrecipients</key>

     <value>

      <item>0702630331@sms.dof.se</item>

     </value>

    </item>

    <item>

     <key>masteralias</key>

     <value>timothy.thorpe@dof.se</value>

    </item>

    <item>

     <key>givenname</key>

     <value>Timothy</value>

    </item>

    <item>

     <key>status</key>

     <value>ENABLED</value>

    </item>

    <item>

     <key>clientMSISDN</key>

     <value>46702630331</value>

    </item>

    <item>

     <key>alias</key>

     <value>

      <item>tim.thorpe@dof.se</item>

      <item>t.thorpe@dof.se</item>

     </value>

    </item>

    <item>

     <key>sn</key>

     <value>Thorpe</value>

    </item>

    <item>

     <key>cos</key>

     <value>2903</value>

    </item>

    <item>

     <key>migrate</key>

     <value>false</value>

    </item>

    <item>

     <key>aliasdomain</key>

     <value>dof.se</value>

    </item>

    <item>

     <key>domain</key>

     <value>pne.dof.mobile.se</value>

    </item>

    <item>

     <key>sievestatus</key>

     <value>ENABLED</value>

    </item>

   </hUserDtls>

  </addUser>

 </soapenv:Body>

</soapenv:Envelope>

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

 

The TCP Monitor shows the following Fault being returned:

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

HTTP/1.1 500 Internal Server Error

Content-Type: text/xml;charset=utf-8

Date: Fri, 15 Apr 2005 07:37:29 GMT

Server: Apache-Coyote/1.1

Connection: close

 

<?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>

  <soapenv:Fault>

   <faultcode>soapenv:Server.userException</faultcode>

   <faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.</faultstring>

   <detail/>

  </soapenv:Fault>

 </soapenv:Body>

</soapenv:Envelope>

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

 

 

Timothy Thorpe

Consultant Software Engineer

 

 


Mime
View raw message