You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Tudor, Liviu @Cimage" <li...@cimage.com> on 2004/02/03 18:03:18 UTC

Long delays experienced with Apache SOAP due to the HTTPUtils.post method

Hi everyone!

I am currently using Apache SOAP 2.3.1 together with JDK 1.4 and Xerces-J 2.0.0; I have written some proxy classes to access a few webservices written in .NET and it worked fine; however at some point I came across some delays during the synchronuous calls made from my proxies to the .NET side. I've added extra logging in my classes and it transpired that the actual delay occurs in the Message.send function. Further refinements of my searches showed in the end that the "bottleneck" is actually in the HTTPUtils function in the function send, in between the following lines:


      BufferedInputStream bInStream = new BufferedInputStream(inStream);
      /* Read the response status line. */
      int statusCode = 0;
      String statusString = null;
      StringBuffer linebuf = new StringBuffer();
      int b = 0;
      while (b != '\n' && b != -1) {
          b = bInStream.read();
          if (b != '\n' && b != '\r' && b != -1)
              linebuf.append((char)b);
      }
      String line = linebuf.toString();
      try {
          StringTokenizer st = new StringTokenizer(line);
          st.nextToken(); // ignore version part
          statusCode = Integer.parseInt (st.nextToken());
          StringBuffer sb = new StringBuffer();
          while (st.hasMoreTokens()) {
              sb.append (st.nextToken());
              if (st.hasMoreTokens()) {
                  sb.append(" ");
              }
          }
          statusString = sb.toString();
      }
      catch (Exception e) {
          throw new IllegalArgumentException(
              "Error parsing HTTP status line \"" + line + "\": " + e);
      }


It seem that the actual parsing of the status line takes over a second, on a "normal" PIII 800 MHz with 512 MB of RAM, which is quite a delay. Also, the same problem seems to appear in one of our customers' site, who's running BEA WebLogic on a Sparc quad-processor machine with 2 Gb of RAM.
Has anyone encountered this before and is there a way to bypass it?
Regards,


Liviu Tudor 
Cimage Novasoft Limited
www.cimagenovasoft.com
liviut@cimage.com
Fax: +44 (0)1344 767701
Direct Line: +44 (0)1344 767759 
*Centennial Court, Easthampstead Road, Bracknell, BERKS, RG12 1JZ 
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.