The docs do say that you can create Web services sessions and share them across Web services, but they are vague on how exactly you do this. I am not sure how a simple requirement to split up an API into logical parts, results in a lengthy indepth technical exploration of poorly documented Axis antics. Perhaps, I am going down the wrong path?
On Fri, 26 Feb 2010 13:48 +0100, "Vincent FINET" <[email protected]> wrote: According to my experience Web Service are stateless. On Fri, Feb 26, 2010 at 1:16 PM, jamie <[1][email protected]> wrote: Hi Everyone Thanks for your suggestions regarding multiple classes. I've decided to use multiple web services for each section of the API, however, I cannot get services within the servicegroup to share properties. In the Test web service that controls the login. Once the user has logged in successfully, I call the newSession object that sets the Config object to a property. private void newSession() throws AxisFault { if(mc!=null) { ServiceGroupContext sgc = mc.getServiceGroupContext(); if (sgc != null) { sgc.setProperty("config", config); } } } In the services.xml, I set the scope of each of the services to "transportsession": <service name="Test2" scope="transportsession"> <Description> MailArchiva search API </Description> <messageReceivers> <messageReceiver mep="[2]http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> <messageReceiver mep="[3]http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass" locked="false">com.test.Test2</parameter> </service> <service name="Test1" scope="transportsession"> <Description> Test API </Description> <messageReceivers> <messageReceiver mep="[4]http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> <messageReceiver mep="[5]http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass" locked="false">com.test.Test1</parameter> </service> In the Test2 service implementation, I have a getConfig() object which is called by each of the methods to set the internal application configuration object private Config getConfig() throws AxisFault { MessageContext mc = MessageContext.getCurrentMessageContext(); if(mc.getServiceGroupContext()!=null) { Config config = (Config)mc.getServiceGroupContext().getProperty("config"); if (config!=null) { return config; } } throw new AxisFault("not logged in"); } When the web service client calls the above, getProperty("config") always returns null. Thus, there is no sharing taking place. In the web service client, I do the following: test1Stub = new Test1Stub(url+"/MailArchiva"); test1Stub._getServiceClient().getOptions().setManageSession(true) ; Am I missing something important here? Anyone know why the session is not applied across all servicegroups? Thanks Jamie References 1. mailto:[email protected] 2. http://www.w3.org/2004/08/wsdl/in-only 3. http://www.w3.org/2004/08/wsdl/in-out 4. http://www.w3.org/2004/08/wsdl/in-only 5. http://www.w3.org/2004/08/wsdl/in-out
