Hi all, I did a improvement since my last question. Now the ws client (axis)
can send the request with timeouts, thanks.
Now I am facing another issue, I don't know if it is on the server or client
side, please take a look.
I know the problem is the server returning a string while the client try to
use a Escohida.class, but I don't have (yet) no clue, where the problem is. On
the client side, I don't have any xml descriptor file. There is no exception on
the server side.
The server is Sun App Server 8, with JAX-RPC. The client is Axis 1.3.
### Exception on client side.
Caused by: org.xml.sax.SAXException: Bad types (class java.lang.String -> class
claudius.Escolhida)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:286)
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:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
### request
<?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>
<ns1:good
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns1="urn:Music">
<Musica_1 xsi:type="ns1:Musica">
<numero xsi:type="xsd:int">6</numero>
</Musica_1>
</ns1:good>
</soapenv:Body>
</soapenv:Envelope>
### response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:ns0="urn:Music"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">;
<env:Body>
<ns0:goodResponse>
<result xsi:type="xsd:string">Scorpions/05 - You & I</result>
</ns0:goodResponse>
</env:Body>
</env:Envelope>
### Client class
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService( new QName(qnameService));
QName port = new QName(qnamePort);
Call call = service.createCall(port);
org.apache.axis.client.Call axisCall =
(org.apache.axis.client.Call)call;
axisCall.setOption("sendMultiRefs", new Boolean(false));
QName q1 = new QName(BODY_NAMESPACE_VALUE, "Musica");
axisCall.registerTypeMapping(Musica.class, q1,
BeanSerializerFactory.class, BeanDeserializerFactory.class);
QName q2 = new QName(BODY_NAMESPACE_VALUE, "Escolhida");
axisCall.registerTypeMapping(Escolhida.class, q2,
BeanSerializerFactory.class, BeanDeserializerFactory.class);
call.setTargetEndpointAddress(sei);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "rpc");
// call.setProperty("axis.connection.timeout", new Integer(1000));
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,
NamespaceConstants.NSURI_SOAP_ENCODING);
call.addParameter("Musica_1", q1, ParameterMode.IN);
Musica[] params = new Musica[]{ new Musica(6) };
call.setReturnType(q2, Escolhida.class);
axisCall.setReturnClass(Escolhida.class);
call.setOperationName(new QName(BODY_NAMESPACE_VALUE,"good"));
Escolhida result = (Escolhida)call.invoke(params);
--
Claudio Miranda
_______________________________________________________________
http://www.claudius.com.br/blog http://www.summa-tech.com
http://www.soujava.org.br