Hi all,

I read now from an other email that I can retreive a correlationID from an 
exchange.

Please, would you give me some suggestion to mantain a session between an 
external client and a cxf-bc consumer?

Could I pass an Id of the session between a cxf-bc and a cxf-se, so that I can 
use it in cxf-se and bean-se to identify the requests from the external client?

Thank you in advance.

Best Regards,

anna


---------- Initial Header -----------

>From      : "Freeman Fang" [email protected]
To          : [email protected]
Cc          :
Date      : Tue, 13 Jan 2009 10:11:13 +0800
Subject : Re: Mantain a session between a cxf-se(bc) and an external client







>
> [email protected] wrote:
> > Hello,
> > thanks again for your answers.
> > I explain a little more
> >
> > You asked:
> > Where's the server side code? in cxf se impl class?
> > Yes it is!
> >
> > The application is the same as described in the prevoius email:
> > Re: Sending Object between cxf-se published in servicemix
> >
> > The client is external to the bus, and it's automatically genereted by cxf 
> > library.
> > In the automatically generated code I inserted the code you can see as 
> > CLIENT_SIDE.
> >
> > The SERVER_SIDE is in cxf-se_1.
> > (see Re: Sending Object between cxf-se published in servicemix). This 
> > service as to send a message to a servicemix-bean.
> > But the important thing here is that cxf-se_1 has to maintain a session 
> > with the external client.
> > This is the problem that I should solve.
> >
> >
> I don't think you can maintain http session inside cxf se, since it's in
> the JBI bus.
> IMO, you can only maintain http session between cxf bc and your external
> client.
> The cxf se shouldn't see any http transport level stuff.
> Freeman
> > I put the code that you can see in the SERVER_SIDE below,
> > in a method in the cxf-se_1.
> >
> > To clarify I put here the implementation where there is only a method 
> > exposed by the service:
> >
> > @WebService(targetNamespace = "http://myproject.com/NDTWS/"; )
> >
> > public class TargetWSImpl implements TargetWS{
> > private final static Logger logger = Logger.getLogger(TargetWSImpl.class);
> >
> > @Resource
> > private WebServiceContext context;
> >
> > public boolean doLogin(String in0)throws Exception{
> >
> > boolean returnValue = false;
> > try {
> > MessageContext mc = context.getMessageContext();
> > HttpSession session = 
> > ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
> > if (session == null) {
> >     logger.info("Starting the Session");
> > }
> > String name = (String)session.getAttribute("name");
> > if (name == null) {
> >             name = in0;
> >             logger.info("Starting the Session");
> >         }
> > session.setAttribute("name", in0);
> >
> > ClientFactory factory = (ClientFactory) new 
> > InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
> > ServiceMixClient client = factory.createClient();
> > Destination destination = 
> > client.createDestination("service:http://myproject.com/components/communicationManager";);
> > InOut inOutExchange = destination.createInOutExchange();
> >
> > NormalizedMessage message = inOutExchange.getInMessage();
> >
> > String operationName= "doLogin";
> > String[] params = {in0};
> >
> > String messageStringContent =
> > "T"+ operationName + "T" + params[0];
> > logger.info("********** TARGET : " + messageStringContent);
> >
> > //IN THIS COMMENT IS SHOWN THE MESAGE THAT
> > //THE SERVICEMIX-BEAN WILL SEND
> > // TO CXF-SE_2
> > /*  + "<message xmlns='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'>"
> > + "  <part>"
> > + "    <doLogin xmlns='http://myproject.com/NDWS3/types'>"
> > + "      <arg0>" + in0 + "</arg0>"
> > + "    </doLogin>"
> > + "  </part>"
> > + "</message>";*/
> > //END OF COMMENT
> >
> > inOutExchange.getInMessage().setContent(new 
> > StringSource(messageStringContent));
> >
> > logger.info("TARGET SENDS TO ORCHESTRATORS!");
> > client.sendSync(inOutExchange, 20000);
> >
> > System.err.println(new 
> > SourceTransformer().contentToString(inOutExchange.getOutMessage()));
> > logger.info("TARGET RECEIVES FROM ORCHESTRATORS!");
> >
> > SourceTransformer sourceTransformer = new SourceTransformer();
> > String stringReturnMessage = 
> > sourceTransformer.toString(inOutExchange.getOutMessage().getContent());
> > logger.info("TARGET: " + stringReturnMessage);
> > String[] stringBoolean1 = stringReturnMessage.split("<return>");
> > String[] stringBoolean2 = stringBoolean1[1].split("</return>");
> > returnValue = Boolean.parseBoolean(stringBoolean2[0]);
> >  } catch(Exception e) {
> >     e.printStackTrace();
> >     return false;
> > }
> > return returnValue;
> >  }
> > }
> > I found how to configure a session maintained in:
> > http://weblogs.java.net/blog/ramapulavarthi/archive/2006/06/maintaining_ses.html
> > and by a kind suggestion from the cxf community
> > but I think that for servicemix there is another way of setting that 
> > because this rises the reported exception.
> >
> > Please, would you give me some suggestion?
> > I have very few time to solve this last problems.
> >
> > Thank you again for your kindness,
> > Best regards
> > anna
> >
> >
> >
> > ---------- Initial Header -----------
> >
> > >From      : "Freeman Fang" [email protected]
> > To          : [email protected]
> > Cc          :
> > Date      : Mon, 12 Jan 2009 10:05:10 +0800
> > Subject : Re: Mantain a session between a cxf-se(bc) and an external client
> >
> >
> >
> >
> >
> >
> >
> >
> >> [email protected] 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.endpointdeliverychan...@15abfe1
> >>> 11-gen-2009 2.45.07 org.apache.cxf.transport.jbi.JBITransportFactory 
> >>> setDeliveryChannel
> >>> INFO: configuring DeliveryChannel:      
> >>> org.apache.servicemix.common.endpointdeliverychan...@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
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
> >
> >
>
>

Reply via email to