...
The one thing you must ensure is that your CXFServlet is set up to listen on that path. Otherwise the CXFServlet will never receive the requests.
Accessing the MessageContext and/or HTTP Request and Response
Sometimes you'll want to access more specific message details in your service implementation. One example might be accessing the actual request or response object itself. This can be done using the WebServiceContext object.
First, declare a private field for the WebServiceContext in your service implementation, and annotate it as a resource:
Code Block | ||||
---|---|---|---|---|
| ||||
@Resource
private WebServiceContext context;
|
Then, within your implementing methods, you can access the MessageContext, HttpServletRequest, and HttpServletResponse as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
MessageContext ctx = context.getMessageContext();
HttpServletRequest request = (HttpServletRequest) ctx.get(AbstractHTTPDestination.HTTP_REQUEST);
HttpServletRequest response = (HttpServletResponse) ctx.get(AbstractHTTPDestination.HTTP_RESPONSE);
|