You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by adekar <am...@acm.org> on 2008/03/17 21:37:08 UTC

Re: WebServiceContext not injected in endpoint

Hi,

Can someone please share a full cxf xml where the JaxWsServerFactoryBean is
configured with a PerRequestFactory. I want to migrate my xfire web service
to cxf because I want to use the PerRequestFactory support.

Thanks in advance.


leewill wrote:
> 
> As a matter of fact, it works for even 2.0.4. I tried it yesterday, this
> context got injected and I could get request back indirectly from it.
> Well, I used Spring bean for all my test.
> 
> 
> On 2/28/08 3:07 AM, "Davide Gesino" <wi...@libero.it> wrote:
> 
> 
> 
> Hi Dan,
> 
> I have used this CXF 2.1 snapshot.
> apache-cxf-2.1-incubator-20080228.032802-34.zip   28-Feb-2008 04:16   24M
> I have tried this code, and actually the context is not injected. maybe I
> am
> doing something wrong.
> With the SingletonFactory it happens the same. Maybe the fault is the way
> I
> create the service.
> Anyway the creation policy works fine, with the PerSessionFactory I have a
> brand new instance created for each request I get.
> 
> Here is the code:
> 
> Object implementor = new GreeterImpl();
> String address = "http://localhost:9000/SoapContext/SoapPort";
> org.apache.cxf.service.invoker.Factory factory = new
> org.apache.cxf.service.invoker.PerRequestFactory(GreeterImpl.class);
> org.apache.cxf.service.invoker.Factory factory = new
> org.apache.cxf.service.invoker.SingletonFactory(GreeterImpl.class);
> JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
> JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
> factoryBean.setAddress(address);
> factoryBean.setServiceBean(implementor);
> factoryBean.setInvoker(invoker);
> factoryBean.create();
> 
> @javax.jws.WebService(name = "Greeter", serviceName = "SOAPService",
> portName = "SoapPort", targetNamespace =
> "http://apache.org/hello_world_soap_http", wsdlLocation =
> "hello_world.wsdl", endpointInterface =
> "org.apache.hello_world_soap_http.Greeter")
> public class GreeterImpl implements Greeter {
> 
> @Resource
> private WebServiceContext context;
> 
> public java.lang.String greetMe(java.lang.String requestType) {
>                 LOG.info("Executing operation greetMe");
> 
>                 System.out.println(requestType);
> 
>                 if (context != null) {
>                         System.out.println("context properly
> injected!!!!");
>                 }
>                  else System.out.println("context properly is
> null!!!!!!");
>                 return "hello my dear";
> }
> 
> 
> --
> View this message in context:
> http://www.nabble.com/WebServiceContext-not-injected-in-endpoint-tp15708465p15732342.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/WebServiceContext-not-injected-in-endpoint-tp15708465p16102008.html
Sent from the cxf-user mailing list archive at Nabble.com.