cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: restful_http_binding and WebServiceContext
Date Mon, 26 Nov 2007 01:55:10 GMT
Hi Mike,

I just checked the code , you need to specify the Service Bean object to 
be injected with the WebServiceContext.

Here is an example for you:
 private static void createRestService(Object serviceObj) {
        // Build up the server factory bean
        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
        // Use the HTTP Binding which understands the Java Rest Annotations
        // *** just set the service object as the service bean directly 
, to get the webservice context object to been injected.

        // Turn the "wrapped" style off. This means that CXF won't generate
        // wrapper XML elements and we'll have prettier XML text. This
        // means that we need to stick to one request and one response
        // parameter though.



Michael Nelson wrote:
> I am trying to figure out how to get access to WebServiceContext in the
> restful_http_binding sample that comes with CXF 2.0.3. In
>, I've added:
>     @Resource
>     private WebServiceContext wsContext;
> to the CustomerServiceImpl class.
> But wsContext isn't set when methods are invoked. I've looked through the
> archives and the only issue I've seen seems to be if you use Spring and
> transactions.
> I am new to CXF, so I may be doing something fundamentally wrong here.
> Any ideas?
> Thanks,
> -mike

View raw message