Hi Deepal et al., Following your discussion, here what I did, session management is still not working, can you help please?
1) At the client side, in the generated serviceStub.java I added the following lines to the class constructor _serviceClient.getOptions().setManageSession(true); _serviceClient.getOptions().setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); Please note that I am not engaging the module addressing. 2) in the service description file services.xml I added the following line <service name="MyService" scope="transport" class="mypackage.service.MyServiceLifeCycle"> Here too no ref to addressing module 3) at the server side in the service skeleton code and in order to handle session information I am using the following MessageContext messageContext = MessageContext .getCurrentMessageContext(); ServiceContext sc = messageContext.getServiceContext(); sc.setProperty("USERNAME", "" + username); Session management is not working as the info set in "USERNAME" is lost when the client makes 2 calls to the server. I am missing something? On Wed, May 18, 2011 at 5:16 PM, Martin Gainty <mgai...@hotmail.com> wrote: > //if Incoming Handler doesnt see a SOAP Header ...then addressing is > disabled by returning InvocationResponse.CONTINUE > org.apache.axis2.handlers.addressing.AddressingInHandler: > public InvocationResponse invoke(MessageContext msgContext) throws AxisFault > { > <snip> > // if there are not headers put a flag to disable addressing > temporary > SOAPHeader header = msgContext.getEnvelope().getHeader(); > if (header == null) { > return InvocationResponse.CONTINUE; > } > <snip> > } > > //If the outgoing Handler doesnt see a SOAPHeader then a SOAPHeader is > created from the envelope: > org.apache.axis2.handlers.addressing.AddressingOutHandler: > { > private class WSAHeaderWriter > { > public WSAHeaderWriter(MessageContext mc, boolean isSubmissionNamespace, > boolean addMU, > boolean replace, boolean includeOptional, > String role) { > <snip> > header = envelope.getHeader(); > // if there is no soap header in the envelope being processed, > add one. > if (header == null) { > header = factory.createSOAPHeader(envelope); > }else{ > </snip> > } > } > > (Stadelman is correct) > Martin > ______________________________________________ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > dient lediglich dem Austausch von Informationen und entfaltet keine > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie > de ceci est interdite. Ce message sert à l'information seulement et n'aura > pas n'importe quel effet légalement obligatoire. Étant donné que les email > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > aucune responsabilité pour le contenu fourni. > > > > >> Subject: AW: Stub generated using Axis2 is unable to Maintain session >> between RESTful service and Client >> Date: Wed, 18 May 2011 16:45:30 +0200 >> From: josef.stadelm...@axa-winterthur.ch >> To: java-user@axis.apache.org >> >> Depal, >> But then it does not need WS-Addressing to be engaged! Correct or Not? >> WS-Addressing adds into SOAP-Headers! >> Or what is the reason to engage WS-Addressing with REST if REST does not >> have any SOAP-Headers? >> Josef >> >> -----Ursprüngliche Nachricht----- >> Von: Deepal jayasinghe [mailto:deep...@gmail.com] >> Gesendet: Mittwoch, 18. Mai 2011 15:39 >> An: java-user@axis.apache.org >> Betreff: Re: Stub generated using Axis2 is unable to Maintain session >> between RESTful service and Client >> >> Hi, >> What type of session you are using ? are you using SOAPSession? >> >> If you are using SOAPSession, then it does not work with REST. In the >> case of REST it does not send any addressing headers, so SOAPSession >> does not work. However, if you use transport session this should work. >> >> Deepal >> > Hi, >> > >> > I created a webservice and enabled session management on both server >> > and client. It works FINE until I enable REST on the client by adding >> > the 3rd line of code in the serviceStub.java. >> > The session management stops working. >> > >> > // add session management >> > _serviceClient.getOptions().setManageSession(true); >> > _serviceClient.engageModule("addressing"); >> > >> > // enable REST >> > >> > _serviceClient.getOptions().setProperty(Constants.Configuration.ENABLE_REST, >> > Constants.VALUE_TRUE); >> > >> > Again if a comment the last line of code, session management is >> > re-enabled. >> > >> > Is that a bug or am I missing something? >> > >> > I am using: >> > >> > * Axis2 1.5.4 >> > * Tomcat 7.0.8 >> > >> > Thanks for your help! >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org >> > For additional commands, e-mail: java-user-h...@axis.apache.org >> > >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org >> For additional commands, e-mail: java-user-h...@axis.apache.org >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org >> For additional commands, e-mail: java-user-h...@axis.apache.org >> > -- Wadienil. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org