wood burning stoves 2.0*
The moose likes Web Services and the fly likes MessageContext is null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "MessageContext is null" Watch "MessageContext is null" New topic
Author

MessageContext is null

Balaji Sundararaju
Greenhorn

Joined: Dec 17, 2008
Posts: 3
I'm trying to create a webservice using CXF and REST framework. I created a Servlet Client which runs on Weblogic server 10. And I have the Webservice Method running on another Weblogic Server 10.

I followed the JAX-RS example provided in this link, http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html. Communication between my client and the webservice is working as expected. To get to the next step I was trying to get an handle over the request and session object in my webservices server end.

After going thro couple of examples, I used the below code snippet and I'm able to get hold of the WebServiceContext.

@Resource
private WebServiceContext context;

My problem is when I'm trying to get a Message Context, it is returning me null. Please let me know what I'm missing here.

Below is my beans.xml code:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<jaxrs:server id="shoppingbagservice" address="/">
<jaxrs:serviceBeans>
<ref bean="shoppingBean" />
</jaxrs:serviceBeans>
</jaxrs:server>

<bean id="shoppingBean" class="com.limited.directmarketing.shoppingbag.appflow.ShoppingBagService" />
</beans>

Let me know if you need more information on this.

Thanks,
Balaji
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MessageContext is null