[ 
https://issues.apache.org/jira/browse/CXF-558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dave Stanley updated CXF-558:
-----------------------------

    Attachment: bare.zip

Testcase - have the following below ..

trunk\rt\bindings\http\src\test\java\org\apache\cxf\binding\http\bare

Then debug ClientTestRails.java and stick a breakpoint in 
CustomerServiceRails.java .. (its really a server despite filename).

Send any request to the service and try and view context. Its null despite the 
fact that we are using JaxWsServerFactoryBean to create the service.

 JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
        sf.setBus(getBus());
        sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
        sf.setServiceClass(CustomerServiceRails.class);
        sf.getServiceFactory().setWrapped(false);
        sf.setAddress("http://localhost:9001/";);


> JAX-WS Context not injected for RESTful service implementations
> ---------------------------------------------------------------
>
>                 Key: CXF-558
>                 URL: https://issues.apache.org/jira/browse/CXF-558
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>         Environment: Not env specific
>            Reporter: Dave Stanley
>             Fix For: 2.1
>
>         Attachments: bare.zip
>
>
> The context is not injected for RESTful services. You can see this by 
> modifying the the JUnit testcase below: 
> <cxf>/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
> Added the @Resource annotation as shown below ..
> import javax.annotation.Resource;
> ...
> import javax.xml.ws.WebServiceContext;
> ...
> // END SNIPPET: service
> @WebService(targetNamespace = "http://cxf.apache.org/jra";)
> public class CustomerService {
>     long currentId = 1;
>     Map<Long, Customer> customers = new HashMap<Long, Customer>();
>     @Resource
>     private WebServiceContext context;
>  
>     @Post
>     @HttpResource(location = "/customers")
>     @WebMethod
>     public void addCustomer(@WebParam(name = "customer") Customer c) {
>         long id = ++currentId;
>         c.setId(id);
>         customers.put(id, c);
>         
>         // Context is null .. 
>         MessageContext mc = context.getMessageContext();
>    }      

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to