Hi Matt,

Great. This is probably something similar to what I want but i have some 
following up questions on this (the link doesn't work BTW).

While instantiating the SOAPActionHandler in your client class you are passing 
it a hard coded URL name, the question is how can one achieve this for 
different requests/soapaction that is based off of the method name. I was given 
a WSDL that doesn't have the soap action in them as the URL is differs in each 
deployment environment of the web service. More than likely the action is going 
to be same as method/operation name. 

I had posted following question on the forum but didn't get a reply.

===========================
I am fairly new to the webservice/xfire world and hence bare with me if answer 
to this is pretty obvious. 

I am using xfire client to access a webservice that is deployed on intranet 
(just like our application is). Now, in the WSDL given to us, the service 
location is unspecified and so is the soap action for various operations. The 
idea being this information will vary from one deployment to the other. I 
generated java classes from the WSDL and have a wrapper client class that 
invokes the methods on the service interface. In the generated service 
interface the @Webmethod annotation has empty action value as expected. In some 
start up code of my client i populate the service location (host,port etc.) and 
invoke the service but since the soap action is empty, the server doesn't like 
it.

The question is, what is the best way to populate soap action (based on service 
location + method name) in either some start up method or at run time?

Ankur

MattJax <[EMAIL PROTECTED]> wrote: 
With major credits to: http://jira.codehaus.org/browse/XFIRE-490, have
managed to get the SOAP action set in a workaround way.

First created the handler class, which accepts the action I want then, once
I've created my service, I add the following line to get the SOAPAction in
the HTTP header:

Client.getInstance(service).addOutHandler(new
SOAPActionHandler("http://mynamespace.com/Login";));


/**
 *  HandlerClass to add the SOAPAction HTTP header
 */
public class SOAPActionHandler extends AbstractHandler {
 
 private String SOAPAction;

 public SOAPActionHandler(String SOAPAction) {
  setPhase(Phase.TRANSPORT);
  after(SoapActionInHandler.class.getName());
  this.SOAPAction = SOAPAction;
 }

 public void invoke(MessageContext context) throws Exception {
 
context.getExchange().getOutMessage().setProperty(SoapConstants.SOAP_ACTION,
SOAPAction);
 }
}


This works and is good enough.  It's not very clean though.  I could
probably inspect the MessageContext to determine the operation, and combine
that with the namespace to get my SOAPAction.  Maybe later...




-- 
View this message in context: 
http://www.nabble.com/SoapAction-tf3703322.html#a11065570
Sent from the XFire - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to