Hi Tomas,
To be honest, I haven't looked too much at using the dynamic client with
ws-addressing. It should work in theory, but you need to supply xfire
with some addressing metadata. As you can see here:
http://svn.xfire.codehaus.org/viewrep/xfire/trunk/xfire/xfire-core/src/main/org/codehaus/xfire/addressing/AddressingOutHandler.java?r=1471#l57
XFire uses the AddressingOperationInfo to construct the headers. We
really lack a good way to configure this metadata - (i.e. reading it in
from the wsdl). So you're stuck adding it yourself:
Client client = ...;
Service service = client.getService() // this is your service model
OperationInfo op = service.getServiceInfo().getOperation("echo");
AddressingOperationInfo add = new AddressingOperationInfo("inaction",
"outaction", "to", op);
add.setReplyTo(...);
So that should give you at least some idea how to supply the header
information.
Regarding the 2004/3 versions of addressing - yeah, we could support
that. You would just need to write a factory like this one:
http://svn.xfire.codehaus.org/viewrep/xfire/trunk/xfire/xfire-core/src/main/org/codehaus/xfire/addressing/AddressingHeadersFactory200508.java?r=1061
You can set the factory used by doing:
client.setProperty(AddressingInHandler.ADRESSING_FACTORY,
"my.addressing.factory2004");
Hope that helps Tomas! I guess I should add all this to the manual. :-)
- Dan
Tomas Olsson wrote:
Hi again,
The exception below is probably because the service I call is not
following the WS-Addressign recommendations so it is a non issue, but
my first two questions are still relevant I think. From the log given
when suing the client I cannot se any WS-Addressing headers.
/Tomas
[EMAIL PROTECTED] wrote:
Hi,
Is it possble to get the dynamic client to add WS-Addressing headers
when
calling a service? The code I use to create the client is as follows:
Client dynamicClient = new Client(new URL(wsdlFile));
dynamicClient.addInHandler(new AddressingInHandler());
dynamicClient.addOutHandler(new AddressingOutHandler());
Object[] ret = dynamicClient.invoke(operationName, new
Object[]{argument});
By the way, what would it take to implement version 2004/03 of
WS-Addresing as well?
Another problem I have is that when I call a WSRF.NET service that
always
answer with a SOAP message with a WS-Addressing header I get the
following
exception:
org.codehaus.xfire.fault.XFireFault: Action
'http://SLAManagement.HLRS.de/configureResponse' was not found for
service
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
at
org.codehaus.xfire.addressing.AddressingInHandler.invoke(AddressingInHandler.java:88)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98)
at org.codehaus.xfire.client.Client.onReceive(Client.java:436)
at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:173)
at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:66)
at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98)
at org.codehaus.xfire.client.Client.invoke(Client.java:347)
at org.codehaus.xfire.client.Client.invoke(Client.java:377)
at
org.trustcom.slam.vo.xfire.impl.SLAManagerServiceImpl.callAction(SLAManagerServiceImpl.java:109)
at
org.trustcom.slam.vo.xfire.impl.SLAManagerServiceImpl.callConfigure(SLAManagerServiceImpl.java:83)
at
org.trustcom.slam.vo.xfire.impl.SLAManagerServiceImpl.configure(SLAManagerServiceImpl.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:52)
at
org.codehaus.xfire.service.invoker.ObjectInvoker.invoke(ObjectInvoker.java:45)
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(ServiceInvocationHandler.java:260)
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:85)
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:132)
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:107)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98)
at
org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:60)
at
org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at
org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:287)
at
org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:146)
at
org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
/Tomas
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog