Hi Sagara,

When you say "You can make operation name part of the EPR ", you mean I can do 
the following?

Say I have an service endpoint:        
http://host:port/xyz24/webservices1.5?soap=Map24Geocoder51&wsdl_version=2.0
And I have an operation:                  RetrieveAddress

I can construct a new endpoint:        
http://host:port/xyz24/webservices1.5?soap=Map24Geocoder51&wsdl_version=2.0/RetrieveAddress


I have two questions on this:

(1) Operation can have a namespace, how to pass that namespace info? I am 
asking 
this because I have a web service server that depends on the operation name and 
the operation namespace to dispatch the web services. Their WSDL does not 
define 
a soap action.

Still, my basic question is: Is there a way in AXIS2/java that we can pass the 
operation info (name/namespace) in the web service client call. 

(2) The query string is in the middle of the endpoint URL now, will this cause 
problem?

Thanks!
Frank

________________________________
From: Sagara Gunathunga <[email protected]>
To: [email protected]
Cc: Gordon Brown <[email protected]>
Sent: Wed, March 2, 2011 11:00:55 PM
Subject: Re: axis2/java service client set operation

Hi Gordonw,

Axis2 server side use several criteria to dispatch incoming messages, 
"soapAction" is one of them take a look [1]. In fact soapAction  is mandatory 
in 
SOAP 1.1 but replaced in SOAP 1.2 using a optional "action". So your client can 
send one of above input data according to underline dispatching approach.  


You can make operation name part of the EPR as follows. 

ServiceClient sender = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference("http://host/MyService/MyOperation";));
sender.setOptions(options);


[1] - http://wso2.org/library/176

Thanks ! 


On Thu, Mar 3, 2011 at 5:21 AM, Gordon Brown <[email protected]> wrote:

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
>
>


-- 
Sagara Gunathunga 

Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/



      

Reply via email to