AXIS and Java - concurrent transactions overwriting each other

From: Dave Ficken (dficken_at_netmediasolutionsinc.com)
Date: 11/08/03


Date: 8 Nov 2003 06:19:41 -0800

We have written a Java web service that runs under Apache Tomcat and
AXIS (SOAP/XML). The problem is that simultaneous concurrent
transactions appear to occasionally overwrite each other, and we can't
figure out why. We've really hit a brick wall! Has anybody come across
this problem and can you offer any suggestion which may help?

A few things:
a. we are just using the default "scope" setting in the AXIS config.
when we try explicitly setting the scope parameter to "request" it
still doesn't seem to make any difference.
b. the problem occurs only occasionally - we don't seem to be able to
reproduce it when we try to.
c. initially the source code included a static class and String
variable, so we removed it thinking this was the problem, but the
problem still happens! There should currently be no instances of
static in our code.
d. we're pretty sure we restarted apache tomcat and redeployed our web
services properly each time. we're sure our code changes were in
effect but we didn't do a reboot - should this be necessary?

I have attached source code below that shows an example of the class
being invoked through AXIS. The method that is invoked by web services
is "doTransaction" which accepts String XML. The problem seems to
occur when private String class member variables of "FooTransaction"
are overwritten by another simultaneous request. FooTransaction also
contains a private vector class member and String data associated with
its elements appear to get overwritten as well.

Any help at all appreciated...
Dave

-----------------
package myPackage;

import java.util.Vector;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import java.io.*;
import java.util.*;

public final class FooEngine implements ContentHandler{
        
        private String XMLFile;

        private FooTransactionRequest eReq = new FooTransactionRequest();

        private Vector FooTransactions = new Vector();

        private FooTransaction eTrans = new FooTransaction();

        private CharArrayWriter contents = new CharArrayWriter();

        public FooEngine() { }

        public String doTransaction(String XMLInput) {

                eReq = new FooTransactionRequest();

                /* Create the response object that will store the response to the
client **/

                FooTransactionResponse response = new FooTransactionResponse();
                try {
                        /* transaction processing here */
                        /* ....*/
                } catch (Exception e) {
                        /* Return error response. **/
                        /* ....*/
                }

                /* Return XML response. */
                String XMLResponse = createXMLResponse(response);
                return XMLResponse;
                
        }

        // the remaining callback handlers

        public void setDocumentLocator(Locator locator) {}
        public void startDocument() {}
        public void endDocument() {}
        public void startPrefixMapping(String prefix, String uri) {}
        public void endPrefixMapping(String prefix) {}
        public void ignorableWhitespace(char[] text, int start, int length)
throws SAXException {}
        public void processingInstruction(String target, String data){}
        public void skippedEntity(String name) {}
}



Relevant Pages

  • simplest webservice client ever
    ... i have created a simple web service using tomcat and axis 1.4 ... it just has one method that returns the string hello world ...
    (comp.lang.java.programmer)
  • Re: SOAP project
    ... | The interop problems I've seen are between .NET and AXIS, ... | There's another Web Service written in perl. ... there is no WSDL for that. ...
    (microsoft.public.dotnet.languages.csharp)
  • Calling a Axis web service from Biztalk 2004
    ... Im having huge problems consuming an Axis web service from Biztalk ... The request goes well and Axis sends the response, ...
    (microsoft.public.biztalk.general)
  • Re: Can SoapExtension class be used to handle headers from AXIS web se
    ... AXIS web service using .NET and pulling info from the soap headers ... I know the SoapExtension class provides an API to peek ... SoapExtensions on the server (AXIS, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Conditional confirmation dialog
    ... ASP.NET AJAX extensions to call that web service from the client-side. ... save product details. ... Click Overwrite to update." ...
    (microsoft.public.dotnet.framework.aspnet)