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 Tevoi Andrea <te...@cad.it> on 2002/11/14 11:53:15 UTC

Handlers on client side

Hi,

here's my question:

I call a web service using axis stub classes. How could i do in order to receive the soap message bypassing deserialization?
Have i to use handlers on client side? If yes, how?

thanks in advance,

Andrea Tevoi

RE: Handlers on client side

Posted by Mattia dongili <m....@hisn.it>.
Hi,

> I call a web service using axis stub classes. How could i do 
> in order to receive the soap message bypassing deserialization?

Have you tried something like this:
<code>
package wsclients;
import web_generated.*;
import java.io.*;
import java.math.*;
import java.text.*;
import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;
import org.apache.axis.client.*;
import org.apache.axis.message.*;
import org.apache.axis.soap.*;
import org.apache.axis.*;
import org.apache.axis.encoding.*;
import javax.xml.rpc.ParameterMode;

public class TestSoapEnv {
    public static void main(String[] args) {

        try {
		
	/* I have a WebService called WSTest that converts Euro to Lire*/

            Call call = (org.apache.axis.client.Call)(new
WSTestServiceLocator()).createCall();
            String endpoint =
"http://localhost:8080/EJBTest/services/WSTestServicePort";
            String methodName = "toLire";

            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName(methodName);
            call.addParameter("euro",XMLType.XSD_DECIMAL,ParameterMode.IN);
            call.setReturnType(XMLType.XSD_DECIMAL);

            BigDecimal result = (BigDecimal)call.invoke( new Object[] { new
BigDecimal(5.0)} );

            Message m =
(Message)call.getMessageContext().getResponseMessage();

            m.writeTo(System.out);

        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
</code>

This will print to STDOUT the full response message. Anyway I don't think
this will bypass deserialization, but you could just ignore the invoke()
return value.

--
Mattia


> Have i to use handlers on client side? If yes, how?
> 
> thanks in advance,
> 
> Andrea Tevoi