You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/09/24 22:45:20 UTC

cvs commit: xml-axis/java/test/wsdl/sequence SequenceService.java

gdaniels    2002/09/24 13:45:20

  Modified:    java/samples/message MessageService.java
               java/src/org/apache/axis MessageContext.java
               java/src/org/apache/axis/description OperationDesc.java
                        ServiceDesc.java
               java/src/org/apache/axis/i18n resource.properties
               java/src/org/apache/axis/message BodyBuilder.java
               java/src/org/apache/axis/providers/java MsgProvider.java
               java/src/org/apache/axis/utils Admin.java
               java/test/wsdl/sequence SequenceService.java
  Added:       java/test/MSGDispatch PackageTests.java
                        TestMessageService.java TestService.java
  Log:
  * Fix bug http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12923
  
  * We now dispatch to methods for MsgProvider services based on
    the QName of the first body element.  If you've specified an
    OperationDesc for your method, the QName in there will be used
    for dispatch, otherwise we'll use the namespace of the service
    and look up the localPart of the XML QName as the method name.
    If you don't specify a <namespace> for your service (in the
    WSDD), we'll match just on local name.  (NOTE: I disagree with
    this, because I think it's not precise enough for the XML world.
    We'll need to produce schemas for this stuff eventually, and
    mapping random namespaces seems dangerously lax to me.
    However, it was the way it used to work, and there was agitation
    to keep it this way, so I did.)
  
  * Rationalize MsgProvider's accepted signatures.  We now accept:
    SOAPBodyElement [] method(SOAPBodyElement [])
    Element [] method(Element [])
    void method(SOAPEnvelope reqest, SOAPEnvelope response)
  
    A nice side effect of this is that we only introspect once (in
    ServiceDesc), not on every call in MsgProvider as we used to.
  
  * Add tests to confirm that we can dispatch to multiple methods,
    and that each of the valid signatures works as expected.
  
  Revision  Changes    Path
  1.3       +4 -6      xml-axis/java/samples/message/MessageService.java
  
  Index: MessageService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/message/MessageService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MessageService.java	23 Apr 2002 16:25:38 -0000	1.2
  +++ MessageService.java	24 Sep 2002 20:45:19 -0000	1.3
  @@ -1,15 +1,13 @@
   package samples.message ;
   
   import org.w3c.dom.Element ;
  -import org.apache.axis.MessageContext ;
  -import java.util.Vector ;
   
   public class MessageService {
  -    public Element[] echoElements(Vector elems) {
  -        Element[]  result = new Element[elems.size()];
  +    public Element[] echoElements(Element [] elems) {
  +        Element[]  result = new Element[elems.length];
   
  -        for ( int i = 0 ; i < elems.size() ; i++ )
  -            result[i] = (Element) elems.get(i);
  +        for ( int i = 0 ; i < elems.length ; i++ )
  +            result[i] = (Element) elems[i];
           
           return( result );
       }
  
  
  
  1.123     +1 -15     xml-axis/java/src/org/apache/axis/MessageContext.java
  
  Index: MessageContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- MessageContext.java	18 Sep 2002 16:10:31 -0000	1.122
  +++ MessageContext.java	24 Sep 2002 20:45:19 -0000	1.123
  @@ -64,7 +64,6 @@
   import org.apache.axis.enum.Style;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.session.Session;
  -import org.apache.axis.soap.SOAP11Constants;
   import org.apache.axis.soap.SOAPConstants;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.LockableHashtable;
  @@ -79,7 +78,6 @@
   import javax.xml.rpc.handler.soap.SOAPMessageContext;
   import java.io.File;
   import java.util.Hashtable;
  -import java.util.List;
   
   /**
    * Some more general docs will go here.
  @@ -629,19 +627,7 @@
               // new service.
               highFidelity = service.needsHighFidelityRecording();
   
  -            ServiceDesc sd = service.getInitializedServiceDesc(this);
  -
  -            if (service.getStyle() == Style.MESSAGE) {
  -                // There should be only one operation
  -                List ops = sd.getOperations();
  -                if (ops.size() != 1) {
  -                    throw new AxisFault(
  -                            Messages.getMessage("onlyOneMessageOp",
  -                                                 targetService,
  -                                                 ""+ops.size()));
  -                }
  -                this.currentOperation = (OperationDesc)ops.get(0);
  -            }
  +            service.getInitializedServiceDesc(this);
           }
       }
   
  
  
  
  1.20      +20 -0     xml-axis/java/src/org/apache/axis/description/OperationDesc.java
  
  Index: OperationDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/OperationDesc.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- OperationDesc.java	3 Aug 2002 21:25:24 -0000	1.19
  +++ OperationDesc.java	24 Sep 2002 20:45:19 -0000	1.20
  @@ -73,6 +73,15 @@
    * @author Glen Daniels (gdaniels@apache.org)
    */
   public class OperationDesc {
  +    // Constants for "message style" operation patterns.  If this OperationDesc
  +    // is message style, the Java method will have one of these signatures:
  +
  +    // public SOAPBodyElement [] method(SOAPBodyElement [])
  +    public static final int MSG_METHOD_BODYARRAY = 1;
  +    // public SOAPEnvelope method(SOAPEnvelope)
  +    public static final int MSG_METHOD_SOAPENVELOPE = 2;
  +    // public Element [] method(Element [])
  +    public static final int MSG_METHOD_ELEMENTARRAY = 3;
   
       protected static Log log =
           LogFactory.getLog(OperationDesc.class.getName());
  @@ -106,6 +115,9 @@
   
       private ParameterDesc returnDesc = new ParameterDesc();
   
  +    /** If we're a message-style operation, what's our signature? */
  +    private int messageOperationStyle = -1;
  +
       /**
        * Default constructor.
        */
  @@ -367,6 +379,14 @@
               }
           }
           return text;
  +    }
  +
  +    public int getMessageOperationStyle() {
  +        return messageOperationStyle;
  +    }
  +
  +    public void setMessageOperationStyle(int messageOperationStyle) {
  +        this.messageOperationStyle = messageOperationStyle;
       }
   }
   
  
  
  
  1.59      +98 -45    xml-axis/java/src/org/apache/axis/description/ServiceDesc.java
  
  Index: ServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- ServiceDesc.java	22 Sep 2002 06:13:42 -0000	1.58
  +++ ServiceDesc.java	24 Sep 2002 20:45:19 -0000	1.59
  @@ -56,6 +56,8 @@
   
   import org.apache.axis.AxisServiceConfig;
   import org.apache.axis.InternalException;
  +import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.message.SOAPBodyElement;
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.encoding.DefaultTypeMappingImpl;
   import org.apache.axis.encoding.TypeMapping;
  @@ -67,6 +69,8 @@
   import org.apache.axis.utils.bytecode.ParamNameExtractor;
   import org.apache.axis.wsdl.Skeleton;
   import org.apache.commons.logging.Log;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   import javax.xml.namespace.QName;
   import javax.xml.rpc.holders.Holder;
  @@ -155,6 +159,7 @@
       private HashMap qname2OperationsMap = null;
       private HashMap method2OperationMap = new HashMap();
       private HashMap method2ParamsMap = new HashMap();
  +    private OperationDesc messageServiceDefaultOp = null;
   
       /** Method names for which we have completed any introspection necessary */
       private ArrayList completedNames = new ArrayList();
  @@ -417,30 +422,25 @@
        */
       public OperationDesc [] getOperationsByQName(QName qname)
       {
  -        // If we're MESSAGE style, we should only have a single operation,
  -        // to which we'll pass any XML we receive.
  -        if (style == Style.MESSAGE) {
  -            if (!introspectionComplete) {
  -                loadServiceDescByIntrospection();
  -            }
  -            if (operations.size() > 0)
  -                return new OperationDesc [] { (OperationDesc)operations.get(0) };
  -
  -            return null;
  -        }
  +        // Look in our mapping of QNames -> operations.
   
  -        // If we're DOCUMENT style, we look in our mapping of QNames ->
  -        // operations instead.  But first, let's make sure we've initialized
  -        // said mapping....
  +        // But first, let's make sure we've initialized said mapping....
           initQNameMap();
   
           ArrayList overloads = (ArrayList)qname2OperationsMap.get(qname);
   
           if (overloads == null) {
  +            // Nothing specifically matching this QName.
               if ((style == Style.RPC) && (name2OperationsMap != null)) {
                   // Try ignoring the namespace....?
                   overloads = (ArrayList)name2OperationsMap.get(qname.getLocalPart());
               }
  +
  +            // Handle the case where a single Message-style operation wants
  +            // to accept anything.
  +            if ((style == Style.MESSAGE) && (messageServiceDefaultOp != null))
  +                return new OperationDesc [] { messageServiceDefaultOp };
  +
               if (overloads == null)
                   return null;
           }
  @@ -573,6 +573,15 @@
               Method method = methods[i];
               if (Modifier.isPublic(method.getModifiers()) &&
                       method.getName().equals(oper.getName())) {
  +
  +                if (style == Style.MESSAGE) {
  +                    int messageOperType = checkMessageMethod(method);
  +                    if (messageOperType == -1) {
  +                        throw new InternalException("Couldn't match method to any of the allowable message-style patterns!");
  +                    }
  +                    oper.setMessageOperationStyle(messageOperType);
  +                }
  +
                   // Check params
                   Class [] paramTypes = method.getParameterTypes();
                   if (paramTypes.length != oper.getNumParams())
  @@ -663,6 +672,33 @@
           }
       }
   
  +    private int checkMessageMethod(Method method) {
  +        // Collect the types so we know what we're dealing with in the target
  +        // method.
  +        Class [] params = method.getParameterTypes();
  +
  +        if (params.length == 1) {
  +            if ((params[0] == Element[].class) &&
  +                    (method.getReturnType() == Element[].class)) {
  +                return OperationDesc.MSG_METHOD_ELEMENTARRAY;
  +            }
  +
  +            if ((params[0] == SOAPBodyElement[].class) &&
  +                    (method.getReturnType() == SOAPBodyElement[].class)) {
  +                return OperationDesc.MSG_METHOD_BODYARRAY;
  +            }
  +        } else if (params.length == 2) {
  +            if ((params[0] == SOAPEnvelope.class) &&
  +                    (params[1] == SOAPEnvelope.class) &&
  +                    (method.getReturnType() == void.class)) {
  +                return OperationDesc.MSG_METHOD_SOAPENVELOPE;
  +            }
  +        }
  +
  +        throw new InternalException (Messages.getMessage("badMsgMethodParams",
  +                                                         method.getName()));
  +    }
  +
       /**
        * Fill in a service description by introspecting the implementation
        * class.
  @@ -720,7 +756,7 @@
           }
   
           loadServiceDescByIntrospectionRecursive(implClass);
  -        
  +
           // All operations should now be synchronized.  Check it.
           for (Iterator iterator = operations.iterator(); iterator.hasNext();) {
               OperationDesc operation = (OperationDesc) iterator.next();
  @@ -731,7 +767,11 @@
                                               "" + operation.getNumParams()));
               }
           }
  -        
  +
  +        if ((style == Style.MESSAGE) && operations.size() == 1) {
  +            messageServiceDefaultOp = (OperationDesc)operations.get(0);
  +        }
  +
           introspectionComplete = true;
       }
   
  @@ -968,36 +1008,49 @@
           }
           operation.setElementQName(new QName(defaultNS, method.getName()));
           operation.setMethod(method);
  -        Class retClass = method.getReturnType();
  -        operation.setReturnClass(retClass);
  -        operation.setReturnType(tm.getTypeQName(method.getReturnType()));
  -
  -        String [] paramNames = getParamNames(method);
  -
  -        for (int k = 0; k < paramTypes.length; k++) {
  -            Class type = paramTypes[k];
  -            ParameterDesc paramDesc = new ParameterDesc();
  -            // If we have a name for this param, use it, otherwise call
  -            // it "in*"
  -            if (paramNames != null && paramNames[k] != null && paramNames[k].length()>0) {
  -                paramDesc.setName(paramNames[k]);
  -            } else {
  -                paramDesc.setName("in" + k);
  -            }
  -
  -            // If it's a Holder, mark it INOUT, and set the XML type QName
  -            // to the held type.  Otherwise it's IN.
  -
  -            Class heldClass = JavaUtils.getHolderValueType(type);
  -            if (heldClass != null) {
  -                paramDesc.setMode(ParameterDesc.INOUT);
  -                paramDesc.setTypeQName(tm.getTypeQName(heldClass));
  -            } else {
  -                paramDesc.setMode(ParameterDesc.IN);
  -                paramDesc.setTypeQName(tm.getTypeQName(type));
  +
  +        // If this is a MESSAGE style service, set up the OperationDesc
  +        // appropriately.
  +        if (style == Style.MESSAGE) {
  +            int messageOperType = checkMessageMethod(method);
  +            if (messageOperType == -1) {
  +                throw new InternalException("Couldn't match method to any of the allowable message-style patterns!");
  +            }
  +            operation.setMessageOperationStyle(messageOperType);
  +        } else {
  +            // For other styles, continue here.
  +            Class retClass = method.getReturnType();
  +            operation.setReturnClass(retClass);
  +            operation.setReturnType(tm.getTypeQName(method.getReturnType()));
  +
  +            String [] paramNames = getParamNames(method);
  +
  +            for (int k = 0; k < paramTypes.length; k++) {
  +                Class type = paramTypes[k];
  +                ParameterDesc paramDesc = new ParameterDesc();
  +                // If we have a name for this param, use it, otherwise call
  +                // it "in*"
  +                if (paramNames != null && paramNames[k] != null &&
  +                        paramNames[k].length()>0) {
  +                    paramDesc.setName(paramNames[k]);
  +                } else {
  +                    paramDesc.setName("in" + k);
  +                }
  +
  +                // If it's a Holder, mark it INOUT, and set the XML type QName
  +                // to the held type.  Otherwise it's IN.
  +
  +                Class heldClass = JavaUtils.getHolderValueType(type);
  +                if (heldClass != null) {
  +                    paramDesc.setMode(ParameterDesc.INOUT);
  +                    paramDesc.setTypeQName(tm.getTypeQName(heldClass));
  +                } else {
  +                    paramDesc.setMode(ParameterDesc.IN);
  +                    paramDesc.setTypeQName(tm.getTypeQName(type));
  +                }
  +                paramDesc.setJavaType(type);
  +                operation.addParameter(paramDesc);
               }
  -            paramDesc.setJavaType(type);
  -            operation.addParameter(paramDesc);
           }
   
           // Create Exception Types
  
  
  
  1.6       +3 -0      xml-axis/java/src/org/apache/axis/i18n/resource.properties
  
  Index: resource.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/i18n/resource.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- resource.properties	24 Sep 2002 20:29:18 -0000	1.5
  +++ resource.properties	24 Sep 2002 20:45:20 -0000	1.6
  @@ -1025,4 +1025,7 @@
   
   badWSDDOperation=Couldn''t find a matching Java operation for WSDD operation "{0}" ({1} args)
   
  +badMsgMethodStyle=Method style for message-based service wasn't one we recognized!
  +badMsgMethodParams=Method ''{0}'' does not match any of the valid signatures for message-style service methods
  +
   unmatchedOp=Binding operation has no corresponding portType operation:  name = {0}, input name = {1}, output name = {2}
  
  
  
  1.52      +5 -2      xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
  
  Index: BodyBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- BodyBuilder.java	18 Sep 2002 16:10:28 -0000	1.51
  +++ BodyBuilder.java	24 Sep 2002 20:45:20 -0000	1.52
  @@ -62,7 +62,6 @@
   
   import org.apache.axis.Constants;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Messages;
   import org.apache.axis.soap.SOAPConstants;
   import org.apache.axis.description.OperationDesc;
  @@ -147,8 +146,12 @@
           MessageContext msgContext = context.getMessageContext();
           OperationDesc [] operations = null;
           try {
  -             if(msgContext != null)
  +            if(msgContext != null)
                   operations = msgContext.getPossibleOperationsByQName(qname);
  +
  +            // If there's only one match, set it in the MC now
  +            if ((operations != null) && (operations.length == 1))
  +                msgContext.setOperation(operations[0]);
           } catch (org.apache.axis.AxisFault e) {
               // SAXException is already known to this method, so I
               // don't have an exception-handling propogation explosion.
  
  
  
  1.32      +51 -87    xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java
  
  Index: MsgProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- MsgProvider.java	18 Sep 2002 16:10:34 -0000	1.31
  +++ MsgProvider.java	24 Sep 2002 20:45:20 -0000	1.32
  @@ -55,16 +55,14 @@
   
   package org.apache.axis.providers.java;
   
  -import org.apache.axis.Handler;
   import org.apache.axis.MessageContext;
   import org.apache.axis.AxisFault;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.Messages;
  +import org.apache.axis.i18n.Messages;
   import org.apache.axis.description.OperationDesc;
   import org.apache.axis.message.SOAPBodyElement;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   import java.lang.reflect.Method;
   import java.util.Vector;
  @@ -87,10 +85,11 @@
    */
   public class MsgProvider extends JavaProvider {
       /**
  -     * Process the message.  This means figuring out what our actual
  -     * backend method takes (we could cache this somehow) and doing the
  -     * invocation.  Note that we don't catch exceptions here, preferring to
  -     * bubble them right up through to someone who'll catch it above us.
  +     * Process the message.  Figure out the method "style" (one of the three
  +     * allowed signatures, which has already been determined and cached in
  +     * the OperationDesc) and do the actual invocation.  Note that we don't
  +     * catch exceptions here, preferring to bubble them right up through to
  +     * someone who'll catch it above us.
        *
        * @param msgContext the active MessageContext
        * @param reqEnv the request SOAPEnvelope
  @@ -104,98 +103,63 @@
                                   Object obj)
           throws Exception
       {
  -        Handler targetService = msgContext.getService();
           OperationDesc operation = msgContext.getOperation();
           Method method = operation.getMethod();
   
  -        // is this service a body-only service?
  -        // if true, we expect to pass a Vector of body Elements (as DOM) and
  -        //   get back an array of DOM Elements for the return body, OR
  -        //   to pass a Document and get back a Document.
  -        //
  -        // if false, the service expects just one MessageContext argument,
  -        //   and looks at the entire request envelope in the MessageContext
  -        //   (hence it's a "FullMessageService").
  -        //
  -        // Q (Glen) : Why would you ever do the latter instead of just defining
  -        //            a Handler provider yourself?  I think we should change
  -        //            this to simply pass the whole SOAP envelope as a Document
  -        //            and get back a Document.  Or even SOAPEnvelope/
  -        //            SOAPEnvelope...
  -        boolean bodyOnlyService = true;
  -        if (targetService.getOption("FullMessageService") != null) {
  -            bodyOnlyService = false;
  -        }
  -
  -        // Collect the types so we know what we're dealing with in the target
  -        // method.
  -        Class [] params = method.getParameterTypes();
  -
  -        if (params.length != 1) {
  -            // Must have exactly one argument in all cases.
  -            throw new AxisFault(
  -                    Messages.getMessage("msgMethodMustHaveOneParam",
  -                                         method.getName(),
  -                                         ""+params.length));
  -
  -        }
  +        int methodType = operation.getMessageOperationStyle();
   
  -        Object argObjects[] = new Object [params.length];
  -
  -        Document doc = null ;
  -        
  -        if (bodyOnlyService) {
  +        if (methodType != OperationDesc.MSG_METHOD_SOAPENVELOPE) {
               // dig out just the body, and pass it on
               Vector                bodies  = reqEnv.getBodyElements();
  -            SOAPBodyElement       reqBody = reqEnv.getFirstBody();
  +            Object argObjects[] = new Object [1];
   
  -            doc = reqBody.getAsDOM().getOwnerDocument();
  +            switch (methodType) {
  +                // SOAPBodyElement [] / SOAPBodyElement []
  +                case OperationDesc.MSG_METHOD_BODYARRAY:
  +                    SOAPBodyElement [] bodyElements =
  +                            new SOAPBodyElement[bodies.size()];
  +                    bodies.toArray(bodyElements);
  +                    argObjects[0] = bodyElements;
  +                    SOAPBodyElement [] bodyResult =
  +                            (SOAPBodyElement [])method.invoke(obj, argObjects);
  +                    if (bodyResult != null) {
  +                        for (int i = 0; i < bodyResult.length; i++) {
  +                            SOAPBodyElement bodyElement = bodyResult[i];
  +                            resEnv.addBodyElement(bodyElement);
  +                        }
  +                    }
  +                    return;
   
  -            Vector newBodies = new Vector();
  -            for (int i = 0 ; i < bodies.size() ; i++ )
  -                newBodies.add( ((SOAPBodyElement)bodies.get(i)).getAsDOM() );
  -            bodies = newBodies ;
  -
  -            // We know we have one param.  OK, is it a Vector?
  -            if (params[0] == Vector.class) {
  -                // Yes, invoke away!
  -                argObjects[0] = bodies ;
  -                Element[] result = (Element[]) method.invoke( obj, argObjects );
  -                if ( result != null ) {
  -                    for ( int i = 0 ; i < result.length ; i++ ) {
  -                        if(result[i] != null)
  -                            resEnv.addBodyElement( new SOAPBodyElement(result[i]));
  +                // Element [] / Element []
  +                case OperationDesc.MSG_METHOD_ELEMENTARRAY:
  +                    Element [] elements = new Element [bodies.size()];
  +                    for (int i = 0; i < elements.length; i++) {
  +                        SOAPBodyElement body = (SOAPBodyElement)bodies.get(i);
  +                        elements[i] = body.getAsDOM();
  +                    }
  +                    argObjects[0] = elements;
  +                    Element[] elemResult =
  +                            (Element[]) method.invoke( obj, argObjects );
  +                    if (elemResult != null) {
  +                        for ( int i = 0 ; i < elemResult.length ; i++ ) {
  +                            if(elemResult[i] != null)
  +                                resEnv.addBodyElement(
  +                                        new SOAPBodyElement(elemResult[i]));
  +                        }
                       }
  -                }
  -                return ;
  -            } else if (params[0] == Document.class) {
  -                // Not a Vector, but a Document!  Invoke away!
  -                argObjects[0] = doc;
  -
  -                // !!! WANT TO MAKE THIS SAX-CAPABLE AS WELL?
  -                Document retDoc = (Document) method.invoke( obj, argObjects );
  -                if ( retDoc != null ) {
  -                    SOAPBodyElement el = new SOAPBodyElement(retDoc.getDocumentElement());
  -                    resEnv.addBodyElement(el);
  -                }
  -            } else {
  -                // Neither - must be a bad method.
  -                throw new AxisFault(
  -                        Messages.getMessage("badMsgMethodParam",
  -                                             method.getName(),
  -                                             params[0].getName()));
  +                    return;
               }
           } else {
  -            // pass *just* the MessageContext (maybe don't even parse!!!)
  -            if (params[0] != MessageContext.class) {
  -                throw new AxisFault(
  -                        Messages.getMessage("needMessageContextArg",
  -                                             method.getName(),
  -                                             params[0].getName()));
  -            }
  +            Object argObjects[] = new Object [2];
   
  -            argObjects[0] = msgContext ;
  +            // SOAPEnvelope / SOAPEnvelope
  +            argObjects[0] = reqEnv;
  +            argObjects[1] = resEnv;
               method.invoke(obj, argObjects);
  +            return;
           }
  +
  +        // SHOULD NEVER GET HERE...
  +        throw new AxisFault(Messages.getMessage("badMsgMethodStyle"));
       }
   };
  
  
  
  1.125     +19 -14    xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -r1.124 -r1.125
  --- Admin.java	24 Sep 2002 18:16:37 -0000	1.124
  +++ Admin.java	24 Sep 2002 20:45:20 -0000	1.125
  @@ -61,7 +61,6 @@
   import java.io.StringWriter;
   import java.net.InetAddress;
   import java.net.UnknownHostException;
  -import java.util.Vector;
   
   import org.apache.axis.AxisEngine;
   import org.apache.axis.AxisFault;
  @@ -72,7 +71,6 @@
   import org.apache.axis.WSDDEngineConfiguration;
   import org.apache.axis.client.AxisClient;
   import org.apache.axis.components.logger.LogFactory;
  -import org.apache.axis.configuration.FileProvider;
   import org.apache.axis.deployment.wsdd.WSDDConstants;
   import org.apache.axis.deployment.wsdd.WSDDDeployment;
   import org.apache.axis.deployment.wsdd.WSDDDocument;
  @@ -84,6 +82,13 @@
   import org.w3c.dom.Element;
   import org.xml.sax.InputSource;
   
  +import java.io.FileInputStream;
  +import java.io.IOException;
  +import java.io.StringReader;
  +import java.io.StringWriter;
  +import java.net.InetAddress;
  +import java.net.UnknownHostException;
  +
   /**
    * Handy static utility functions for turning XML into
    * Axis deployment operations.
  @@ -99,12 +104,12 @@
       /**
        * Process a given XML document - needs cleanup.
        */
  -    public Element[] AdminService(Vector xml)
  +    public Element[] AdminService(Element [] xml)
           throws Exception
       {
           log.debug("Enter: Admin::AdminService");
           MessageContext msgContext = MessageContext.getCurrentContext();
  -        Document doc = process( msgContext, (Element) xml.get(0) );
  +        Document doc = process( msgContext, xml[0] );
           Element[] result = new Element[1];
           result[0] = doc.getDocumentElement();
           log.debug("Exit: Admin::AdminService");
  @@ -160,11 +165,11 @@
           engine.refreshGlobalOptions();
   
           engine.saveConfiguration();
  -        
  +
           doc = XMLUtils.newDocument();
           doc.appendChild( root = doc.createElementNS("", "Admin" ) );
           root.appendChild( doc.createTextNode( Messages.getMessage("done00") ) );
  -        
  +
           return doc;
       }
   
  @@ -180,7 +185,7 @@
           throws Exception
       {
           // Check security FIRST.
  -        
  +
           /** Might do something like this once security is a little more
            * integrated.
           if (!engine.hasSafePassword() &&
  @@ -196,16 +201,16 @@
           Handler serviceHandler = msgContext.getService();
           if (serviceHandler != null  &&
               !JavaUtils.isTrueExplicitly(serviceHandler.getOption("enableRemoteAdmin"))) {
  -                
  +
               String remoteIP = msgContext.getStrProp(Constants.MC_REMOTE_ADDR);
               if (remoteIP != null  &&
                   !remoteIP.equals("127.0.0.1")) {
  -                    
  +
                   try {
                       InetAddress myAddr = InetAddress.getLocalHost();
                       InetAddress remoteAddr =
                               InetAddress.getByName(remoteIP);
  -                    
  +
                       if (!myAddr.equals(remoteAddr))
                           throw new AxisFault("Server.Unauthorized",
                              Messages.getMessage("noAdminAccess00"),
  @@ -217,10 +222,10 @@
                   }
               }
           }
  -        
  +
           String rootNS = root.getNamespaceURI();
           AxisEngine engine = msgContext.getAxisEngine();
  -        
  +
           // If this is WSDD, process it correctly.
           if (rootNS != null && rootNS.equals(WSDDConstants.URI_WSDD)) {
               return processWSDD(msgContext, engine, root);
  @@ -247,7 +252,7 @@
           context.setPretty(true);
           try {
               EngineConfiguration config = engine.getConfig();
  -            
  +
               if (config instanceof WSDDEngineConfiguration) {
                   WSDDDeployment deployment =
                       ((WSDDEngineConfiguration)config).getDeployment();
  @@ -298,7 +303,7 @@
               // throw an Exception which will go uncaught!  this way, a test
               // suite can invoke main() and detect the exception
               throw new IllegalArgumentException(
  -                    Messages.getMessage("usage00", 
  +                    Messages.getMessage("usage00",
                                            "Admin client|server <xml-file>"));
               // System.exit( 1 );
           }
  
  
  
  1.1                  xml-axis/java/test/MSGDispatch/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package MSGDispatch;
  
  import junit.framework.TestCase;
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  /**
   * Message-style service tests
   *
   * @author Glen Daniels (gdaniels@apache.org)
   */
  public class PackageTests extends TestCase {
      public PackageTests(String name) {
          super(name);
      }
  
      public static Test suite() throws Exception {
          TestSuite suite = new TestSuite();
  
          suite.addTestSuite(TestMessageService);
      }
  }
  
  
  1.1                  xml-axis/java/test/MSGDispatch/TestMessageService.java
  
  Index: TestMessageService.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package test.MSGDispatch;
  
  import junit.framework.TestCase;
  import org.apache.axis.handlers.soap.SOAPService;
  import org.apache.axis.providers.java.MsgProvider;
  import org.apache.axis.EngineConfiguration;
  import org.apache.axis.enum.Style;
  import org.apache.axis.message.SOAPBodyElement;
  import org.apache.axis.message.SOAPEnvelope;
  import org.apache.axis.message.SOAPHeaderElement;
  import org.apache.axis.utils.XMLUtils;
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.transport.local.LocalTransport;
  import org.apache.axis.server.AxisServer;
  import org.apache.axis.configuration.DefaultEngineConfigurationFactory;
  import org.apache.axis.configuration.SimpleProvider;
  import org.w3c.dom.Document;
  
  import java.io.ByteArrayInputStream;
  import java.util.Vector;
  
  /**
   * Test for message style service dispatch.
   *
   * @author Glen Daniels (gdaniels@apache.org)
   */
  public class TestMessageService extends TestCase {
      LocalTransport transport;
  
      public TestMessageService(String s) {
          super(s);
      }
  
      protected void setUp() throws Exception {
          SOAPService service = new SOAPService(new MsgProvider());
  
          service.setName("MessageService");
          service.setOption("className", "test.MSGDispatch.TestService");
          service.setOption("allowedMethods", "*");
          service.getServiceDescription().setDefaultNamespace("http://db.com");
          service.getServiceDescription().setStyle(Style.MESSAGE);
  
          EngineConfiguration defaultConfig =
              (new DefaultEngineConfigurationFactory()).getServerEngineConfig();
          SimpleProvider config = new SimpleProvider(defaultConfig);
          config.deployService("MessageService", service);
  
          AxisServer server = new AxisServer(config);
  
          transport = new LocalTransport(server);
          transport.setRemoteService("MessageService");
      }
  
      public void testBodyMethod() throws Exception {
          Call call = new Call(new Service());
          call.setTransport(transport);
  
          String xml = "<m:testBody xmlns:m=\"http://db.com\"></m:testBody>";
          Document doc = XMLUtils.newDocument(new ByteArrayInputStream(xml.getBytes()));
          SOAPBodyElement[] input = new SOAPBodyElement[1];
          input[0] = new SOAPBodyElement(doc.getDocumentElement());
          Vector          elems = (Vector) call.invoke( input );
          assertNotNull("Return was null!", elems);
          assert("Return had " + elems.size() + " elements (needed 1)",
                 elems.size() == 1);
          SOAPBodyElement firstBody = (SOAPBodyElement)elems.get(0);
          assertEquals("http://db.com", firstBody.getNamespaceURI());
          assertEquals("bodyResult", firstBody.getName());
      }
  
      public void testElementMethod() throws Exception {
          Call call = new Call(new Service());
          call.setTransport(transport);
  
          String xml = "<m:testElement xmlns:m=\"http://db.com\"></m:testElement>";
          Document doc = XMLUtils.newDocument(new ByteArrayInputStream(xml.getBytes()));
          SOAPBodyElement[] input = new SOAPBodyElement[1];
          input[0] = new SOAPBodyElement(doc.getDocumentElement());
          Vector          elems = (Vector) call.invoke( input );
          assertNotNull("Return was null!", elems);
          assert("Return had " + elems.size() + " elements (needed 1)",
                 elems.size() == 1);
          SOAPBodyElement firstBody = (SOAPBodyElement)elems.get(0);
          assertEquals("http://db.com", firstBody.getNamespaceURI());
          assertEquals("elementResult", firstBody.getName());
      }
  
      public void testEnvelopeMethod() throws Exception {
          Call call = new Call(new Service());
          call.setTransport(transport);
  
          String xml = "<m:testEnvelope xmlns:m=\"http://db.com\"></m:testEnvelope>";
          Document doc = XMLUtils.newDocument(new ByteArrayInputStream(xml.getBytes()));
          SOAPBodyElement body = new SOAPBodyElement(doc.getDocumentElement());
          SOAPEnvelope env = new SOAPEnvelope();
          env.addBodyElement(body);
          SOAPEnvelope result = call.invoke( env );
          assertNotNull("Return was null!", result);
          Vector headers = result.getHeaders();
          assertEquals("Had " + headers.size() + " headers, needed 1", 1, headers.size());
          SOAPHeaderElement firstHeader = (SOAPHeaderElement)headers.get(0);
          assertEquals("http://db.com", firstHeader.getNamespaceURI());
          assertEquals("local", firstHeader.getName());
          assertEquals(firstHeader.getValue(), "value");
      }
  }
  
  
  
  1.1                  xml-axis/java/test/MSGDispatch/TestService.java
  
  Index: TestService.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2002 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Axis" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache",
  *    nor may "Apache" appear in their name, without prior written
  *    permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation.  For more
  * information on the Apache Software Foundation, please see
  * <http://www.apache.org/>.
  */
  
  package test.MSGDispatch;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.apache.axis.utils.XMLUtils;
  import org.apache.axis.message.SOAPBodyElement;
  import org.apache.axis.message.SOAPEnvelope;
  import org.apache.axis.message.SOAPHeaderElement;
  import org.apache.axis.AxisFault;
  
  import java.io.ByteArrayInputStream;
  import java.io.InputStream;
  
  /**
   * This class is a message-based service with three methods.  It tests:
   *
   * 1) Our ability to dispatch to multiple methods for a message service
   * 2) That each of the valid signatures works as expected
   *
   * @author Glen Daniels (gdaniels@apache.org)
   */
  public class TestService {
      public SOAPBodyElement [] testBody(SOAPBodyElement [] bodies)
              throws Exception {
  
          String xml = "<m:bodyResult xmlns:m=\"http://db.com\"/>" ;
          InputStream is = new ByteArrayInputStream(xml.getBytes());
          SOAPBodyElement result = new SOAPBodyElement(is);
          return new SOAPBodyElement [] { result };
      }
  
      public Element [] testElement(Element [] bodyElems)
              throws Exception {
          if (bodyElems == null || bodyElems.length != 1) {
              throw new AxisFault("Wrong number of Elements in array!");
          }
          Element el = bodyElems[0];
          if (el == null) {
              throw new AxisFault("Null Element in array!");
          }
          if (!"http://db.com".equals(el.getNamespaceURI())) {
              throw new AxisFault("Wrong namespace for Element (was \"" +
                                  el.getNamespaceURI() + "\" should be " +
                                  "\"http://db.com\"!");
          }
          String xml = "<m:elementResult xmlns:m=\"http://db.com\"/>" ;
          Document doc = XMLUtils.newDocument(
                  new ByteArrayInputStream(xml.getBytes()));
          Element result = doc.getDocumentElement();
          return new Element [] { result };
      }
  
      public void testEnvelope(SOAPEnvelope req, SOAPEnvelope resp)
              throws Exception {
          // Throw a header in and echo back.
          resp.addHeader(new SOAPHeaderElement("http://db.com", "local", "value"));
      }
  }
  
  
  
  1.3       +3 -5      xml-axis/java/test/wsdl/sequence/SequenceService.java
  
  Index: SequenceService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/sequence/SequenceService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SequenceService.java	1 Aug 2002 22:13:08 -0000	1.2
  +++ SequenceService.java	24 Sep 2002 20:45:20 -0000	1.3
  @@ -62,8 +62,6 @@
   import org.w3c.dom.Text;
   import org.apache.axis.utils.XMLUtils;
   
  -import java.util.Vector;
  -
   /**
    * Sequence test service.  This is a custom built message-style service
    * which confirms that the XML it receives correctly contains ordered
  @@ -85,10 +83,10 @@
        * @return a SOAP response in a DOM Element, either boolean true or false,
        *         indicating the success/failure of the test.
        */
  -    public Element [] testSequence(Vector elems) {
  +    public Element [] testSequence(Element [] elems) {
           Element zero = null;
  -        for (int i = 0; i < elems.size(); i++) {
  -            zero = findTheZero((Element)elems.get(i));
  +        for (int i = 0; i < elems.length; i++) {
  +            zero = findTheZero(elems[i]);
               if (zero != null)
                   break;
           }