You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/04/08 18:14:23 UTC

cvs commit: ws-fx/wss4j/webapps/axis/WEB-INF web.xml

dims        2004/04/08 09:14:23

  Modified:    wss4j    build.xml
  Added:       wss4j/webapps/axis EchoHeaders.jws fingerprint.jsp
                        happyaxis.jsp index.html SOAPMonitorApplet.java
                        StockQuoteService.jws wss4j.html wss4j2.jsp
               wss4j/webapps/axis/WEB-INF web.xml
  Log:
  Adding a war target that can be used for for interop testing.
  
  Revision  Changes    Path
  1.9       +48 -0     ws-fx/wss4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/build.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- build.xml	1 Apr 2004 18:55:20 -0000	1.8
  +++ build.xml	8 Apr 2004 16:14:23 -0000	1.9
  @@ -73,10 +73,12 @@
           <property name="dir.keys" value="./keys"/>
           <property name="dir.specs" value="./specs"/>
           <property name="dir.interop" value="./interop"/>
  +        <property name="dir.webapp" location="./webapps/axis" />
   
           <property name="build.dir" value="./build"/>
           <property name="build.classes" value="${build.dir}/classes"/>
           <property name="build.work" value="${build.dir}/work"/>
  +        <property name="build.webapp" location="${build.dir}/webapps/axis"/>
   
           <property name="jar.library" value="${product.shortname}.jar"/>
   
  @@ -559,4 +561,50 @@
               <param name="cvsweb" expression="http://cvs.sourceforge.net/viewcvs.py/wss4j/"/>
           </style>
       </target>
  +
  +  <!-- =================================================================== -->
  +  <!-- Creates a war file for interop testing                              -->
  +  <!-- =================================================================== -->
  +  <target name="interop-war" depends="test"
  +      description="Create the web application" >
  +    <mkdir dir="${build.webapp}"/>
  +    <copy todir="${build.webapp}">
  +      <fileset dir="${dir.webapp}"/>
  +    </copy>
  +    <copy todir="${build.webapp}/WEB-INF/lib">
  +      <fileset dir="${dir.libs}">
  +        <include name="*.jar"/>
  +      </fileset>
  +    </copy>
  +    <copy todir="${build.webapp}/WEB-INF">
  +      <fileset dir="${build.dir}">
  +        <include name="*.wsdd"/>
  +      </fileset>
  +    </copy>
  +    <copy todir="${build.webapp}/WEB-INF/classes/">
  +      <fileset dir="${build.classes}"/>
  +    </copy>
  +    <copy todir="${build.webapp}/WEB-INF/classes/">
  +      <fileset dir=".">
  +          <include name="client-config.wsdd"/>
  +      </fileset>
  +    </copy>
  +    <delete>
  +      <fileset dir="${build.webapp}" includes="**/CVS"/>
  +    </delete>
  +    <path id="deploy_xml_files">
  +        <fileset dir="${build.work}">
  +            <include name="**/deploy.wsdd"/>
  +        </fileset>
  +    </path>
  +    <property name="deploy_xml_property" refid="deploy_xml_files"/>
  +    <java classname="org.apache.axis.utils.Admin" fork="yes" dir="${build.webapp}/WEB-INF">
  +        <classpath refid="classpath.library"/>
  +        <arg line="server"/>
  +        <arg line="${deploy_xml_property}"/>
  +    </java>
  +
  +    <jar jarfile="${build.dir}/axis.war" basedir="${build.webapp}"/>
  +  </target>
  +
   </project>
  
  
  
  1.1                  ws-fx/wss4j/webapps/axis/EchoHeaders.jws
  
  Index: EchoHeaders.jws
  ===================================================================
  /*
   * Copyright 2002,2004 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.
   */
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.MessageContext;
  import org.apache.axis.transport.http.HTTPConstants;
  
  import javax.servlet.http.HttpServletRequest;
  import java.util.Enumeration;
  import java.util.ArrayList;
  import java.util.Iterator;
  
  /**
   * class to list headers sent in request as a string array
   */
  public class EchoHeaders {
  
      /**
       * demo message context stuff
       * @return list of request headers
       */
      public String[] list() {
          HttpServletRequest request = getRequest();
          Enumeration headers=request.getHeaderNames();
          ArrayList list=new ArrayList();
          while (headers.hasMoreElements()) {
              String h = (String) headers.nextElement();
              String header=h+':'+request.getHeader(h);
              list.add(header);
          }
          String[] results=new String[list.size()];
          for(int i=0;i<list.size();i++) {
              results[i]=(String) list.get(i);
          }
          return results;
      }
  
      /**
       * get the caller; may involve reverse DNS
       * @return
       */
      public String whoami() {
          HttpServletRequest request = getRequest();
          String remote=request.getRemoteHost();
          return "Hello caller from "+remote;
      }
  
      /**
       * very simple method to echo the param.
       * @param param
       * @return
       */
      public String echo(String param) {
          return param;
      }
      
      /**
       * throw an axis fault with the text included
       */
      public void throwAxisFault(String param) throws AxisFault {
          throw new AxisFault(param);
      }
      
      public void throwException(String param) throws Exception { 
          throw new Exception(param);
      }
  
      /**
       * thow a runtime exception
       */
      public void throwRuntimeException(String param) { 
          throw new RuntimeException(param);
      }
      
      /**
       * helper
       * @return
       */
      private HttpServletRequest getRequest() {
          MessageContext context = MessageContext.getCurrentContext();
          HttpServletRequest req = (HttpServletRequest) context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
          return req;
      }
  
  }
  
  
  1.1                  ws-fx/wss4j/webapps/axis/fingerprint.jsp
  
  Index: fingerprint.jsp
  ===================================================================
  <%@ page import="java.io.File,
                   java.io.IOException,
                   java.util.Date"
      session="false" %>
  <html>
  <head>
  <title>System Fingerprint</title>
  </head>
  <body bgcolor=#ffffff>
  <%!
  
      /*
       * Fingerprint the users system. This is mainly for use in
       * diagnosing classpath problems. It is intended to dump out
       * a copy of the environment this webapp is running in,
       * and additionally attempt to identify versions of each jar
       * in the classpath.
       *
       * @author Brian Ewins
       */
  
      private java.util.Properties versionProps=new java.util.Properties();
  
      /**
       * Identify the version of a jar file. This uses a properties file
       * containing known names and sizes in the format
       * 'name(size)=version'. Version strings should be like 'xerces-1.4'
       * ie they should include the name of the library.
       */
      public String getFileVersion(File file) throws IOException {
          String key="<td>"+file.getName()+"</td>";
          key+= "<td>"+file.length()+"</td>";
          Date timestamp=new Date(file.lastModified());
          key+= "<td>"+timestamp.toString()+"</td>";
          return key;
  
          /* TODO: implement
          String value=versionProps.getProperty(key);
          if (value==null) {
              // make it possible to have jars without version nos
              value=versionProps.getProperty(file.getName());
          }
          if (value==null) {
              // fall back on something obvious
              value=key;
              Date timestamp=new Date(file.lastModified());
              value+=" / "+timestamp.toString();
          }
          return value;
          */
      }
  
      /**
       * Split up a classpath-like variable. Returns a list of files.
       * TODO: this can't cope with relative paths. I think theres code in BCEL that
       * can be used for this?
       */
      File[] splitClasspath(String path) throws IOException {
          java.util.StringTokenizer st=
              new java.util.StringTokenizer(path,
                              System.getProperty("path.separator"));
          int toks=st.countTokens();
          File[] files=new File[toks];
          for(int i=0;i<toks;i++) {
              files[i]=new File(st.nextToken());
          }
          return files;
      }
  
      /** given a list of files, return a list of jars which actually exist */
      File[] scanFiles(File[] files) throws IOException {
          File[] jars=new File[files.length];
          int found=0;
          for (int i=0; i<files.length; i++) {
              if (files[i].getName().toLowerCase().endsWith(".jar")
                      && files[i].exists()) {
                  jars[found]=files[i];
                  found++;
              }
          }
          if (found<files.length) {
              File[] temp=new File[found];
              System.arraycopy(jars,0,temp,0,found);
              jars=temp;
          }
          return jars;    
      }
  
      private static final File[] NO_FILES=new File[0];
  
      /** scan a directory for jars */    
      public File[] scanDir(String dir) throws IOException 
          {
          if(dir==null) {
              return NO_FILES;
          }
          return scanDir(new File(dir));
          }
          
      public File[] scanDir(File dir) throws IOException {
          if (!dir.exists() || !dir.isDirectory()) {
              return NO_FILES;
          }
          return scanFiles(dir.listFiles());
      }
  
      /** scan a classpath for jars */    
      public File[] scanClasspath(String path) throws IOException {
          if (path==null) {
              return NO_FILES;
          }
          return scanFiles(splitClasspath(path));
      }
  
      /** 
       * scan a 'dirpath' (like the java.ext.dirs system property) for jars 
       */   
      public File[] scanDirpath(String path) throws IOException {
          if (path==null) {
              return NO_FILES;
          }
          File[] current=new File[0];
          File[] dirs=splitClasspath(path);
          for(int i=0; i<dirs.length; i++) {
              File[] jars=scanDir(dirs[i]);
              File[] temp=new File[current.length+jars.length];
              System.arraycopy(current,0,temp,0,current.length);
              System.arraycopy(jars,0,temp,current.length,jars.length);
              current=temp;
          }
          return scanFiles(current);
      }
  
      /** print out the jar versions for a directory */
      public void listDirectory(String title, JspWriter out,String dir, String comment) throws IOException {
          listVersions(title, out,scanDir(dir), comment);
      }
  
      /** print out the jar versions for a directory-like system property */
      public void listDirProperty(String title, JspWriter out,String key, String comment) throws IOException {
          listVersions(title, out,scanDir(System.getProperty(key)), comment);
      }
  
      /** print out the jar versions for a classpath-like system property */
      public void listClasspathProperty(String title, JspWriter out,String key, String comment) throws IOException {
          listVersions(title, out,scanClasspath(System.getProperty(key)), comment);
      }
  
      /** print out the jar versions for a 'java.ext.dirs'-like system property */
      public void listDirpathProperty(String title, JspWriter out,String key, String comment) throws IOException {
          listVersions(title, out,scanDirpath(System.getProperty(key)), comment);
      }
  
      /** print out the jar versions for a context-relative directory */
      public void listContextPath(String title, JspWriter out, String path, String comment)  throws IOException {
          listVersions(title, out,scanDir(getServletConfig().getServletContext().getRealPath(path)), comment);
      }
  
      /** print out the jar versions for a given list of files */
      public void listVersions(String title, JspWriter out,File[] jars, String comment) throws IOException {
          out.print("<h2>");
          out.print(title);
          out.println("</h2>");
          out.println("<table>");
          for (int i=0; i<jars.length; i++) {
              out.println("<tr>"+getFileVersion(jars[i])+"</tr>");
          }
          out.println("</table>");
          if(comment!=null && comment.length()>0) {
              out.println("<p>");
              out.println(comment);
              out.println("<p>");
          }
      }
  
  %>
  <h1>System Fingerprint</h1>
  <h2>JVM and Server Version</h2>
  <table>
  <tr>
      <td>Servlet Engine</td>
      <td><%= getServletConfig().getServletContext().getServerInfo() %></td>
      <td><%= getServletConfig().getServletContext().getMajorVersion() %></td>
      <td><%= getServletConfig().getServletContext().getMinorVersion() %></td>
  </tr>
  <tr>
      <td>Java VM</td>
      <td><%= System.getProperty("java.vm.vendor") %></td>
      <td><%= System.getProperty("java.vm.name") %></td>
      <td><%= System.getProperty("java.vm.version") %></td>
  </tr>
  <tr>
      <td>Java RE</td>
      <td><%= System.getProperty("java.vendor") %></td>
      <td><%= System.getProperty("java.version") %></td>
      <td> </td>
  </tr>
  <tr>
      <td>Platform</td>
      <td><%= System.getProperty("os.name") %></td>
      <td><%= System.getProperty("os.arch") %></td>
      <td><%= System.getProperty("os.version") %></td>
  </tr>
  </table>
  
  <%
  listClasspathProperty("Boot jars", out,"sun.boot.class.path", "Only valid on a sun jvm");
  listClasspathProperty("System jars", out,"java.class.path", null);
  listDirpathProperty("Extra system jars", out,"java.ext.dirs", null);
  listContextPath("Webapp jars", out, "/WEB-INF/lib", null);
  // identify the container...
  String container=getServletConfig().getServletContext().getServerInfo();
  if (container.startsWith("Tomcat Web Server/3.2")) {
      String home=System.getProperty("tomcat.home");
      if(home!=null) {
          listDirectory("Tomcat 3.2 Common Jars", out,
                        home+File.separator
                        +"lib",
                        null);
      }
  } else if (container.startsWith("Tomcat Web Server/3.3")) {
      String home=System.getProperty("tomcat.home");
      if(home!=null) {
          listDirectory("Tomcat 3.3 Container Jars", out,
                        home+File.separator
                        +"lib"+File.separator
                        +"container",
                        null);
          listDirectory("Tomcat 3.3 Common Jars", out,
                        home+File.separator
                        +"lib"+File.separator
                        +"common",
                        null);
      }
  } else if (container.startsWith("Apache Tomcat/4.0")) {
      //handle catalina common dir
      String home=System.getProperty("catalina.home");
      if(home!=null) {
          listDirectory("Tomcat 4.0 Common Jars", out,
                        home+File.separator
                        +"common"+File.separator
                        +"lib",
                        null);
      }
  } else if (container.startsWith("Apache Tomcat/4.1")) {
      //handle catalina common dir
      String home=System.getProperty("catalina.home");
      if(home!=null) {
          listDirectory("Tomcat 4.1 Common Jars", out,
                        home+File.separator
                        +"shared"+File.separator
                        +"lib",
                        null);
      }
  } else if (System.getProperty("resin.home")!=null) {
      String home=System.getProperty("resin.home");
      if(home!=null) {
          listDirectory("Resin Common Jars", out,
                        home+File.separator
                        +"lib",
                        null);
      }    
  } else if (System.getProperty("weblogic.httpd.servlet.classpath")!=null) {
      listClasspathProperty("Weblogic Servlet Jars", out,
                    "weblogic.httpd.servlet.classpath",
                    null);
  } else {
      //TODO: identify more servlet engine classpaths.
  }
  %>
  </body>
  </html>
  
  
  1.1                  ws-fx/wss4j/webapps/axis/happyaxis.jsp
  
  Index: happyaxis.jsp
  ===================================================================
  <html>
  <%@ page import="java.io.InputStream,
                   java.io.IOException,
                   javax.xml.parsers.SAXParser,
                   javax.xml.parsers.SAXParserFactory"
     session="false" %>
   <%
      /*
   * Copyright 2002,2004 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.
   */
  %>
  <head>
  <title>Axis Happiness Page</title>
  </head>
  <body bgcolor='#ffffff'>
  <%!
  
      /*
       * Happiness tests for axis. These look at the classpath and warn if things
       * are missing. Normally addng this much code in a JSP page is mad
       * but here we want to validate JSP compilation too, and have a drop-in
       * page for easy re-use
       * @author Steve 'configuration problems' Loughran
       * @author dims
       * @author Brian Ewins
       */
  
  
      /**
       * Get a string providing install information.
       * TODO: make this platform aware and give specific hints
       */
      public String getInstallHints(HttpServletRequest request) {
  
          String hint=
              "<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may need to put libraries that contain "
              +"java.* or javax.* packages into CATALINA_HOME/common/lib"
              +"<br>jaxrpc.jar and saaj.jar are two such libraries.";
          return hint;
      }
  
      /**
       * test for a class existing
       * @param classname
       * @return class iff present
       */
      Class classExists(String classname) {
          try {
              return Class.forName(classname);
          } catch (ClassNotFoundException e) {
              return null;
          }
      }
  
      /**
       * test for resource on the classpath
       * @param resource
       * @return true iff present
       */
      boolean resourceExists(String resource) {
          boolean found;
          InputStream instream=this.getClass().getResourceAsStream(resource);
          found=instream!=null;
          if(instream!=null) {
              try {
                  instream.close();
              } catch (IOException e) {
              }
          }
          return found;
      }
  
      /**
       * probe for a class, print an error message is missing
       * @param out stream to print stuff
       * @param category text like "warning" or "error"
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @return the number of missing classes
       * @throws IOException
       */
      int probeClass(JspWriter out,
                     String category,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          try {
              Class clazz = classExists(classname);
              if(clazz == null)  {
                 String url="";
                 if(homePage!=null) {
                    url="<br>  See <a href="+homePage+">"+homePage+"</a>";
                 }
                 out.write("<p>"+category+": could not find class "+classname
                     +" from file <b>"+jarFile
                     +"</b><br>  "+errorText
                     +url
                     +"<p>");
                 return 1;
              } else {
                 String location = getLocation(out, clazz);
                 if(location == null) {
                    out.write("Found "+ description + " (" + classname + ")<br>");
                 }
                 else {
                    out.write("Found "+ description + " (" + classname + ") at " + location + "<br>");
                 }
                 return 0;
              }
          } catch(NoClassDefFoundError ncdfe) { 
              String url="";
              if(homePage!=null) {
                  url="<br>  See <a href="+homePage+">"+homePage+"</a>";
              }
              out.write("<p>"+category+": could not find a dependency"
                      +" of class "+classname
                      +" from file <b>"+jarFile
                      +"</b><br> "+errorText
                      +url
                      +"<br>The root cause was: "+ncdfe.getMessage()
                      +"<br>This can happen e.g. if "+classname+" is in" 
                      +" the 'common' classpath, but a dependency like "
                      +" activation.jar is only in the webapp classpath."
                      +"<p>");
              return 1;
          }
      }
  
      /**
       * get the location of a class
       * @param out
       * @param clazz
       * @return the jar file or path where a class was found
       */
  
      String getLocation(JspWriter out,
                         Class clazz) {
          try {
              java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
              String location = url.toString();
              if(location.startsWith("jar")) {
                  url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
                  location = url.toString();
              } 
              
              if(location.startsWith("file")) {
                  java.io.File file = new java.io.File(url.getFile());
                  return file.getAbsolutePath();
              } else {
                  return url.toString();
              }
          } catch (Throwable t){
          }
          return "an unknown location";
      }
  
      /**
       * a class we need if a class is missing
       * @param out stream to print stuff
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @throws IOException when needed
       * @return the number of missing libraries (0 or 1)
       */
      int needClass(JspWriter out,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          return probeClass(out,
                  "<b>Error</b>",
                  classname,
                  jarFile,
                  description,
                  errorText,
                  homePage);
      }
  
      /**
       * print warning message if a class is missing
       * @param out stream to print stuff
       * @param classname class to look for
       * @param jarFile where this class comes from
       * @param errorText extra error text
       * @param homePage where to d/l the library
       * @throws IOException when needed
       * @return the number of missing libraries (0 or 1)
       */
      int wantClass(JspWriter out,
                     String classname,
                     String jarFile,
                     String description,
                     String errorText,
                     String homePage) throws IOException {
          return probeClass(out,
                  "<b>Warning</b>",
                  classname,
                  jarFile,
                  description,
                  errorText,
                  homePage);
      }
  
      /**
       * probe for a resource existing,
       * @param out
       * @param resource
       * @param errorText
       * @throws Exception
       */
      int wantResource(JspWriter out,
                        String resource,
                        String errorText) throws Exception {
          if(!resourceExists(resource)) {
              out.write("<p><b>Warning</b>: could not find resource "+resource
                          +"<br>"
                          +errorText);
              return 0;
          } else {
              out.write("found "+resource+"<br>");
              return 1;
          }
      }
  
  
      /**
       *  get servlet version string
       *
       */
  
      public String getServletVersion() {
          ServletContext context=getServletConfig().getServletContext();
          int major = context.getMajorVersion();
          int minor = context.getMinorVersion();
          return Integer.toString(major) + '.' + Integer.toString(minor);
      }
  
  
  
      /**
       * what parser are we using.
       * @return the classname of the parser
       */
      private String getParserName() {
          SAXParser saxParser = getSAXParser();
          if (saxParser == null) {
              return "Could not create an XML Parser";
          }
  
          // check to what is in the classname
          String saxParserName = saxParser.getClass().getName();
          return saxParserName;
      }
  
      /**
       * Create a JAXP SAXParser
       * @return parser or null for trouble
       */
      private SAXParser getSAXParser() {
          SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
          if (saxParserFactory == null) {
              return null;
          }
          SAXParser saxParser = null;
          try {
              saxParser = saxParserFactory.newSAXParser();
          } catch (Exception e) {
          }
          return saxParser;
      }
  
      /**
       * get the location of the parser
       * @return path or null for trouble in tracking it down
       */
  
      private String getParserLocation(JspWriter out) {
          SAXParser saxParser = getSAXParser();
          if (saxParser == null) {
              return null;
          }
          String location = getLocation(out,saxParser.getClass());
          return location;
      }
      %>
  <html><head><title>Axis Happiness Page</title></head>
  <body>
  <h1>Axis Happiness Page</h1>
  <h2>Examining webapp configuration</h2>
  
  <p>
  <h3>Needed Components</h3>
  <%
      int needed=0,wanted=0;
  
      /**
       * the essentials, without these Axis is not going to work
       */
      needed=needClass(out, "javax.xml.soap.SOAPMessage",
              "saaj.jar",
              "SAAJ API",
              "Axis will not work",
              "http://xml.apache.org/axis/");
  
      needed+=needClass(out, "javax.xml.rpc.Service",
              "jaxrpc.jar",
              "JAX-RPC API",
              "Axis will not work",
              "http://xml.apache.org/axis/");
  
      needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
              "axis.jar",
              "Apache-Axis",
              "Axis will not work",
              "http://xml.apache.org/axis/");
  
      needed+=needClass(out, "org.apache.commons.discovery.Resource",
              "commons-discovery.jar",
              "Jakarta-Commons Discovery",
              "Axis will not work",
              "http://jakarta.apache.org/commons/discovery.html");
  
      needed+=needClass(out, "org.apache.commons.logging.Log",
              "commons-logging.jar",
              "Jakarta-Commons Logging",
              "Axis will not work",
              "http://jakarta.apache.org/commons/logging.html");
  
      needed+=needClass(out, "org.apache.log4j.Layout",
              "log4j-1.2.8.jar",
              "Log4j",
              "Axis may not work",
              "http://jakarta.apache.org/log4j");
  
      //should we search for a javax.wsdl file here, to hint that it needs
      //to go into an approved directory? because we dont seem to need to do that.
      needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
              "wsdl4j.jar",
              "IBM's WSDL4Java",
              "Axis will not work",
              null);
  
      needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
              "xerces.jar",
              "JAXP implementation",
              "Axis will not work",
              "http://xml.apache.org/xerces-j/");
  
      needed+=needClass(out,"javax.activation.DataHandler",
              "activation.jar",
              "Activation API",
              "Axis will not work",
              "http://java.sun.com/products/javabeans/glasgow/jaf.html");
  %>
  <h3>Optional Components</h3>
  <%
      /*
       * now the stuff we can live without
       */
      wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
              "mail.jar",
              "Mail API",
              "Attachments will not work",
              "http://java.sun.com/products/javamail/");
  
      wanted+=wantClass(out,"org.apache.xml.security.Init",
              "xmlsec.jar",
              "XML Security API",
              "XML Security is not supported",
              "http://xml.apache.org/security/");
  
      wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
              "jsse.jar or java1.4+ runtime",
              "Java Secure Socket Extension",
              "https is not supported",
              "http://java.sun.com/products/jsse/");
      /*
       * resources on the classpath path
       */
      /* broken; this is a file, not a resource
      wantResource(out,"/server-config.wsdd",
              "There is no server configuration file;"
              +"run AdminClient to create one");
      */
      /* add more libraries here */
  
      out.write("<h3>");
      //is everythng we need here
      if(needed==0) {
         //yes, be happy
          out.write("<i>The core axis libraries are present. </i>");
      } else {
          //no, be very unhappy
          response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
          out.write("<i>"
                  +needed
                  +" core axis librar"
                  +(needed==1?"y is":"ies are")
                  +" missing</i>");
      }
      //now look at wanted stuff
      if(wanted>0) {
          out.write("<i>"
                  +wanted
                  +" optional axis librar"
                  +(wanted==1?"y is":"ies are")
                  +" missing</i>");
      } else {
          out.write("The optional components are present.");
      }
      out.write("</h3>");
      //hint if anything is missing
      if(needed>0 || wanted>0 ) {
          out.write(getInstallHints(request));
      }
  
      %>
      <p>
      <B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your
      web service will work, because there are many configuration options that we do
      not check for. These tests are <i>necessary</i> but not <i>sufficient</i>
      <hr>
  
      <h2>Examining Application Server</h2>
      <%
          String servletVersion=getServletVersion();
          String xmlParser=getParserName();
          String xmlParserLocation = getParserLocation(out);
  
      %>
      <table>
          <tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
          <tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
          <tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
      </table>
  <% if(xmlParser.indexOf("crimson")>=0) { %>
      <p>
      <b>We recommend <a href="http://xml.apache.org/xerces2-j/">Xerces 2</a>
          over Crimson as the XML parser for Axis</b>
      </p>
  <%    } %>
  
      <h2>Examining System Properties</h2>
  <%
      /** 
       * Dump the system properties
       */
      java.util.Enumeration e=null;
      try {
          e= System.getProperties().propertyNames();
      } catch (SecurityException se) {
      }
      if(e!=null) {
          out.write("<pre>");
          for (;e.hasMoreElements();) {
              String key = (String) e.nextElement();
              out.write(key + "=" + System.getProperty(key)+"\n");
          }
          out.write("</pre><p>");
      } else {
          out.write("System properties are not accessible<p>");
      }
  %>
      <hr>
      Platform: <%= getServletConfig().getServletContext().getServerInfo()  %>
  </body>
  </html>
  
  
  
  
  
  1.1                  ws-fx/wss4j/webapps/axis/index.html
  
  Index: index.html
  ===================================================================
  <html>
  
  <head>
  <meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1">
  <title>Apache-Axis</title>
  </head>
  
  <body bgcolor="#FFFFFF">
  
  <h1 align="center">Apache-AXIS</h1>
  
  <p>Hello! <em>Welcome</em> to Apache-Axis.</p>
  
  <p>What do you want to do today?</p>
  
  <ul>
      <li><a href="happyaxis.jsp">Validate</a>
          the local installation's configuration<br>
          <i>see below if this does not work.</i></li>
      <li><a href="servlet/AxisServlet">View</a>
          the list of deployed Web services</li>
      <li><a href="EchoHeaders.jws?method=list">
          Call a local endpoint</a> that list's the caller's
          http headers (or see its
          <a href="EchoHeaders.jws?wsdl">WSDL</a>). 
      <li><a href="http://xml.apache.org/axis">Visit</a>
          the Apache-Axis Home Page</li>
      <li><a href="servlet/AdminServlet">Administer Axis</a> <br>
          [disabled by default for security reasons]</li>
      <li><a href="SOAPMonitor">SOAPMonitor</a> <br>
          [disabled by default for security reasons]</li>
  </ul>
  To enable the disabled features, uncomment the appropriate declarations in 
  WEB-INF/web.xml in the webapplication and restart it.
  <h3>Validating Axis</h3>
  
  If the "happyaxis" validation page displays an exception instead of a 
  status page, the likely cause is that you have multiple XML parsers in 
  your classpath. Clean up your classpath by eliminating extraneous parsers. 
  
  <p>
  If you have problems getting Axis to work, consult the Axis 
  <a
  href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages">Wiki</a>
  and then try the Axis user mailing list. 
  </body>
  </html>
  
  
  
  1.1                  ws-fx/wss4j/webapps/axis/SOAPMonitorApplet.java
  
  Index: SOAPMonitorApplet.java
  ===================================================================
  /*
   * Copyright 2001,2004 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.
   */
  
  import java.awt.*;
  import java.awt.event.*;
  import java.io.*;
  import java.net.*;
  import java.text.*;
  import java.util.*;
  import javax.swing.*;
  import javax.swing.border.*;
  import javax.swing.event.*;
  import javax.swing.table.*;
  
  import org.apache.axis.monitor.SOAPMonitorConstants;
  
  /**
   * This is a SOAP Mointor Applet class.  This class provides
   * the user interface for displaying data from the SOAP
   * monitor service.
   *
   * @author Brian Price (pricebe@us.ibm.com)
   *
   */
  public class SOAPMonitorApplet extends JApplet {
  
      /**
       * Private data
       */
      private JPanel      main_panel = null;
      private JTabbedPane tabbed_pane = null;
      private int         port = 0;
      private Vector      pages = null;
  
      /**
       * Constructor
       */
      public SOAPMonitorApplet() {
      }
  
      /**
       * Applet initialization
       */
      public void init() {
          // Get the port to be used
          String port_str = getParameter("port");
          if (port_str != null) {
              port = Integer.parseInt(port_str);
          }
          // Try to use the system look and feel
          try {
             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch (Exception e){
          }
          // Create main panel to hold notebook
          main_panel = new JPanel();
          main_panel.setBackground(Color.white);
          main_panel.setLayout(new BorderLayout());
          setContentPane(main_panel);
          // Create the notebook
          tabbed_pane = new JTabbedPane(JTabbedPane.TOP);
          main_panel.add(tabbed_pane,BorderLayout.CENTER);
          // Add notebook page for default host connection
          pages = new Vector();
          addPage(new SOAPMonitorPage(getCodeBase().getHost()));
      }
  
      /**
       * Add a page to the notebook
       */
      private void addPage(SOAPMonitorPage pg) {
          tabbed_pane.addTab("  "+pg.getHost()+"  ", pg);
          pages.addElement(pg);
      }
  
      /** 
       * Applet is being displayed 
       */
      public void start() {
          // Tell all pages to start talking to the server
          Enumeration e = pages.elements();
          while (e.hasMoreElements()) {
              SOAPMonitorPage pg = (SOAPMonitorPage) e.nextElement();
              if (pg != null) {
                  pg.start();
              }
          }
      }
  
      /*
       * Applet is no longer displayed
       */
      public void stop() {
          // Tell all pages to stop talking to the server
          Enumeration e = pages.elements();
          while (e.hasMoreElements()) {
              SOAPMonitorPage pg = (SOAPMonitorPage) e.nextElement();
              if (pg != null) {
                  pg.stop();
              }
          }
      }
  
      /**
       * Applet cleanup
       */
      public void destroy() {
          tabbed_pane = null;
          main_panel = null;
      }
  
      /**
       * This class provides the contents of a notebook page
       * representing a server connection.
       */
      class SOAPMonitorPage extends JPanel 
                            implements Runnable,
                                       ListSelectionListener,
                                       ActionListener {
  
          /**
           * Status Strings
           */
          private final String STATUS_ACTIVE    = "The SOAP Monitor is started.";
          private final String STATUS_STOPPED   = "The SOAP Monitor is stopped.";
          private final String STATUS_CLOSED    = "The server communication has been terminated.";
          private final String STATUS_NOCONNECT = "The SOAP Monitor is unable to communcate with the server.";
  
          /**
           * Private data
           */
          private String                host = null;
          private Socket                socket = null;
          private ObjectInputStream     in = null;
          private ObjectOutputStream    out = null;
          private SOAPMonitorTableModel model = null;
          private JTable                table = null;
          private JScrollPane           scroll = null;
          private JPanel                list_panel = null;
          private JPanel                list_buttons = null;
          private JButton               remove_button = null;
          private JButton               remove_all_button = null;
          private JButton               filter_button = null;
          private JPanel                details_panel = null;
          private JPanel                details_header = null;
          private JSplitPane            details_soap = null;
          private JPanel                details_buttons = null;
          private JLabel                details_time = null;
          private JLabel                details_target = null;
          private JLabel                details_status = null;
          private JLabel                details_time_value = null;
          private JLabel                details_target_value = null;
          private JLabel                details_status_value = null;
          private EmptyBorder           empty_border = null;
          private EtchedBorder          etched_border = null;
          private JPanel                request_panel = null;
          private JPanel                response_panel = null;
          private JLabel                request_label = null;
          private JLabel                response_label = null;
          private SOAPMonitorTextArea   request_text = null;
          private SOAPMonitorTextArea   response_text = null;
          private JScrollPane           request_scroll = null;
          private JScrollPane           response_scroll = null;
          private JButton               layout_button = null;
          private JSplitPane            split = null;
          private JPanel                status_area = null;
          private JPanel                status_buttons = null;
          private JButton               start_button = null;
          private JButton               stop_button = null;
          private JLabel                status_text = null;
          private JPanel                status_text_panel = null;
          private SOAPMonitorFilter     filter = null;
          private GridBagLayout         details_header_layout = null;
          private GridBagConstraints    details_header_constraints = null;
          private JCheckBox             reflow_xml = null;
  
          /**
           * Constructor (create and layout page)
           */
          public SOAPMonitorPage(String host_name) {
              host = host_name;
              // Set up default filter (show all messages)
              filter = new SOAPMonitorFilter();
              // Use borders to help improve appearance
              etched_border = new EtchedBorder();
              // Build top portion of split (list panel) 
              model = new SOAPMonitorTableModel();
              table = new JTable(model);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              table.setRowSelectionInterval(0,0);
              table.setPreferredScrollableViewportSize(new Dimension(600, 96));
              table.getSelectionModel().addListSelectionListener(this);
              scroll = new JScrollPane(table);
              remove_button = new JButton("Remove");
              remove_button.addActionListener(this);
              remove_button.setEnabled(false);
              remove_all_button = new JButton("Remove All");
              remove_all_button.addActionListener(this);
              filter_button = new JButton("Filter ...");
              filter_button.addActionListener(this);
              list_buttons = new JPanel();
              list_buttons.setLayout(new FlowLayout());
              list_buttons.add(remove_button);
              list_buttons.add(remove_all_button);
              list_buttons.add(filter_button);
              list_panel = new JPanel();
              list_panel.setLayout(new BorderLayout());
              list_panel.add(scroll,BorderLayout.CENTER);
              list_panel.add(list_buttons, BorderLayout.SOUTH);
              list_panel.setBorder(empty_border);
              // Build bottom portion of split (message details) 
              details_time = new JLabel("Time: ", SwingConstants.RIGHT);
              details_target = new JLabel("Target Service: ", SwingConstants.RIGHT);
              details_status = new JLabel("Status: ", SwingConstants.RIGHT);
              details_time_value = new JLabel();
              details_target_value = new JLabel();
              details_status_value = new JLabel();
              Dimension preferred_size = details_time.getPreferredSize();
              preferred_size.width = 1;
              details_time.setPreferredSize(preferred_size); 
              details_target.setPreferredSize(preferred_size); 
              details_status.setPreferredSize(preferred_size); 
              details_time_value.setPreferredSize(preferred_size); 
              details_target_value.setPreferredSize(preferred_size); 
              details_status_value.setPreferredSize(preferred_size);
              details_header = new JPanel();
              details_header_layout = new GridBagLayout();
              details_header.setLayout(details_header_layout);
              details_header_constraints = new GridBagConstraints();
              details_header_constraints.fill=GridBagConstraints.BOTH;
              details_header_constraints.weightx=0.5;
              details_header_layout.setConstraints(details_time,details_header_constraints);
              details_header.add(details_time);
              details_header_layout.setConstraints(details_time_value,details_header_constraints);
              details_header.add(details_time_value);
              details_header_layout.setConstraints(details_target,details_header_constraints);
              details_header.add(details_target);
              details_header_constraints.weightx=1.0;
              details_header_layout.setConstraints(details_target_value,details_header_constraints);
              details_header.add(details_target_value);
              details_header_constraints.weightx=.5;
              details_header_layout.setConstraints(details_status,details_header_constraints);
              details_header.add(details_status);
              details_header_layout.setConstraints(details_status_value,details_header_constraints);
              details_header.add(details_status_value);
              details_header.setBorder(etched_border);
              request_label = new JLabel("SOAP Request", SwingConstants.CENTER);
              request_text = new SOAPMonitorTextArea();
              request_text.setEditable(false);
              request_scroll = new JScrollPane(request_text);
              request_panel = new JPanel();
              request_panel.setLayout(new BorderLayout());
              request_panel.add(request_label, BorderLayout.NORTH);
              request_panel.add(request_scroll, BorderLayout.CENTER);
              response_label = new JLabel("SOAP Response", SwingConstants.CENTER);
              response_text = new SOAPMonitorTextArea();
              response_text.setEditable(false);
              response_scroll = new JScrollPane(response_text);
              response_panel = new JPanel();
              response_panel.setLayout(new BorderLayout());
              response_panel.add(response_label, BorderLayout.NORTH);
              response_panel.add(response_scroll, BorderLayout.CENTER);
              details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
              details_soap.setTopComponent(request_panel);
              details_soap.setRightComponent(response_panel);
              details_soap.setResizeWeight(.5);
              details_panel = new JPanel();
              layout_button = new JButton("Switch Layout");
              layout_button.addActionListener(this);
              reflow_xml = new JCheckBox("Reflow XML text");
              reflow_xml.addActionListener(this);
              details_buttons = new JPanel();
              details_buttons.setLayout(new FlowLayout());
              details_buttons.add(reflow_xml);
              details_buttons.add(layout_button);
              details_panel.setLayout(new BorderLayout());
              details_panel.add(details_header,BorderLayout.NORTH);
              details_panel.add(details_soap,BorderLayout.CENTER);
              details_panel.add(details_buttons,BorderLayout.SOUTH);
              details_panel.setBorder(empty_border);
              // Add the two parts to the age split pane
              split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
              split.setTopComponent(list_panel);
              split.setRightComponent(details_panel);
              // Build status area
              start_button = new JButton("Start");
              start_button.addActionListener(this);
              stop_button = new JButton("Stop");
              stop_button.addActionListener(this);
              status_buttons = new JPanel();
              status_buttons.setLayout(new FlowLayout());
              status_buttons.add(start_button);
              status_buttons.add(stop_button);
              status_text = new JLabel();
              status_text.setBorder(new BevelBorder(BevelBorder.LOWERED));
              status_text_panel = new JPanel();
              status_text_panel.setLayout(new BorderLayout());
              status_text_panel.add(status_text, BorderLayout.CENTER);
              status_text_panel.setBorder(empty_border);
              status_area = new JPanel();
              status_area.setLayout(new BorderLayout());
              status_area.add(status_buttons, BorderLayout.WEST);
              status_area.add(status_text_panel, BorderLayout.CENTER);
              status_area.setBorder(etched_border);
              // Add the split and status area to page
              setLayout(new BorderLayout());
              add(split, BorderLayout.CENTER);
              add(status_area, BorderLayout.SOUTH);
          }
  
          /**
           * Get the name of the host we are displaying
           */
          public String getHost() {
              return host;
          }
  
          /**
           * Set the status text
           */
          public void setStatus(String txt) {
              status_text.setForeground(Color.black);
              status_text.setText("  "+txt);
          }
  
          /**
           * Set the status text to an error
           */
          public void setErrorStatus(String txt) {
              status_text.setForeground(Color.red);
              status_text.setText("  "+txt);
          }
  
          /**
           * Start talking to the server
           */
          public void start() {
              String codehost = getCodeBase().getHost();
              if (socket == null) {
                  try {
                      // Open the socket to the server
                      socket = new Socket(codehost, port);
                      // Create output stream
                      out = new ObjectOutputStream(socket.getOutputStream());
                      out.flush();
                      // Create input stream and start background
                      // thread to read data from the server
                      in = new ObjectInputStream(socket.getInputStream());
                      new Thread(this).start();
                  } catch (Exception e) {
                      // Exceptions here are unexpected, but we can't
                      // really do anything (so just write it to stdout
                      // in case someone cares and then ignore it)
                      System.out.println("Exception! "+e.toString());
                      e.printStackTrace();
                      setErrorStatus(STATUS_NOCONNECT);
                      socket = null;
                  }
              } else {
                  // Already started
              }
              if (socket != null) {
                  // Make sure the right buttons are enabled
                  start_button.setEnabled(false);
                  stop_button.setEnabled(true);
                  setStatus(STATUS_ACTIVE);
              }
          }
  
          /**
           * Stop talking to the server
           */
          public void stop() {
              if (socket != null) {
                  // Close all the streams and socket
                  if (out != null) {
                      try {
                          out.close();
                      } catch (IOException ioe) {
                      }
                      out = null;
                  }
                  if (in != null) {
                      try {
                          in.close();
                      } catch (IOException ioe) {
                      }
                      in = null;
                  }
                  if (socket != null) {
                      try {
                          socket.close();
                      } catch (IOException ioe) {
                      }
                      socket = null;
                  }
              } else {
                  // Already stopped
              }
              // Make sure the right buttons are enabled
              start_button.setEnabled(true);
              stop_button.setEnabled(false);
              setStatus(STATUS_STOPPED);
          }
  
          /**
           * Background thread used to receive data from
           * the server.
           */
          public void run() {
              Long            id;
              Integer         message_type;
              String          target;
              String          soap;
              SOAPMonitorData data;
              int             selected;
              int             row;
              boolean         update_needed;
              while (socket != null) {
                  try {
                      // Get the data from the server
                      message_type = (Integer) in.readObject();
                      // Process the data depending on its type
                      switch (message_type.intValue()) {
                          case SOAPMonitorConstants.SOAP_MONITOR_REQUEST:
                              // Get the id, target and soap info
                              id = (Long) in.readObject();
                              target = (String) in.readObject();
                              soap = (String) in.readObject();
                              // Add new request data to the table
                              data = new SOAPMonitorData(id,target,soap);
                              model.addData(data);
                              // If "most recent" selected then update
                              // the details area if needed
                              selected = table.getSelectedRow();
                              if ((selected == 0) && model.filterMatch(data)) {
                                  valueChanged(null);
                              }
                              break;
                          case SOAPMonitorConstants.SOAP_MONITOR_RESPONSE:
                              // Get the id and soap info
                              id = (Long) in.readObject();
                              soap = (String) in.readObject();
                              data = model.findData(id);
                              if (data != null) {
                                  update_needed = false;
                                  // Get the selected row
                                  selected = table.getSelectedRow();
                                  // If "most recent", then always
                                  // update details area
                                  if (selected == 0) {
                                      update_needed = true;
                                  }
                                  // If the data being updated is
                                  // selected then update details
                                  row = model.findRow(data);
                                  if ((row != -1) && (row == selected)) {
                                      update_needed = true;
                                  }
                                  // Set the response and update table
                                  data.setSOAPResponse(soap);
                                  model.updateData(data);
                                  // Refresh details area (if needed)
                                  if (update_needed) {
                                      valueChanged(null);
                                  }
                              }
                              break;
                      }
  
                  } catch (Exception e) {
                      // Exceptions are expected here when the
                      // server communication has been terminated.
                      if (stop_button.isEnabled()) {
                          stop();
                          setErrorStatus(STATUS_CLOSED);
                      }
                  }
              }
          }
  
          /**
           * Listener to handle table selection changes
           */
          public void valueChanged(ListSelectionEvent e) {
              int row = table.getSelectedRow();
              // Check if they selected a specific row
              if (row > 0) {
                  remove_button.setEnabled(true);
              } else {
                  remove_button.setEnabled(false);
              }
              // Check for "most recent" selection
              if (row == 0) {
                  row = model.getRowCount() - 1;
                  if (row == 0) {
                      row = -1;
                  }
              }
              if (row == -1) {
                  // Clear the details panel
                  details_time_value.setText("");
                  details_target_value.setText("");
                  details_status_value.setText("");
                  request_text.setText("");
                  response_text.setText("");
              } else {
                  // Show the details for the row
                  SOAPMonitorData soap = model.getData(row);
                  details_time_value.setText(soap.getTime());
                  details_target_value.setText(soap.getTargetService());
                  details_status_value.setText(soap.getStatus());
                  if (soap.getSOAPRequest() == null) {
                      request_text.setText("");
                  } else {
                      request_text.setText(soap.getSOAPRequest());
                      request_text.setCaretPosition(0);
                  }
                  if (soap.getSOAPResponse() == null) {
                      response_text.setText("");
                  } else {
                      response_text.setText(soap.getSOAPResponse());
                      response_text.setCaretPosition(0);
                  }
              }
          }
  
          /**
           * Listener to handle button actions
           */
          public void actionPerformed(ActionEvent e) {
              // Check if the user pressed the remove button
              if (e.getSource() == remove_button) {
                  int row = table.getSelectedRow();
                  model.removeRow(row);
                  table.clearSelection();
                  table.repaint();
                  valueChanged(null);
              }
              // Check if the user pressed the remove all button
              if (e.getSource() == remove_all_button) {
                  model.clearAll();
                  table.setRowSelectionInterval(0,0);
                  table.repaint();
                  valueChanged(null);
              }
              // Check if the user pressed the filter button
              if (e.getSource() == filter_button) {
                  filter.showDialog();
                  if (filter.okPressed()) {
                      // Update the display with new filter
                      model.setFilter(filter);
                      table.repaint();
                  }
              }
              // Check if the user pressed the start button
              if (e.getSource() == start_button) {
                  start();
              }
              // Check if the user pressed the stop button
              if (e.getSource() == stop_button) {
                  stop();
              }
              // Check if the user wants to switch layout
              if (e.getSource() == layout_button) {
                  details_panel.remove(details_soap);
                  details_soap.removeAll();
                  if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
                      details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
                  } else {
                      details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
                  }
                  details_soap.setTopComponent(request_panel);
                  details_soap.setRightComponent(response_panel);
                  details_soap.setResizeWeight(.5);
                  details_panel.add(details_soap, BorderLayout.CENTER);
                  details_panel.validate();
                  details_panel.repaint();
              }
              // Check if the user is changing the reflow option
              if (e.getSource() == reflow_xml) {
                  request_text.setReflowXML(reflow_xml.isSelected());
                  response_text.setReflowXML(reflow_xml.isSelected());
              }
          }
      }
  
      /**
       * This class represend the data for a SOAP request/response pair
       */
      class SOAPMonitorData {
  
          /**
           * Private data
           */
          private Long    id;
          private String  time;
          private String  target;
          private String  soap_request;
          private String  soap_response;
  
          /**
           * Constructor
           */
          public SOAPMonitorData(Long id, String target, String soap_request) {
              this.id = id;
              // A null id is used to signal that the "most recent" entry
              // is being created.
              if (id == null) {
                  this.time = "Most Recent";
                  this.target = "---";
                  this.soap_request = null;
                  this.soap_response = null;
              } else {
                  this.time = DateFormat.getTimeInstance().format(new Date());
                  this.target = target;
                  this.soap_request = soap_request;
                  this.soap_response = null;
              }
          }
  
          /**
           * Get the id for the SOAP message
           */
          public Long getId() {
              return id;
          }
  
          /**
           * Get the time the SOAP request was received by the applet
           */
          public String getTime() {
              return time;
          }
  
          /**
           * Get the SOAP request target service name
           */
          public String getTargetService() {
              return target;
          }
  
          /**
           * Get the status of the request
           */
          public String getStatus() {
              String status = "---";
              if (id != null) {
                  status = "Complete";
                  if (soap_response == null) {
                      status = "Active";
                  }
              }
              return status;
          }
  
          /**
           * Get the request SOAP contents
           */
          public String getSOAPRequest() {
              return soap_request;
          }
  
          /**
           * Set the resposne SOAP contents
           */
          public void setSOAPResponse(String response) {
              soap_response = response;
          }
  
          /**
           * Get the response SOAP contents
           */
          public String getSOAPResponse() {
              return soap_response;
          }
      }
  
      /**
       * This table model is used to manage the table displayed
       * at the top of the page to show all the SOAP messages
       * we have received and to control which message details are
       * to be displayed on the bottom of the page.
       */
      class SOAPMonitorTableModel extends AbstractTableModel {
  
          /**
           * Column titles
           */
          private final String[] column_names = { "Time",
                                                  "Target Service",
                                                  "Status" };
          /**                                        
           * Private data
           */
          private Vector  data;
          private Vector  filter_include;
          private Vector  filter_exclude;
          private boolean filter_active;
          private boolean filter_complete;
          private Vector  filter_data;
  
          /**
           * Constructor
           */
          public SOAPMonitorTableModel() {
              data = new Vector();
              // Add "most recent" entry to top of table
              SOAPMonitorData soap = new SOAPMonitorData(null,null,null);
              data.addElement(soap);
              filter_include = null;
              filter_exclude = null;
              filter_active = false;
              filter_complete = false;
              filter_data = null;
              // By default, exclude NotificationService and
              // EventViewerService messages
              filter_exclude = new Vector();
              filter_exclude.addElement("NotificationService");
              filter_exclude.addElement("EventViewerService");
              filter_data = new Vector();
              filter_data.addElement(soap);
          }
  
          /**
           * Get column count (part of table model interface)
           */
          public int getColumnCount() {
              return column_names.length;
          }
          
          /**
           * Get row count (part of table model interface)
           */
          public int getRowCount() {
              int count = data.size();
              if (filter_data != null) {
                  count = filter_data.size();
              }
              return count;
          }
  
          /**
           * Get column name (part of table model interface)
           */
          public String getColumnName(int col) {
              return column_names[col];
          }
  
          /**
           * Get value at (part of table model interface)
           */
          public Object getValueAt(int row, int col) {
              SOAPMonitorData soap;
              String          value = null;
              soap = (SOAPMonitorData) data.elementAt(row);
              if (filter_data != null) {
                  soap = (SOAPMonitorData) filter_data.elementAt(row);
              }
              switch (col) {
                  case 0:
                      value = soap.getTime();
                      break;
                  case 1:
                      value = soap.getTargetService();
                      break;
                  case 2:
                      value = soap.getStatus();
                      break;
              }
              return value;
          }
  
          /**
           * Check if soap data matches filter 
           */
          public boolean filterMatch(SOAPMonitorData soap) {
              boolean match = true;
              if (filter_include != null) {
                  // Check for service match
                  Enumeration e = filter_include.elements();
                  match = false;
                  while (e.hasMoreElements() && !match) {
                      String service = (String) e.nextElement();
                      if (service.equals(soap.getTargetService())) {
                          match = true;
                      }
                  }
              }
              if (filter_exclude != null) {
                  // Check for service match
                  Enumeration e = filter_exclude.elements();
                  while (e.hasMoreElements() && match) {
                      String service = (String) e.nextElement();
                      if (service.equals(soap.getTargetService())) {
                          match = false;
                      }
                  }
              }
              if (filter_active) {
                  // Check for active status match
                  if (soap.getSOAPResponse() != null) {
                      match = false;
                  }
              }
              if (filter_complete) {
                  // Check for complete status match
                  if (soap.getSOAPResponse() == null) {
                      match = false;
                  }
              }
              // The "most recent" is always a match
              if (soap.getId() == null) {
                  match = true;
              }
              return match;
          }
  
          /**
           * Add data to the table as a new row
           */
          public void addData(SOAPMonitorData soap) {
              int row = data.size();
              data.addElement(soap);
              if (filter_data != null) {
                  if (filterMatch(soap)) {
                      row = filter_data.size();
                      filter_data.addElement(soap);
                      fireTableRowsInserted(row,row);
                  }
              } else {
                  fireTableRowsInserted(row,row);
              }
          }
  
          /**
           * Find the data for a given id
           */
          public SOAPMonitorData findData(Long id) {
              SOAPMonitorData soap = null;
              for (int row=data.size(); (row > 0) && (soap == null); row--) {
                  soap = (SOAPMonitorData) data.elementAt(row-1);
                  if (soap.getId().longValue() != id.longValue()) {
                      soap = null;
                  }
              }
              return soap;
          }
  
          /**
           * Find the row in the table for a given message id
           */
          public int findRow(SOAPMonitorData soap) {
              int row = -1;
              if (filter_data != null) {
                  row = filter_data.indexOf(soap);
              } else {
                  row = data.indexOf(soap);
              }
              return row;
          }
  
          /**
           * Remove all messages from the table (but leave "most recent")
           */
          public void clearAll() {
              int last_row = data.size() - 1;
              if (last_row > 0) {
                  data.removeAllElements();
                  SOAPMonitorData soap = new SOAPMonitorData(null,null,null);
                  data.addElement(soap);
                  if (filter_data != null) {
                      filter_data.removeAllElements();
                      filter_data.addElement(soap);
                  }
                  fireTableDataChanged();
              }
          }
  
          /**
           * Remove a message from the table
           */
          public void removeRow(int row) {
              SOAPMonitorData soap = null;
              if (filter_data == null) {
                  soap = (SOAPMonitorData) data.elementAt(row);
                  data.remove(soap);
              } else {
                  soap = (SOAPMonitorData) filter_data.elementAt(row);
                  filter_data.remove(soap);
                  data.remove(soap);
              }         
              fireTableRowsDeleted(row,row);
          }
  
          /**
           * Set a new filter
           */
          public void setFilter(SOAPMonitorFilter filter) {
              // Save new filter criteria
              filter_include = filter.getFilterIncludeList();
              filter_exclude = filter.getFilterExcludeList();
              filter_active = filter.getFilterActive();
              filter_complete = filter.getFilterComplete();
              applyFilter();
          }
  
          /**
           * Refilter the list of messages
           */
          public void applyFilter() {
              // Re-filter using new criteria
              filter_data = null;
              if ((filter_include != null) || 
                  (filter_exclude != null) ||
                   filter_active || filter_complete ) {
                  filter_data = new Vector();
                  Enumeration e = data.elements();
                  SOAPMonitorData soap;
                  while (e.hasMoreElements()) {
                      soap = (SOAPMonitorData) e.nextElement();
                      if (filterMatch(soap)) {
                          filter_data.addElement(soap);
                      }
                  }
              }
              fireTableDataChanged();
          }
  
          /**
           * Get the data for a row
           */
          public SOAPMonitorData getData(int row) {
              SOAPMonitorData soap = null;
              if (filter_data == null) {
                  soap = (SOAPMonitorData) data.elementAt(row);
              } else {
                  soap = (SOAPMonitorData) filter_data.elementAt(row);
              }
              return soap;
          }
  
          /**
           * Update a message
           */
          public void updateData (SOAPMonitorData soap) {
             int row;
             if (filter_data == null) {
                 // No filter, so just fire table updated
                 row = data.indexOf(soap);
                 if (row != -1) {
                     fireTableRowsUpdated(row,row);
                 }
             } else {
                 // Check if the row was being displayed
                 row = filter_data.indexOf(soap);
                 if (row == -1) {
                     // Row was not displayed, so check for if it
                     // now needs to be displayed
                     if (filterMatch(soap)) {
                         int index = -1;
                         row = data.indexOf(soap) + 1;
                         while ((row < data.size()) && (index == -1)) {
                             index = filter_data.indexOf(data.elementAt(row));
                             if (index != -1) {                   
                                 // Insert at this location
                                 filter_data.add(index,soap);
                             }
                             row++;
                         }
                         if (index == -1) {
                             // Insert at end
                             index = filter_data.size();
                             filter_data.addElement(soap);
                         }
                         fireTableRowsInserted(index,index);
                     }
                 } else {
                     // Row was displayed, so check if it needs to
                     // be updated or removed
                     if (filterMatch(soap)) {
                         fireTableRowsUpdated(row,row);
                     } else {
                         filter_data.remove(soap);
                         fireTableRowsDeleted(row,row);
                     }
                 }
             }
          }
  
      }
  
      /**
       * Panel with checkbox and list
       */
      class ServiceFilterPanel extends JPanel 
                               implements ActionListener,
                                          ListSelectionListener,
                                          DocumentListener {
  
          private JCheckBox    service_box = null;
          private Vector       filter_list = null;
          private Vector       service_data = null;
          private JList        service_list = null;
          private JScrollPane  service_scroll = null;
          private JButton      remove_service_button = null;
          private JPanel       remove_service_panel = null;
          private EmptyBorder  indent_border = null;
          private EmptyBorder  empty_border = null;
          private JPanel       service_area = null;
          private JPanel       add_service_area = null;
          private JTextField   add_service_field = null;
          private JButton      add_service_button = null;
          private JPanel       add_service_panel = null;
  
          /**
           * Constructor
           */
          public ServiceFilterPanel(String text, Vector list) {
              empty_border = new EmptyBorder(5,5,0,5);
              indent_border = new EmptyBorder(5,25,5,5);
              service_box = new JCheckBox(text);
              service_box.addActionListener(this);
              service_data = new Vector();
              if (list != null) {
                  service_box.setSelected(true);
                  service_data = (Vector) list.clone();
              }
              service_list = new JList(service_data);
              service_list.setBorder(new EtchedBorder());
              service_list.setVisibleRowCount(5);
              service_list.addListSelectionListener(this);
              service_list.setEnabled(service_box.isSelected());
              service_scroll = new JScrollPane(service_list);
              service_scroll.setBorder(new EtchedBorder());
              remove_service_button = new JButton("Remove");
              remove_service_button.addActionListener(this);
              remove_service_button.setEnabled(false);
              remove_service_panel = new JPanel();
              remove_service_panel.setLayout(new FlowLayout());
              remove_service_panel.add(remove_service_button);
              service_area = new JPanel();
              service_area.setLayout(new BorderLayout());
              service_area.add(service_scroll, BorderLayout.CENTER);
              service_area.add(remove_service_panel, BorderLayout.EAST);
              service_area.setBorder(indent_border);
              add_service_field = new JTextField();
              add_service_field.addActionListener(this);
              add_service_field.getDocument().addDocumentListener(this);
              add_service_field.setEnabled(service_box.isSelected());
              add_service_button = new JButton("Add");
              add_service_button.addActionListener(this);
              add_service_button.setEnabled(false);
              add_service_panel = new JPanel();
              add_service_panel.setLayout(new BorderLayout());
              JPanel dummy = new JPanel();
              dummy.setBorder(empty_border);
              add_service_panel.add(dummy, BorderLayout.WEST);
              add_service_panel.add(add_service_button, BorderLayout.EAST);
              add_service_area = new JPanel();
              add_service_area.setLayout(new BorderLayout());
              add_service_area.add(add_service_field, BorderLayout.CENTER);
              add_service_area.add(add_service_panel, BorderLayout.EAST);
              add_service_area.setBorder(indent_border);
              setLayout(new BorderLayout());
              add(service_box, BorderLayout.NORTH);
              add(service_area, BorderLayout.CENTER);
              add(add_service_area, BorderLayout.SOUTH);
              setBorder(empty_border);
          }
  
          /**
           * Get the current list of services
           */
          public Vector getServiceList() {
              Vector list = null;
              if (service_box.isSelected()) {
                  list = service_data;
              }
              return list;
          }
  
          /**
           * Listener to handle button actions
           */
          public void actionPerformed(ActionEvent e) {
              // Check if the user changed the service filter option
              if (e.getSource() == service_box) {
                  service_list.setEnabled(service_box.isSelected());
                  service_list.clearSelection();
                  remove_service_button.setEnabled(false);
                  add_service_field.setEnabled(service_box.isSelected());
                  add_service_field.setText("");
                  add_service_button.setEnabled(false);
              }
              // Check if the user pressed the add service button
              if ((e.getSource() == add_service_button) ||
                  (e.getSource() == add_service_field)) {
                  String text = add_service_field.getText();
                  if ((text != null) && (text.length() > 0)) {
                      service_data.addElement(text);
                      service_list.setListData(service_data);
                  }
                  add_service_field.setText("");
                  add_service_field.requestFocus();
              }
              // Check if the user pressed the remove service button
              if (e.getSource() == remove_service_button) {
                  Object[] sels = service_list.getSelectedValues();
                  for (int i=0; i<sels.length; i++) {
                      service_data.removeElement(sels[i]);
                  }
                  service_list.setListData(service_data);
                  service_list.clearSelection();
              }
          }
  
          /**
           * Handle changes to the text field
           */
          public void changedUpdate(DocumentEvent e) {
              String text = add_service_field.getText();
              if ((text != null) && (text.length() > 0)) {
                  add_service_button.setEnabled(true);
              } else {
                  add_service_button.setEnabled(false);
              }
          }
  
          /**
           * Handle changes to the text field
           */
          public void insertUpdate(DocumentEvent e) {
              changedUpdate(e);
          }
  
          /**
           * Handle changes to the text field
           */
          public void removeUpdate(DocumentEvent e) {
              changedUpdate(e);
          }
  
          /**
           * Listener to handle service list selection changes
           */
          public void valueChanged(ListSelectionEvent e) {
              if (service_list.getSelectedIndex() == -1) {
                  remove_service_button.setEnabled(false);
              } else {
                  remove_service_button.setEnabled(true);
              }
          }
      }
  
      /**
       * Class for showing the filter dialog
       */
      class SOAPMonitorFilter implements ActionListener {
  
          /**
           * Private data
           */
          private JDialog            dialog = null;
          private JPanel             panel = null;
          private JPanel             buttons = null;
          private JButton            ok_button = null;
          private JButton            cancel_button = null;
          private ServiceFilterPanel include_panel = null;
          private ServiceFilterPanel exclude_panel = null;
          private JPanel             status_panel = null;
          private JCheckBox          status_box = null;
          private EmptyBorder  empty_border = null;
          private EmptyBorder  indent_border = null;
          private JPanel             status_options = null;
          private ButtonGroup        status_group = null;
          private JRadioButton       status_active = null;
          private JRadioButton       status_complete = null;
          private Vector             filter_include_list = null;
          private Vector             filter_exclude_list = null;
          private boolean            filter_active = false;
          private boolean            filter_complete = false;
          private boolean            ok_pressed = false;
  
          /**
           * Constructor
           */
          public SOAPMonitorFilter() {
              // By default, exclude NotificationService and
              // EventViewerService messages
              filter_exclude_list = new Vector();
              filter_exclude_list.addElement("NotificationService");
              filter_exclude_list.addElement("EventViewerService");
          }
  
          /**
           * Get list of services to be included
           */
          public Vector getFilterIncludeList() {
              return filter_include_list;
          }
  
          /**
           * Get list of services to be excluded
           */
          public Vector getFilterExcludeList() {
              return filter_exclude_list;
          }
  
          /**
           * Check if filter active messages
           */
          public boolean getFilterActive() {
              return filter_active;
          }
  
          /**
           * Check if filter complete messages
           */
          public boolean getFilterComplete() {
              return filter_complete;
          }
  
          /**
           * Show the filter dialog
           */
          public void showDialog() {
              empty_border = new EmptyBorder(5,5,0,5);
              indent_border = new EmptyBorder(5,25,5,5);
              include_panel = new ServiceFilterPanel("Include messages based on target service:",
                                                     filter_include_list);
              exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:",
                                                     filter_exclude_list);
              status_box = new JCheckBox("Filter messages based on status:");
              status_box.addActionListener(this);
              status_active = new JRadioButton("Active messages only");
              status_active.setSelected(true);
              status_active.setEnabled(false);
              status_complete = new JRadioButton("Complete messages only");
              status_complete.setEnabled(false);
              status_group = new ButtonGroup();
              status_group.add(status_active);
              status_group.add(status_complete);
              if (filter_active || filter_complete) {
                  status_box.setSelected(true);
                  status_active.setEnabled(true);
                  status_complete.setEnabled(true);
                  if (filter_complete) {
                      status_complete.setSelected(true);
                  }
              }
              status_options = new JPanel();
              status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
              status_options.add(status_active);
              status_options.add(status_complete);
              status_options.setBorder(indent_border);
              status_panel = new JPanel();
              status_panel.setLayout(new BorderLayout());
              status_panel.add(status_box, BorderLayout.NORTH);
              status_panel.add(status_options, BorderLayout.CENTER);
              status_panel.setBorder(empty_border);
              ok_button = new JButton("Ok");
              ok_button.addActionListener(this);
              cancel_button = new JButton("Cancel");
              cancel_button.addActionListener(this);
              buttons = new JPanel();
              buttons.setLayout(new FlowLayout());
              buttons.add(ok_button);
              buttons.add(cancel_button);
              panel = new JPanel();
              panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
              panel.add(include_panel);
              panel.add(exclude_panel);
              panel.add(status_panel);
              panel.add(buttons);
              dialog = new JDialog();
              dialog.setTitle("SOAP Monitor Filter");
              dialog.setContentPane(panel);
              dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              dialog.setModal(true);
              dialog.pack();
              Dimension d = dialog.getToolkit().getScreenSize();
              dialog.setLocation((d.width-dialog.getWidth())/2,
                                 (d.height-dialog.getHeight())/2);
              ok_pressed = false;
              dialog.show();
          }
  
          /**
           * Listener to handle button actions
           */
          public void actionPerformed(ActionEvent e) {
              // Check if the user pressed the ok button
              if (e.getSource() == ok_button) {
                  filter_include_list = include_panel.getServiceList();
                  filter_exclude_list = exclude_panel.getServiceList();
                  if (status_box.isSelected()) {
                      filter_active = status_active.isSelected();
                      filter_complete = status_complete.isSelected();
                  } else {
                      filter_active = false;
                      filter_complete = false;
                  }
                  ok_pressed = true;
                  dialog.dispose();
              }
              // Check if the user pressed the cancel button
              if (e.getSource() == cancel_button) {
                  dialog.dispose();
              }
              // Check if the user changed the status filter option
              if (e.getSource() == status_box) {
                  status_active.setEnabled(status_box.isSelected());
                  status_complete.setEnabled(status_box.isSelected());
              }
          }
  
          /**
           * Check if the user pressed the ok button
           */
          public boolean okPressed() {
              return ok_pressed;
          }
      }
  
      /**
       * Text panel class that supports XML reflow
       */
      class SOAPMonitorTextArea extends JTextArea {
  
          /**
           * Private data
           */
          private boolean format = false;
          private String  original = "";
          private String  formatted = null; 
  
          /**
           * Constructor
           */
          public SOAPMonitorTextArea() {
          }
  
          /** 
           * Override setText to do formatting
           */
          public void setText(String text) {
              original = text;
              formatted = null;
              if (format) {
                  doFormat();
                  super.setText(formatted);
              } else {
                  super.setText(original);
              }
          }
  
          /**
           * Turn reflow on or off
           */
          public void setReflowXML(boolean reflow) {
              format = reflow;
              if (format) {
                  if (formatted == null) {
                      doFormat();
                  }
                  super.setText(formatted);
              } else {
                  super.setText(original);
              }
          }
  
          /**
           * Reflow XML
           */
          public void doFormat() {
              Vector       parts = new Vector();
              char[]       chars = original.toCharArray();
              int          index = 0;
              int          first = 0;
              String       part = null;
              while (index < chars.length) {
                  // Check for start of tag
                  if (chars[index] == '<') {
                      // Did we have data before this tag?
                      if (first < index) {
                          part = new String(chars,first,index-first);
                          part = part.trim();
                          // Save non-whitespace data
                          if (part.length() > 0) {
                              parts.addElement(part);
                          }
                      }
                      // Save the start of tag
                      first = index;
                  }
                  // Check for end of tag
                  if (chars[index] == '>') {
                      // Save the tag
                      part = new String(chars,first,index-first+1);
                      parts.addElement(part);
                      first = index+1;
                  }
                  // Check for end of line
                  if ((chars[index] == '\n') || (chars[index] == '\r')) {
                      // Was there data on this line?
                      if (first < index) {
                          part = new String(chars,first,index-first);
                          part = part.trim();
                          // Save non-whitespace data
                          if (part.length() > 0) {
                              parts.addElement(part);
                          }
                      }
                      first = index+1;
                  }
                  index++;
              }
              // Reflow as XML
              StringBuffer buf = new StringBuffer();
              Object[] list = parts.toArray();
              int indent = 0;
              int pad = 0;
              index = 0;
              while (index < list.length) {
                  part = (String) list[index];
                  if (buf.length() == 0) {
                      // Just add first tag (should be XML header)
                      buf.append(part);
                  } else {
                      // All other parts need to start on a new line
                      buf.append('\n');
                      // If we're at an end tag then decrease indent
                      if (part.startsWith("</")) {
                          indent--;
                      }            
                      // Add any indent
                      for (pad = 0; pad < indent; pad++) {
                          buf.append("  ");
                      }
                      // Add the tag or data
                      buf.append(part);
                      // If this is a start tag then increase indent
                      if (part.startsWith("<") &&
                          !part.startsWith("</") &&
                          !part.endsWith("/>")) {
                          indent++;
                          // Check for special <tag>data</tag> case
                          if ((index + 2) < list.length) {
                              part = (String) list[index+2];
                              if (part.startsWith("</")) {
                                  part = (String) list[index+1];
                                  if (!part.startsWith("<")) {
                                      buf.append(part);
                                      part = (String) list[index+2];
                                      buf.append(part);
                                      index = index + 2;
                                      indent--;
                                  }
                              }
                          }
                      }
                  }
                  index++;
              }
              formatted = new String(buf);
          }
      }
  }
  
  
  
  1.1                  ws-fx/wss4j/webapps/axis/StockQuoteService.jws
  
  Index: StockQuoteService.jws
  ===================================================================
  /*
   * Copyright 2001,2004 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.
   */
  
  import org.apache.axis.utils.XMLUtils;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.NodeList;
  
  /**
   * See \samples\stock\readme for info.
   *
   * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class StockQuoteService {
    public float getQuote (String symbol) throws Exception {
      // get a real (delayed by 20min) stockquote from 
      // http://www.xmltoday.com/examples/stockquote/. The IP addr 
      // below came from the host that the above form posts to ..
  
      if ( symbol.equals("XXX") ) return( (float) 66.25 );
  
  
      Document doc = null ;
      
      doc = XMLUtils.newDocument( "http://www.xmltoday.com/examples/" +
                                  "stockquote/getxmlquote.vep?s="+symbol );
  
      Element  elem = doc.getDocumentElement();
      NodeList list = elem.getElementsByTagName("stock_quote");
  
      elem = (Element) list.item(0);
      list = elem.getElementsByTagName( "price" );
      elem = (Element) list.item( 0 );
      String quoteStr = elem.getAttribute("value");
      try {
        return Float.valueOf(quoteStr).floatValue();
      } catch (NumberFormatException e1) {
        // maybe its an int?
        try {
          return Integer.valueOf(quoteStr).intValue() * 1.0F;
        } catch (NumberFormatException e2) {
          return -1.0F;
        }
      }
    }
  }
  
  
  
  1.1                  ws-fx/wss4j/webapps/axis/wss4j.html
  
  Index: wss4j.html
  ===================================================================
  <html>
  <head><title>WSS4J Interop Client</title></head>
  <body>
  <big><strong>WSS4J Interop Client</strong></big><p>
  If you have problems using this self-help page. Please send an email to <A href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  <p/>
  <dl>
  <dt><strong>Interop Scenario 1</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="1">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 1'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 2</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="2">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 2'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 3</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="3">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 3'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 4</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="4">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 4'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 5</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="5">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 5'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 6</strong></dt>
  
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="6">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 6'></td></tr>
  </form></table></dd>
  <dt><strong>Interop Scenario 7</strong></dt>
  <dd><table border='0'><form method='POST' action='wss4j2.jsp'><INPUT NAME="scenario" TYPE=HIDDEN VALUE="7">
  <tr><td colspan='2'>URL: <input type='text' size='64' name='url' value='http://' /></td></tr>
  <tr><td>&nbsp;</td><td align='right'><input type='submit' value='Interop 7'></td></tr>
  </form></table></dd>
  </dl>
  <p/>        <font size="-1">
  
           <em>Copyright &#169; 1999-2004, The Apache Software Foundation</em>
          </font>
  
  </body>
  </html>
  
  
  1.1                  ws-fx/wss4j/webapps/axis/wss4j2.jsp
  
  Index: wss4j2.jsp
  ===================================================================
  <html>
  <%@ page language="java" import="org.apache.ws.axis.oasis.ping.*, javax.xml.rpc.holders.StringHolder" %>
  
  <% 
  	String url = request.getParameter ("url");
  	String scenario = request.getParameter ("scenario").trim();
  %>
  <head><title>WSS4J Interop Scenario <%= scenario %> Results</title></head>
  <body>
  <big><strong>WSS4J Interop Scenario <%= scenario %> Results</strong></big><p>
  <strong>Server URL:</strong> <%= url %><p>
  
  <%
          PingServiceLocator service = new PingServiceLocator();
          java.net.URL endpoint = new java.net.URL(url);
          PingPort port = null;
          if(scenario.equals("1"))
               port = (PingPort) service.getPing1(endpoint);
          else if(scenario.equals("2"))
               port = (PingPort) service.getPing2(endpoint);
          else if(scenario.equals("3"))
               port = (PingPort) service.getPing3(endpoint);
          else if(scenario.equals("4"))
               port = (PingPort) service.getPing4(endpoint);
          else if(scenario.equals("5"))
               port = (PingPort) service.getPing5(endpoint);
          else if(scenario.equals("6"))
               port = (PingPort) service.getPing6(endpoint);
          else if(scenario.equals("7"))
               port = (PingPort) service.getPing7(endpoint);
  
          StringHolder text =
                  new StringHolder("WSS4J - Scenario " + scenario + " @ [" + new java.util.Date(System.currentTimeMillis()) + "]");
  %>
  <strong>Request:</strong> <%= text.value %><p>
  
  <%
  
          port.ping(new org.apache.ws.axis.oasis.ping.TicketType("WSS4J" + scenario), text);
          System.out.println(text.value);
  
  %>
  <strong>Response:</strong> <%= text.value %><p>
  
  <p/>
  <font size="-1">
  <A HREF="wss4j.html">Go Back</A>
  </font>
  <p/>        <font size="-1">
  
           <em>Copyright &#169; 1999-2004, The Apache Software Foundation</em>
          </font>
  
  
  </body>
  </html>
  
  
  1.1                  ws-fx/wss4j/webapps/axis/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
  Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
  
  <web-app>
    <display-name>Apache-Axis</display-name>
      
      <listener>
          <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
      </listener>
      
    <servlet>
      <servlet-name>AxisServlet</servlet-name>
      <display-name>Apache-Axis Servlet</display-name>
      <servlet-class>
          org.apache.axis.transport.http.AxisServlet
      </servlet-class>
    </servlet>
  
    <servlet>
      <servlet-name>AdminServlet</servlet-name>
      <display-name>Axis Admin Servlet</display-name>
      <servlet-class>
          org.apache.axis.transport.http.AdminServlet
      </servlet-class>
      <load-on-startup>100</load-on-startup>
    </servlet>
  
    <servlet>
      <servlet-name>SOAPMonitorService</servlet-name>
      <display-name>SOAPMonitorService</display-name>
      <servlet-class>
          org.apache.axis.monitor.SOAPMonitorService
      </servlet-class>
      <init-param>
        <param-name>SOAPMonitorPort</param-name>
        <param-value>5001</param-value>
      </init-param>
      <load-on-startup>100</load-on-startup>
    </servlet>
  
    <servlet-mapping>
      <servlet-name>AxisServlet</servlet-name>
      <url-pattern>/servlet/AxisServlet</url-pattern>
    </servlet-mapping>
  
    <servlet-mapping>
      <servlet-name>AxisServlet</servlet-name>
      <url-pattern>*.jws</url-pattern>
    </servlet-mapping>
  
    <servlet-mapping>
      <servlet-name>AxisServlet</servlet-name>
      <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
  
    <servlet-mapping>
      <servlet-name>SOAPMonitorService</servlet-name>
      <url-pattern>/SOAPMonitor</url-pattern>
    </servlet-mapping>
  
   <!-- uncomment this if you want the admin servlet -->
   <!--
    <servlet-mapping>
      <servlet-name>AdminServlet</servlet-name>
      <url-pattern>/servlet/AdminServlet</url-pattern>
    </servlet-mapping>
   -->
  
      <session-config>
          <!-- Default to 5 minute session timeouts -->
          <session-timeout>5</session-timeout>
      </session-config>
  
      <!-- currently the W3C havent settled on a media type for WSDL;
      http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
      for now we go with the basic 'it's XML' response -->
    <mime-mapping>
      <extension>wsdl</extension>
       <mime-type>text/xml</mime-type>
    </mime-mapping>
    
  
    <mime-mapping>
      <extension>xsd</extension>
      <mime-type>text/xml</mime-type>
    </mime-mapping>
  
    <welcome-file-list id="WelcomeFileList">
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.jws</welcome-file>
    </welcome-file-list>
  
  </web-app>