I would have thought making the client stub thread safe would be the superior solution. If this cannot be done then I would opt for the pooling solution. Out of interest is this a general problem due a specific API that axis2 has implemented or is it an axis2 design problem? Is there another web service stack out there that can create thread safe clients? Thanks
_____ From: Martin Gainty [mailto:[email protected]] Sent: 15 December 2008 02:01 To: [email protected] Subject: RE: thread safe axis2 client stub If you have a ThreadedPool approach for client stub you can submit the code to axis-dev As the majority of implementations I've seen are single desktop and or browserclient as the majority of clients start in public static main(String args) and refactor the the service code to a 'thread-safe' client I would start by changing the command line parameters at org.apache.axis2.wsdl.WSDL2Code.java the annotations are handled at org.apache.axis2.wsdl.codegen.emitter.jaxws.AnnotationElementBuilder static Element buildWebServiceClientAnnotationElement(String name, String targetNS, String wsdlLocation,Document doc) (notice the static signature)so I would try to change this but the real heart of the client stub writer sits at org.apache.axis2.wsdl.codegen.emitter public class CEmitter extends AxisServiceBasedMultiLanguageEmitter specifically writeFile e.g. /*** Writes the Stub.** @throws Exception */ protected void writeCStub() throws Exception { // first check for the policies in this service and write them Document interfaceImplModel = createDOMDocumentForInterfaceImplementation(); CStubHeaderWriter writerHStub = new CStubHeaderWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation( ), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); writeFile(interfaceImplModel, writerHStub); CStubSourceWriter writerCStub = new CStubSourceWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation( ), codeGenConfiguration.getSourceLocation()), codeGenConfiguration.getOutputLanguage()); writeFile(interfaceImplModel, writerCStub); } //and the final writer code is in AxisServiceBasedMultiLanguageEmitter org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter /** * A resusable method for the implementation of interface and implementation writing. * @param model * @param writer * @throws java.io.IOException * @throws Exception */ protected void writeFile(Document model, FileWriter writer) throws IOException, Exception { writer.loadTemplate(); String packageName = model.getDocumentElement().getAttribute("package"); String className = model.getDocumentElement().getAttribute("name"); writer.createOutFile(packageName, className); // use the global resolver //at this point you will want to make sure the statics are now class are now objects plenty of logging will be helpful writer.parse(model, resolver); } HTH Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. _____ From: [email protected] To: [email protected] Subject: RE: thread safe axis2 client stub Date: Sun, 14 Dec 2008 21:35:05 +0000 Bump! Anyone? If Axis2 is to be performant then can someone from the Axis2 development team explain the best way to call a web service using Axis2 client stubs? We have a web application where a user interaction initiates a web service call. Are we expected to store one client stub per thread in a thread local or create a pool of client stubs? I would also like to know why a client stub is not thread safe? Thanks. _____ From: Paul French [mailto:[email protected]] Sent: 10 December 2008 12:37 To: '[email protected]' Subject: RE: thread safe axis2 client stub Can anyone comment on this? It is a major issue for us. Why is the client stub created not thread safe? If it cannot be made thread safe then how can you avoid the huge overhead of instantiating a new client stub per web service call? _____ From: Shehan Simen [mailto:[email protected]] Sent: 10 December 2008 01:24 To: [email protected] Subject: RE: thread safe axis2 client stub Yes, I am expecting an answer from someone who develop the axis2. It is very inefficient to create a stub for each call. Regards, Shehan From: Paul French [mailto:[email protected]] Sent: 2008-12-10 03:29 To: [email protected]; 'David Ojeda' Subject: RE: thread safe axis2 client stub http://markmail.org/message/iif5rdpgqahk4u5t#query:axis2%20client%20stub%20t hread%20safe+page:2+mid:eenup3ck5ib6fzqq+state:results _____ From: David Ojeda [mailto:[email protected]] Sent: 09 December 2008 16:16 To: [email protected] Subject: Re: thread safe axis2 client stub I am also interested in this matter. I would like to hear Deepal's opinion, since he was the one who said that it is not thread safe. Paul: You said: > The link below suggests some tricks you can do to make things more > efficient. What are these tricks? What link? Cheers, David On Tuesday 09 December 2008 11:50:31 Paul French wrote: > This seems strange to me that the client stub cannot be made thread safe. > > After reading the below I have changed my client service to create the > client stub on each call to one of my service methods since the client stub > is not thread safe. > > I have no idea how inefficient this is? I have noticed that every time I > create the client stub (for each and every call) I get the message: > > `[INFO] Deploying module: metadataExchange - > file:/C:/downloads/axis2/axis2-1.4.1/lib/mex-1.4.1.jar > > It suggests a lot of work is going on to simply service a single web > service call. > > The link below suggests some tricks you can do to make things more > efficient. What are these tricks? > > Thanks > Paul > > _____ > > From: Amila Suriarachchi [mailto:[email protected]] > Sent: 09 December 2008 04:26 > To: [email protected] > Subject: Re: thread safe axis2 client stub > > > I was not aware of this. If the axis2 design not permits this it is better > not to use it. > > thanks, > Amila. > > > On Mon, Dec 8, 2008 at 10:00 AM, Shehan Simen <[email protected]> wrote: > > > Also this link: > > http://markmail.org/message/iif5rdpgqahk4u5t#query:axis2%20client%20stub%20 >t hread%20safe+page:2+mid:eenup3ck5ib6fzqq+state:results > > > > > > From: Amila Suriarachchi [mailto:[email protected]] > Sent: 2008-12-08 15:26 > > > To: [email protected] > Subject: Re: thread safe axis2 client stub > > > > > > I have tested with Axis2 1.4 and it worked fine. can you please send the > mail thread you mentioned? > > thanks, > Amila. > > On Mon, Dec 8, 2008 at 9:48 AM, Shehan Simen <[email protected]> wrote: > > Hi Amila, > > Thank you for your response. But I found in some discussion, it is saying > that the client stub is not thread safe. Is this problem fixed now? In > which version I can find it then? > > > > Regards, > > Shehan > > > > From: Amila Suriarachchi [mailto:[email protected]] > Sent: 2008-12-08 15:13 > To: [email protected] > Subject: Re: thread safe axis2 client stub > > > > yes > > thanks, > Amila. > > On Mon, Dec 8, 2008 at 9:31 AM, Shehan Simen <[email protected]> wrote: > > Hi, > > I am going to invoke a web service via a client stub generated by axis2. > > I want to have a single instance of the stub across my application. > > So when I initiate the stub (when I call the constructor), I don't like to > call it again throughout my application. > > Is it thread safe? > > > > Regards, > > Shehan > > > > > -- > Amila Suriarachchi > WSO2 Inc. > blog: http://amilachinthaka.blogspot.com/ > > > > > -- > Amila Suriarachchi > WSO2 Inc. > blog: http://amilachinthaka.blogspot.com/ -- David Ojeda __________ NOD32 3677 (20081209) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com __________ NOD32 3680 (20081210) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com _____ Send e-mail anywhere. No map, no compass. Get your Hotmail <http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhe re_122008> R account now.
