xml-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Noel Gadreau <jngadr...@activcard.com>
Subject SOAPEngine / EnvelopeProcessors - First implementation
Date Wed, 09 Aug 2000 21:15:34 GMT
Hi all.

As I mentioned in some previous e-mails, I have been working on adding the
concept of "SOAPEngine" and "EnvelopeProcessors" to the current
implementation of Apache-SOAP. I got to the point where it compiles and
kinda runs (the stock quote example), so I though I would send it to you so
you can have a look and give some feedback. The code is still incomplete but
that's a start.

I tried to split all the different phases of the processing of the SOAP
request into several pieces (HTTP stuff, parsing, processing of the command,
RPC call, ...). There are the following classes:
- SOAPEngine: Is the "core" that contains the different main modules
(SOAPEnvelopeParser, main EnvelopeProcessor and SOAPEnvelopeWriter )

- SOAPEnvelopeParser: just handles the parsing of the request (basically
does the equivalent of Envelope.unmarshall)

- SOAPEnvelopeWriter: Knows how to write an envelope

- EnvelopeProcessor: Processes an envelope and possibly returns the response
envelope

- RPCCallEnvelopeProcessor: Contains all the processing tied to the RPC part
of the RPCRouterServlet

- SOAPEngineServlet: Servlet (similar to the RPCRouterServlet) that uses the
SOAPEngine

- EnvelopeContext: Context relative to the processing of an Envelope (used
by EnvelopeProcessors)


My primary concern was to changes as little as possible in the existing SOAP
implementation so some of the changes are really that clean :-) I wanted to
get the EnvelopeProcessor stuff in so that people can use them and
experiment.

Here is a quick description of the changes:
* Added 'SOAPEnvelopeParser' to avoid using static method
'Envelope.unmarshall' and have more flexibility on Envelope creation. To do
that, I had to change 'AttributeHandler' as public :-( and add
'setAttributeHandler' on Envelope, Body and Header. I don't like that and I
think this should be just temporary.

* Added 'SOAPEngineServlet' by taking looking at 'RPCRouterServlet'. I did
not change directly the RPCRouterServlet but if people want it, we can
merge. Here, I tried to split most of the code and removed everything that
was RPC related (this code is in the RPCCallEnvelopeProcessor). I wrote a
lot of protected methods that can be overriden for custom behavior.

* Added 'SOAPEngine', 'EnvelopeContext', 'EnvelopeProcessor' which are the
"core" classes

* Added 'RPCCallEnvelopeProcessor' that contains only the RPC part of the
rpcrouter.jsp. Note that it gets all the request/session/application using
the context that was set by the SOAPEngineServlet.


Attached are the files that I have added (my web site is down for the
moment, so I apologize for putting this in the e-mail) and a diff of the
changes to the existing files (I also put them in the jar of the sources in
case you don't like 'diff').

You will see that missing stuff or issues is marked with 'TODO'.
Furthermore, I have noticed a bug: when you first call 'GetQuote', the
server will get stuck in the RPCCallEnvelopeProcessor on the
"request.getSession()". The second time, it works fine. I guess there is a
deadlock somewhere. If you have an idea, let me know...

Let me know what you think about it...

Jean-Noel


here is the diff:

Index: src/org/apache/soap/AttributeHandler.java
===================================================================
RCS file:
/home/cvspublic/xml-soap/java/src/org/apache/soap/AttributeHandler.java,v
retrieving revision 1.2
diff -u -r1.2 AttributeHandler.java
--- src/org/apache/soap/AttributeHandler.java	2000/05/30 10:23:50	1.2
+++ src/org/apache/soap/AttributeHandler.java	2000/08/09 20:37:04
@@ -68,7 +68,7 @@
  *
  * @author Matthew J. Duftler (duftler@us.ibm.com)
  */
-class AttributeHandler
+public class AttributeHandler
 {
   private Hashtable attributes             = new Hashtable();
   private Hashtable namespaceURIs2Prefixes = new Hashtable();
Index: src/org/apache/soap/Body.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/Body.java,v
retrieving revision 1.2
diff -u -r1.2 Body.java
--- src/org/apache/soap/Body.java	2000/05/30 10:23:50	1.2
+++ src/org/apache/soap/Body.java	2000/08/09 20:37:04
@@ -75,6 +75,11 @@
 {
   private Vector           bodyEntries = null;
   private AttributeHandler attrHandler = new AttributeHandler();
+  
+  public void setAttributeHandler(AttributeHandler attrHandler)
+  {
+      this.attrHandler = attrHandler;
+  }
 
   public void setAttribute(QName attrQName, String value)
   {
Index: src/org/apache/soap/Envelope.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/Envelope.java,v
retrieving revision 1.2
diff -u -r1.2 Envelope.java
--- src/org/apache/soap/Envelope.java	2000/05/30 10:23:50	1.2
+++ src/org/apache/soap/Envelope.java	2000/08/09 20:37:04
@@ -93,6 +93,11 @@
                      Constants.NS_URI_SCHEMA_XSD);
   }
 
+  public void setAttributeHandler(AttributeHandler attrHandler)
+  {
+      this.attrHandler = attrHandler;
+  }
+
   public void setAttribute(QName attrQName, String value)
   {
     attrHandler.setAttribute(attrQName, value);
Index: src/org/apache/soap/Header.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/Header.java,v
retrieving revision 1.2
diff -u -r1.2 Header.java
--- src/org/apache/soap/Header.java	2000/05/30 10:23:51	1.2
+++ src/org/apache/soap/Header.java	2000/08/09 20:37:04
@@ -76,6 +76,11 @@
   private Vector           headerEntries = null;
   private AttributeHandler attrHandler   = new AttributeHandler();
 
+  public void setAttributeHandler(AttributeHandler attrHandler)
+  {
+      this.attrHandler = attrHandler;
+  }
+
   public void setAttribute(QName attrQName, String value)
   {
     attrHandler.setAttribute(attrQName, value);


=============
Jean-Noel GADREAU
Software Engineer, ActivCard Inc.(http://www.activcard.com )
E-mail: jngadreau@activcard.com
Tel (main): 510-574-0100
Tel (direct): 510-574-1736


Mime
View raw message