-
1. Re: JAXWS handler not first class citizen
fcorneli Apr 27, 2014 4:37 AM (in response to thomas.kriechbaum)In my application I use JAX-WS SOAP handlers with @EJB injections. So at least @EJB works.
-
2. Re: JAXWS handler not first class citizen
thomas.kriechbaum Apr 27, 2014 3:59 PM (in response to fcorneli)Hello Frank,
I have reduced my application to the bare minimum (1 Webservice + 1 JAXWS-handler + 1 stateless EJB and 1 CDI-managed singleton). With the following handler, neither the EJB (SecurityService) nor the CDI-managed bean (ServiceContextRepository) have been injected by the container. I have to admit that @PostConstruct works. I have packaged my classes into a single WAR and run it on Wildfily 8.1.0.CR1
I will file an issue and provide my test application.
Handler:
public class ServerSideServiceContextHandler implements Handler<SOAPMessageContext> {
@EJB
private SecurityService securityService;
@Inject
private ServiceContextRepository serviceContextRepository;
public ServerSideServiceContextHandler() {
super();
}
@PostConstruct
public void init() {
log("init");
}
@Override
public void close(MessageContext context) {
log("close");
}
@Override
public boolean handleFault(SOAPMessageContext context) {
return true;
}
@Override
public boolean handleMessage(SOAPMessageContext context) {
log("handleMessage");
return true;
}
private void log(String operation) {
System.out.println(operation);
String msg = securityService != null ? securityService.getMessage() : "<null>";
System.out.println("securityService msg " + msg);
msg = serviceContextRepository != null ? serviceContextRepository.getMessage() : "<null>";
System.out.println("serviceContextRepository msg " + msg);
}
}
Log-Output:
21:42:46,717 INFO [stdout] (default task-6) init
21:42:46,718 INFO [stdout] (default task-6) securityService msg <null>
21:42:46,718 INFO [stdout] (default task-6) serviceContextRepository msg <null>
21:42:46,730 INFO [stdout] (default task-6) handleMessage
21:42:46,731 INFO [stdout] (default task-6) securityService msg <null>
21:42:46,731 INFO [stdout] (default task-6) serviceContextRepository msg <null>
21:42:46,748 INFO [stdout] (default task-6) handleMessage
21:42:46,750 INFO [stdout] (default task-6) securityService msg <null>
21:42:46,751 INFO [stdout] (default task-6) serviceContextRepository msg <null>
21:42:46,751 INFO [stdout] (default task-6) close
21:42:46,751 INFO [stdout] (default task-6) securityService msg <null>
21:42:46,752 INFO [stdout] (default task-6) serviceContextRepository msg <null>
-
3. Re: Re: JAXWS handler not first class citizen
fcorneli Apr 28, 2014 1:48 AM (in response to thomas.kriechbaum)Hi Thomas,
In my WSDL-first application I implement SOAPHandler instead of Handler. Maybe the application server is only triggered for injection on SOAPHandler?
I declare the usage of the SOAP handler on my JAX-WS endpoint implementation as follows:
@WebService(endpointInterface = "be.e_contract.dssp.ws.jaxws.DigitalSignatureServicePortType", targetNamespace = "urn:be:e_contract:dssp:ws", serviceName = "DigitalSignatureService") @BindingType(SOAPBinding.SOAP12HTTP_BINDING) @HandlerChain(file = "/dss-ws-handlers.xml") public class DigitalSignatureServicePortImpl implements DigitalSignatureServicePortType { ... }
With dss-ws-handlers.xml containing:
<?xml version="1.0" encoding="UTF-8"?> <jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_web_services_metadata_handler_2_0.xsd"> <jws:handler-chain> <jws:handler> <jws:handler-name>WS-Security Handler</jws:handler-name> <jws:handler-class>be.e_contract.dss.ws.WSSecuritySOAPHandler</jws:handler-class> </jws:handler> </jws:handler-chain> </jws:handler-chains>
And of course you declare the web service endpoint in web.xml as follows:
<servlet> <servlet-name>DSSServlet</servlet-name> <servlet-class>be.e_contract.dss.ws.DigitalSignatureServicePortImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>DSSServlet</servlet-name> <url-pattern>/dss</url-pattern> </servlet-mapping>
-
4. Re: JAXWS handler not first class citizen
thomas.kriechbaum May 20, 2014 4:16 PM (in response to fcorneli)Hello Frank,
thanks for your reply - I had some busy days, so I had not too much time to play with Wildfly 8.
Now I have changed my ServerSideServiceContextHandler class to implement SOAPHandler<SOAPMessageContext>. But the injection (EJB and CDI-managed bean) still does not work - same logging output as described above.
Maybe I should create an issue.
Thomas
-
5. Re: JAXWS handler not first class citizen
fcorneli May 20, 2014 4:25 PM (in response to thomas.kriechbaum)mmm... classloading issue?
If your application is a WAR, what do you have under WEB-INF/lib?
If your application is an EAR, what do you have under lib?
-
6. Re: JAXWS handler not first class citizen
thomas.kriechbaum May 20, 2014 4:43 PM (in response to fcorneli)reduced my sample to a minimum; I have deployed it as WAR with no libs in WEB-INF/lib.
-
7. Re: JAXWS handler not first class citizen
fcorneli May 20, 2014 4:46 PM (in response to thomas.kriechbaum)What does your web.xml contain?
-
8. Re: JAXWS handler not first class citizen
schmidti May 20, 2014 5:33 PM (in response to thomas.kriechbaum)Hello,
wanted to post a similar question but this one seems to be related. Injection does not work in my application with JAX-RS (RESTEasy). Placing a beans.xml under WEB-INF also does not help.
Sebastian
-
9. Re: JAXWS handler not first class citizen
asoldano Mar 4, 2015 12:47 PM (in response to schmidti)For the records, see [WFLY-3657] Injection not working on JAXWS handlers specified with @HandlerChain on service endpoint interfaces - JBoss … , which is being fixed in WFLY 9.