|
Right now you have two direct children of
<soapenv:body>. Axis processes the first
child (<isMember>) and ignores the second child (ns1:isMemberResponse). If
you want Axis to process both elements, you need to format the response as
a single element containing the two pieces of information. I would expect your
response to look something more like:
<soapenv:body ...>
(with appropriate namespace declarations and encodingStyle)
<ns1:isMemberResponse
xmlns:ns1="some-uri">
<ns1:pMbrNum
xsi:type="xsd:string">97405587</ns1:pMbrNum>
<ns1:isMemberReturn
xsi:type="xsd:boolean>TRUE</ns1:isMemberReturn>
</ns1:isMemberResponse>
</soapenv:body>
Note that you were missing namespace qualifications
for your SOAP header and the <isMember> element.
Anne
----- Original Message -----
Sent: Tuesday, August 05, 2003 2:03
PM
Subject: RE: Error returning a boolean
primitive type from a webservice..
I am not sure I follow you.
Are you saying that
should not be part of the <soapenv:Body> ?
Your SOAP body has two child elements. I don't know what you
are trying to do but that seems like a bug.
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
|