axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Brown <gordonw.br...@yahoo.com>
Subject axis2/java service client set operation
Date Wed, 02 Mar 2011 23:51:50 GMT
Hi All, 

I am using axis2/java to build a web service client component. I have a 
question.

Is there a way to set the operation name in the web service client?

Using axis/j, I can do something like this:

        org.apache.axis.client.Service soapService = new 
org.apache.axis.client.Service();
        soapService.createCall();
        call = soapService.getCall();
        call.setTargetEndpointAddress(soapAddress);
        
        //setting operation name in the call object
        call.setOperationName(new QName(operationNamespace, operationName)); 
        
        call.setSOAPActionURI(soapAction);
        call.setPortName(new QName(portNamespaceURI,portName));  

But in axis2/java, I don't see how I can set the operation name in the service 
client. I got an exception when trying to do this:

        ServiceClient serviceClient = new ServiceClient();
        
        //The following line get an exception, try to set operation name in 
the service client
        OperationClient operationClient = serviceClient.createClient(new 
QName(operationNamespace, operationName));

        operationClient.getOptions().setAction(soapAction);
        operationClient.getOptions().setTo(new EndpointReference(soapAddress));
        operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
        
operationClient.getOptions().setTransportInProtocol(Constants.TRANSPORT_HTTP);

I understand that the server side might not need the operation name, it can 
use soapAction et cetera to figure out where to dispatch the message. But how 
about the client doesn't know the soapAction (it might not even have one), all 
it know is the operation name, in which case the server will have to rely on the 
operation name (as the last resort), right?

Your help is much appreciated.
Gordon



      
Mime
View raw message