You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "johnbarleycorn_81@libero.it" <jo...@libero.it> on 2009/01/11 03:10:08 UTC

Mantain a session between a cxf-se(bc) and an external client

Hello,

I'm using cxf 2.1.3, with servicemix 3.2.3
and I know that like in axis, in jax-ws,
there is the possibility to mantain a conversational state 
between a client and a web service setting to maintain a session.

I have published a cxf-se and cxf-bc for a service,
and there is an extarnal client invoking method on the service.
I tried this: 
(CLIENT SIDE)
TargetWSImplService ss = new TargetWSImplService(wsdlURL, SERVICE_NAME);
TargetWSImpl port = ss.getTargetWSImplPort(); 
((BindingProvider)port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,true);


(SERVER SIDE)
MessageContext mc = context.getMessageContext();
HttpSession session = ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
if (session == null) {
             logger.info("Starting the Session");
        }

but when a try:
11-gen-2009 2.45.06 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel
INFO: configuring DeliveryChannel:      org.apache.servicemix.common.EndpointDeliveryChannel@15abfe1
11-gen-2009 2.45.07 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel
INFO: configuring DeliveryChannel:      org.apache.servicemix.common.EndpointDeliveryChannel@15abfe1
java.lang.NullPointerException
        at songND.tws.TargetWSImpl.doLogin(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
        at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:110)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77)
        at org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(JBIDispatcherUtil.java:156)
        at org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:284)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
        at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
        at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
        at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
11-gen-2009 2.45.07 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel 

Could somebody gently give some suggestion, please?
Should I have to configure something in spring for the cxf-se
or cxf-bc?

If it's possible could you also give some suggestion for the other e-mail I sent?

I'd be very grateful.
Thank you in advance,
anna


Re: Mantain a session between a cxf-se(bc) and an external client

Posted by Freeman Fang <fr...@gmail.com>.
johnbarleycorn_81@libero.it wrote:
> Hello,
>
> I'm using cxf 2.1.3, with servicemix 3.2.3
> and I know that like in axis, in jax-ws,
> there is the possibility to mantain a conversational state 
> between a client and a web service setting to maintain a session.
>
> I have published a cxf-se and cxf-bc for a service,
> and there is an extarnal client invoking method on the service.
> I tried this: 
> (CLIENT SIDE)
> TargetWSImplService ss = new TargetWSImplService(wsdlURL, SERVICE_NAME);
> TargetWSImpl port = ss.getTargetWSImplPort(); 
> ((BindingProvider)port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,true);
>
>
> (SERVER SIDE)
> MessageContext mc = context.getMessageContext();
> HttpSession session = ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
> if (session == null) {
>              logger.info("Starting the Session");
>         }
>   
Where's the server side code? in cxf se impl class? or In the 
interceptor of cxf bc?
Could you provide the whole code?
Freeman
> but when a try:
> 11-gen-2009 2.45.06 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel
> INFO: configuring DeliveryChannel:      org.apache.servicemix.common.EndpointDeliveryChannel@15abfe1
> 11-gen-2009 2.45.07 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel
> INFO: configuring DeliveryChannel:      org.apache.servicemix.common.EndpointDeliveryChannel@15abfe1
> java.lang.NullPointerException
>         at songND.tws.TargetWSImpl.doLogin(Unknown Source)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
>         at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:110)
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
>         at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77)
>         at org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(JBIDispatcherUtil.java:156)
>         at org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:284)
>         at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>         at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>         at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>         at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
>         at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
>         at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>         at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:619)
> 11-gen-2009 2.45.07 org.apache.cxf.transport.jbi.JBITransportFactory setDeliveryChannel 
>
> Could somebody gently give some suggestion, please?
> Should I have to configure something in spring for the cxf-se
> or cxf-bc?
>
> If it's possible could you also give some suggestion for the other e-mail I sent?
>
> I'd be very grateful.
> Thank you in advance,
> anna
>
>
>