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 Oli Glimmer <og...@gmail.com> on 2005/04/27 13:42:26 UTC
Bean as a ReturnType
Hi,
I call a WebService with the following code:
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL("http://www.fastmail.fm/SOAP/"));
call.setOperationName(new
QName("http://www.fastmail.fm/SOAP/MessagingEngine",
"CreateSession"));
call.addParameter("UserName", XMLType.XSD_STRING, ParameterMode.IN);
QName qCreateSessionResponse = new
QName("http://www.fastmail.fm/SOAP/MessagingEngine",
"CreateSessionResponse");
SerializerFactory sf = new
BeanSerializerFactory(CreateSessionResponse.class,
qCreateSessionResponse);
DeserializerFactory dsf = new
BeanDeserializerFactory(CreateSessionResponse.class,
qCreateSessionResponse);
call.registerTypeMapping(CreateSessionResponse.class,
qCreateSessionResponse, sf, dsf);
call.setReturnType(qCreateSessionResponse);
CreateSessionResponse obj =(CreateSessionResponse) call.invoke(new
Object[] { "foo@fastmail.fm" });
I get a correct response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope [snipped]>
<SOAP-ENV:Body >
<namesp3:CreateSessionResponse
xmlns:namesp3="http://www.fastmail.fm/SOAP/MessagingEngine">
<SessionStr
xsi:type="xsd:string">f3961195ac47757811ea/f5a8ccd2/fd8b41ac</SessionStr>
<OneTime xsi:type="xsd:string">5e3eac8f918ad97f</OneTime>
<Success xsi:type="xsd:int">1</Success>
</namesp3:CreateSessionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
but never the less, I get an exception.
org.xml.sax.SAXException: Bad types (class java.lang.String -> class
de.test.CreateSessionResponse)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:279)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2437)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at FastServiceMain.main(FastServiceMain.java:43)
What I'm doing wrong?
Cheers,
Oli