Paul, Yes I did so. Why. because I checked the sopa headers returned and I checked the sopa headers transmitted by the client with each consecutuive call. And all works fine for client#1 unless clinet#2 comes into the game.
++++ my Client /* * Copyright 2004,2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package userguide.clients; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.deployment.FileSystemConfigurator; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.*; import org.apache.axis2.rpc.client.*; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.FileNotFoundException; /** * This is a Client progam that accesses 'MyService' web service in Axis2 samples */ public class SOAPClient { private static final Log log = LogFactory.getLog(SOAPClient.class); // private static String toEpr = "http://localhost:8080/axis2/rest/MyService4"; private static String toEpr = "http://localhost:8080/axis2/services/MyService5"; private static int i = 0; private static Integer intObj = new Integer(i); public static void main(String[] args) throws AxisFault { try { Options options = new Options(); options.setManageSession(true); options.setTo(new EndpointReference(toEpr)); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); //options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); String home = System.getProperty("user.home"); // create this folder at your home. This folder could be anything //then create the "modules" folder //copy the LoggingModule.mar to "modules" folder. //copy the axis2.xml to the client-repository //then modify the axis2.xml that is generating there according to //phases that being included in the "module.xml" File repository = new File(home + File.separator + "client-repository"); if (!repository.exists()) { throw new FileNotFoundException(repository.getAbsolutePath() + " does not Exist"); }; String str_axis2xml = repository.getAbsolutePath() + File.separator + "axis2.xml"; File axis2_xml = new File(str_axis2xml); if (!axis2_xml.exists()) { throw new FileNotFoundException(axis2_xml.getAbsolutePath() + " does not Exist"); }; FileSystemConfigurator fsc = new FileSystemConfigurator( repository.getAbsolutePath(), axis2_xml.getAbsolutePath()); AxisConfiguration er = fsc.getAxisConfig(); ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( repository.getAbsolutePath(), axis2_xml.getAbsolutePath() ); //ServiceClient sender = new ServiceClient(); ServiceClient sender = new ServiceClient(configContext,null); //sender.engageModule(new QName(Constants.MODULE_LOGGING)); sender.engageModule(new QName("logging")); //sender.engageModule(new QName(Constants.MODULE_ADDRESSING)); sender.engageModule(new QName("addressing-1.1")); //sender.engageModule(new QName(Constants.MODULE_SOAPMONITOR)); sender.engageModule(new QName("soapmonitor-1.1")); // invoke the start method first using it's StartPaylod options.setAction("urn:start"); sender.setOptions(options); OMElement start = sender.sendReceive(getStartPayload()); // from now on use this sender so that WS-address stuff i.e. ServiceGroupeContextID info is sent String s = intObj.toString(i); System.out.print("No"+s); XMLStreamWriter startWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out); start.serialize(startWriter); startWriter.flush(); // write every-thing out System.out.println(""); // and add a CRLF options.setAction("urn:echo"); sender.setOptions(options); for(int i=0;i<500;i++){ OMElement result = sender.sendReceive(getPayload()); s = intObj.toString(i); System.out.print("No"+s); XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out); result.serialize(writer); writer.flush(); // write every-thing out System.out.println(""); // and add a CRLF if (i==100){ System.gc(); // do an explicit Garbage Collection and get it all back } if (0 == i % 100){ System.gc(); // do an explicit Garbage Collection once evry 100 loops-through } } // end-for - so do a cleanup now to give up sender resource sender.cleanup(); // return resources .finalize would do more but is protected } catch (FileNotFoundException e) { e.printStackTrace(); } catch (XMLStreamException e) { e.printStackTrace(); } catch (FactoryConfigurationError e) { e.printStackTrace(); } catch (java.lang.Exception e) { e.printStackTrace(); } } private static OMElement getStartPayload() { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://example14.org/example4", "example4"); OMElement method = fac.createOMElement("start", omNs); OMElement value = fac.createOMElement("Text", omNs); value.addChild(fac.createOMText(value, "Axis2 'SOAPSession' start")); method.addChild(value); return method; } private static OMElement getPayload() { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://example4.org/example4", "example4"); OMElement method = fac.createOMElement("echo", omNs); OMElement value = fac.createOMElement("Text", omNs); value.addChild(fac.createOMText(value, "Axis2 'SOAPClient' Echo-String ")); method.addChild(value); return method; } } -----Ursprüngliche Nachricht----- Von: Paul Fremantle [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Januar 2007 07:35 An: [email protected] Betreff: Re: Session Connection pooling in Axis2 WS Josef have you set your client options to setManageSession(true); ? Paul On 1/29/07, Stadelmann Josef <[EMAIL PROTECTED]> wrote: > Hi Paul, > > thank you, but what are the various threading models one needs to care > about, among selecting one of the scope's below. > > i.e. I have a missbehaving scope=sopasession. I have reported several > times that in scope=soapsession client#2 overrides the ServiceGroupContextID > which was given to client#1 on it's first request. This overriede makes the > already running, not-timed-out client#1 fail with > "unknownServiceGroupContextID" > > I assumed that it has to do with threadsafety. So what threading model shall I > use in scope=soapsession to avoid the override of the ServiceGroupContextID? > And how do I manage that in my clinet and/or server code or one of the many > configuration xml files to achive that? > > Josef > > -----Ursprüngliche Nachricht----- > Von: Paul Fremantle [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 26. Januar 2007 13:55 > An: [email protected] > Betreff: Re: Session Connection pooling in Axis2 WS > > > Session scope is simply the lifecycle of the objects and state that > Axis2 manages. > > So if you define request, then each new request will instantiate a new > service object. > If you define transportsession, then Axis2 will use HTTP cookies. Each > client will re-use the same service object. > If you define soapsession, it will do the same thing, except using > SOAP headers instead of cookies. > If you define application, then you will have a single service object > for all requests. > > It is up to you to make sure that youre object can support the right > threading model for application. For request you need not worry about > thread safety because each request has its own service object. > > Paul > > On 1/26/07, Stadelmann Josef <[EMAIL PROTECTED]> wrote: > > Sanjiva > > > > What is session scope? > > > > you have to define one of > > scope=request > > scope=transportsession > > scope=soapsession > > scope=application > > > > which one do you mean? > > Josef > > > > -----Ursprüngliche Nachricht----- > > Von: Sanjiva Weerawarana [mailto:[EMAIL PROTECTED] > > Gesendet: Donnerstag, 25. Januar 2007 06:29 > > An: [email protected] > > Betreff: RE: Session Connection pooling in Axis2 WS > > > > > > It depends on the "scope" of the service .. if its deployed in > > application scope then only one instance is created. If its in session > > scope then its one instance per session and so on. > > > > See: http://wso2.org/library/231 > > > > Sanjiva. > > > > On Wed, 2007-01-24 at 11:45 -0500, Ho, Wen Yue wrote: > > > Hi, > > > > > > I think my question is not clear and confusing. > > > Sorry, a newbie here :-) > > > > > > Please allow me to re-phrase my question. > > > How does Axis2 handle multiple request to the webservices? > > > AFAIK, Axis2 is a servlet and by default, a (single) servlet should be > > > able to handle multiple HTTP requests. > > > For each incoming request session, will axis (servlet) instantiate > > > just one instance of the websrvice class for multiple requests? > > > Or it will instantiate one webservice object for each request? > > > > > > Your assistance will be highly appreciated. > > > Thank you. > > > > > > > > > > > > > > > ______________________________________________________________________ > > > From: Ho, Wen Yue [mailto:[EMAIL PROTECTED] > > > Sent: January 23, 2007 2:26 PM > > > To: [email protected] > > > Subject: Session Connection pooling in Axis2 WS > > > > > > > > > > > > Hi, > > > > > > I have a legacy system that provides an API to access the system thru > > > their own Session object. > > > I need to pool this session objects within my web services developed > > > using Axis2. > > > > > > Correct me if I'm wrong. > > > AFAIK, Axis2 by default will make one thread per request to the web > > > service. > > > I think this means singleton class won't work, since one thread will > > > instantiate one singleton. > > > Any advice on how to do this? > > > > > > Thanks in advance. > > > > > > > > > ******************** > > > NOTICE OF CONFIDENTIALITY > > > This communication including any information transmitted with it is > > > intended only for the use of the addressees and is confidential. > > > If you are not an intended recipient or responsible for delivering > > > the message to an intended recipient, any review, disclosure, > > > conversion to hard copy, dissemination, reproduction or other use > > > of any part of this communication is strictly prohibited, as is the > > > taking or omitting of any action in reliance upon this communication. > > > If you receive this communication in error or without authorization > > > please notify us immediately by return e-mail or otherwise and > > > permanently delete the entire communication from any computer, > > > disk drive, or other storage medium. > > > > > > If the above disclaimer is not properly readable, it can be found at > > > www.td.com/legal > > > > > > AVERTISSEMENT DE CONFIDENTIALITE > > > Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement > > > aux destinataires susmentionnés, est confidentiel. Si vous > > > n'êtes pas le destinataire prévu ou un agent responsable de la > > > livraison de ce courriel, tout examen, divulgation, copie, impression, > > > reproduction, distribution, ou autre utilisation d'une partie de ce > > > courriel est strictement interdit de même que toute intervention ou > > > abstraction à cet égard. Si vous avez reçu ce message par erreur ou > > > sans autorisation, veuillez en aviser immédiatement l'expéditeur par > > > retour de courriel ou par un autre moyen et supprimer immédiatement > > > cette communication entière de tout système électronique. > > > > > > Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous > > > pouvez le consulter à www.td.com/francais/legale > > -- > > Sanjiva Weerawarana, Ph.D. > > Founder & Director; Lanka Software Foundation; http://www.opensource.lk/ > > Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/ > > Director; Open Source Initiative; http://www.opensource.org/ > > Member; Apache Software Foundation; http://www.apache.org/ > > Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/ > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Paul Fremantle > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair > > http://bloglines.com/blog/paulfremantle > [EMAIL PROTECTED] > > "Oxygenating the Web Service Platform", www.wso2.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Paul Fremantle VP/Technology, WSO2 and OASIS WS-RX TC Co-chair http://bloglines.com/blog/paulfremantle [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
