English 中文(简体)
JaxWSProxyFactoryBean sharing HTTP session
原标题:
  • 时间:2009-11-16 10:30:23
  •  标签:
  • cxf

We are working on one project where in we are using JaxWSProxyFactoryBean provided by CXF framework to invoke webservices. I am using SPRING configuration to create clients rather than using API directly in code. I am also setting maintain_session property to make sure session is maintained by WS clients.

<jaxws:client id="userAuthenticationServiceClient1" address="${application.deployment.url}/UserAuthentication" serviceClass="com.authentication.webservice.IUserAuthenticationService" abstract="true" > <jaxws:properties > <entry key="javax.xml.ws.session.maintain"> <value type="java.lang.Boolean">true</value> </entry> </jaxws:properties> </jaxws:client>

But I found that the session is not maintained across various webservices instances. To make it more clear If there are proxy clients like wc1, wc2, wc3. All the operations invoked on wc1 will have its session, while wc2 will create new session. Can someone let me know what settings I need to do so that all the ws clients will share session?

最佳回答

There really isn t an "automatic" way to do it. Each service proxy is designed to be completely separate from the others. However, you can "manually" copy the session cookies from one proxy to the other via:

HTTPConduit conduit1 = (HTTPConduit)ClientProxy.getClient(p1).getConduit(); HTTPConduit conduit2 = (HTTPConduit)ClientProxy.getClient(p2).getConduit(); conduit2.getCookies().putAll(conduit1.getCookies());

That should copy all the cookies from one to the other.

问题回答

暂无回答




相关问题
Obtaining HTTP session from a webservice

We have a web application built on a Tomcat 6/WebWork/Hibernate/SQL Server stack. One part of the web application is a network map built using the Flare toolkit (the predecessor to Flare was Prefuse)...

Using CXF web service from java web start

UPDATE: I have submitted my question to the CXF User s mailing list, here. UPDATE: I have currently signed all of my jars. I still can t seem to get CXF setup in a way that it can find the WSDL. My ...

How to reduce memory size of Apache CXF client stub objects?

My web service client application uses Apache CXF to generate client stubs for talking to several web services. The generated CXF web service stub objects have quite a large memory footprint (10 - 15 ...

@Path regex expression in RESTful server

I m writing a RESTful Java server with CXF framework. How do I can write a @Path Regular Expression in order to obtain any URI finished in "/action" value?

Getting access to a spring bean from a webservice?

I have created a cxf webservice within my cxf.xml file I have the following tag. bean id="videoStatsTable" class="com.company.auth.dataobjects.VideoStatsTable" From what I understand Spring should ...

JaxWSProxyFactoryBean sharing HTTP session

We are working on one project where in we are using JaxWSProxyFactoryBean provided by CXF framework to invoke webservices. I am using SPRING configuration to create clients rather than using API ...

Advantages of using a Dynamic Client with JAX-WS

What are the advantages of using a dynamic client with JAX-WS services as opposed to just using generated client classes? What are the disadvantages? **For my particular case I am using Apache CXF, I ...

热门标签