Thanks for that Willem. Unfortunately I do not know enough about how CXF
works to provide any help on the resource resolver. I just thought that I
might be able to add a bean definition for the WebServiceContext
implementation to the spring beans configuration to get it working.

Is there any other way I could access the message context or
httpservletrequest from my web service implementation? 

I gave Spring 2.5 a go to see whether using the new annotations to wire the
beans together was better or not than xml. Until now it was proving to be an
excellent option. 



willem.jiang wrote:
> 
> Hi Graham,
> 
> I can show your the code how does CXF inject the WebServiceContext.
> It's  the JaxWsServerFactoryBean[1]'s injectResources method.
> Maybe you can find a way to configure the resource resolver with this
> code.
> 
> BTW, Why are you want to use Spring 2.5 ? 
> CXF can work with Spring 2.0.x  more peacefully :)
> 
> [1] 
> https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
> 
> Willem.
> 
> gweb79 wrote:
>> Hi Willem,
>>
>> Thanks, but I was hoping to not have to turn off the annotation injection
>> for spring, that would mean quite a lot of work re-configuring all my
>> beans.
>> Is there no other way? Maybe by configuring spring so that it knows about
>> WebServiceContext?
>>
>> Thanks,
>> Graham
>>
>>
>> willem.jiang wrote:
>>   
>>> Hi ,
>>>
>>> It looks like Spring 2.5 will take the charge of the dependency 
>>> injection of the WebServiceContext.
>>> CXF can do it with itself Resource Injector, but Spring can't resolve 
>>> the WebServiceContext instance.
>>>
>>> If you can turn off the Spring 2.5 annotation resource injection feature 
>>> , I think you can resolve this issue.
>>>
>>> Willem.
>>> gweb79 wrote:
>>>     
>>>> Hello,
>>>>
>>>> Setup:
>>>> Spring 2.5 (Configured using annotations)
>>>> CXF 2.0.3
>>>> Tomcat 6.0.14
>>>>
>>>>
>>>> I need to access the HTTPServletRequest from the web service impl
>>>> class.
>>>> I
>>>> have had a look at all the docs which say to add the code: 
>>>>
>>>> @Resource
>>>> private WebServiceContext context;
>>>>
>>>> which the request can be retrieved. However in my setup I get the
>>>> following
>>>> error:
>>>>
>>>> Caused by:
>>>> org.springframework.beans.factory.NoSuchBeanDefinitionException:
>>>> No unique bean of type [javax.xml.ws.WebServiceContext] is defined:
>>>> Unsatisfied dependency of type [interface
>>>> javax.xml.ws.WebServiceContext]:
>>>> expected at least 1 matching bean
>>>>    at
>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveDependency(AbstractAutowireCapableBeanFactory.java:417)
>>>>    at
>>>> org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:384)
>>>>    at
>>>> org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:463)
>>>>    at
>>>> org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:123)
>>>>    at
>>>> org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:61)
>>>>    at
>>>> org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:259)
>>>>    ... 53 more
>>>>
>>>>
>>>> Can anybody explain what the problem is? The docs make it seem very
>>>> simple.
>>>> I have setup the web.xml with
>>>> org.springframework.web.context.request.RequestContextListener.  
>>>>
>>>> If this is not possible with my setup is there any other way to access
>>>> the
>>>> request from the web service? I need to access the user information in
>>>> multiple places for each individual request?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Cannot-get-WebServiceContext-or-access-the-httpservletrequest-tp14657900p14658904.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to