Take a look at this example service implementation:
Here you will see the following class-level annotation:
@HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")
This is how you specify which handler chain to use on the client side. You need to ensure that the context-handlers.xml file is available inside your deployment archive at the classpath location, specified in the annotation. For a war, the file should be located under /WEB-INF/classes.
Here's an example of the context-handlers.xml file:
Actually i have examined the examples provided in the jbossts demo. The issue in my case is that i use the wsdl to java approach, where i cannot insert the
@HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")annotation in my code. Is there a way to register the service-side handler chain, inside my code, like i did in my client?
As i noticed, the SOAP handler is the class com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor, which obviously will integrate the coordination context into the soap messages. My question is how to explicitely add this handler without using the @handlerchain annotation.
Again me. I followed your instructions. I added the
@HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")annotation. But know i get the following exception
when i try to deploy the service:
21:45:12,790 ERROR [ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FlightService': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [java.util.List] for property 'handlers'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor] to required type [javax.xml.ws.handler.Handler] for property 'handlers': no matching editors or conversion strategy found
what is wrong with that. I understand what the exception means but i don't to know how to solve it.
To be honest, the error that i mentioned above appeared when i tried to add the hadler chain via the appcontext.xml file of the Spring framework. I followed the instructions from this link: http://cxf.apache.org/docs/jax-ws-configuration.html
Then i tried to do the same task, but using the annotation approach now(the one you suggested). However i get the following exception:
Caused by: java.lang.ClassCastException: class com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor at java.lang.Class.asSubclass(Class.java:3018) at org.apache.cxf.jaxws.handler.HandlerChainBuilder.buildHandlerChain(HandlerChainBuilder.java:121)
this is the root of the exception.
This is a known issue:
This is one of the issues that I was referring to when I said you would have problems if you used a version of JBoss AS 7, prior to 7.1.0.beta1b.
You should upgrade to JbossAS 7.1.0.beta1b to fix this problem and a number of other issues with XTS.