Anne and Mike,
 
Thanks for pointing the problem out to me.
 
The problem seems to be with something I am doing.
After I receive a request one of my handlers intercepts the request and after examining the header attaches a header to the message
                    se.getHeader().detachNode();
                    sh = se.addHeader();
                    name = se.createName(AuthenticationHandler.AUTH_TOKEN);
                    shElement = sh.addHeaderElement(name);
                    shElement.addTextNode( user.getAuthenticationToken()  );
                    /* Add the header to the response message for the client.*/
                    mc.setResponseMessage((Message)message);
This causes the SOAP message to retain the request method XML representation. When the response is generated the response retains the SOAP request and the response in the BODY.
 
I am currently detaching the body in the actual webservice implementation.
I am not sure if this is the right way to do this.
Has anyone encountered a situation where you would have to set the header and if yes how do you deal with the response in that case.. Any ideas would be appreciated.
 
Arijith
Mike Perham <[EMAIL PROTECTED]> wrote:
Your SOAP body has two child elements.  I don't know what you are trying to do but that seems like a bug.
-----Original Message-----
From: Arijith Roy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 12:43 PM
To: [EMAIL PROTECTED]
Subject: Error returning a boolean primitive type from a webservice..

Has anyone ever encounter any problems returning a boolean type from a web service request. I am using Axis on the server side and I generated the stub codes using WSDL2Java.

I also generated the test cases using the ANT script. When I run my test case I get an exception.

    [junit] - Exception:
    [junit] org.xml.sax.SAXException: Bad types (class java.lang.String -> boolean)
    [junit]  at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:387)
    [junit]  at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
    [junit]  at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
    [junit]  at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
    [junit]  at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
    [junit]  at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
    [junit]  at org.apache.axis.client.Call.invoke(Call.java:2272)
    [junit]  at org.apache.axis.client.Call.invoke(Call.java:2171)
    [junit]  at org.apache.axis.client.Call.invoke(Call.java:1691)
    [junit]  at soapapi.STSMWSoapBindingStub.isMember(STSMWSoapBindingStub.java:206)
    [junit]  at soapapi.STSMembershipInfoWebServiceServiceTestCase.test1STSMWIsMember(STSMembershipInfoWebServiceServiceTestCase.java:59)
    [junit]  at java.lang.reflect.Method.invoke(Native Method)

 

I look at the SOAP response being sent back and it seems okay to me.

      <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:Header>
       <SAE_AUTH_TOKEN soapenv:mustUnderstand="0" xmlns="">4CAEC10926CC6BC153E19A82CC8E2EEB</SAE_AUTH_TOKEN>
      </soapenv:Header>
      <soapenv:Body>
       <isMember soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://membership.webservices.sae">
          <pMbrNum xsi:type="xsd:string">97405587</pMbrNum>
       </isMember>
       <ns1:isMemberResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://membership.webservices.sae">
        <ns1:isMemberReturn xsi:type="xsd:boolean">true</ns1:isMemberReturn>
       </ns1:isMemberResponse>
      </soapenv:Body>
     </soapenv:Envelope>

I took a look at the RPCHandler class where the excpetion seems to be coming from and the code did not make too much sense to me. The place where this exception is has a //FIXME attached to it. Not sure if the code is complete or not. So I start debugging that piece in isolation and my debug statements show that the value being returned is not the return value of the function .rather it is returning the parameter to the function call. I have not started with debugging the deserializer yet but if anyone has faced this problem before please throw some light on the subject.


Thanks,
Arijith

 


 


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Reply via email to