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/03/05 15:02:13 UTC

cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java JavaStubWriter.java JavaUndeployWriter.java

gdaniels    02/03/05 06:02:13

  Modified:    java/src/org/apache/axis MessageContext.java
               java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/deployment/wsdd WSDDConstants.java
                        WSDDOperation.java WSDDService.java
               java/src/org/apache/axis/description OperationDesc.java
                        ServiceDesc.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/message BodyBuilder.java
                        RPCElement.java
               java/src/org/apache/axis/providers/java RPCProvider.java
               java/src/org/apache/axis/utils resources.properties
               java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaStubWriter.java JavaUndeployWriter.java
  Added:       java/src/org/apache/axis/description Parameter.java
  Removed:     java/src/org/apache/axis/encoding ServiceDescription.java
  Log:
  More motion towards a common concept of abstract ServiceDescription
  (org.apache.axis.description.*).
  
  * Start to remove some of the functionally redundant code which used things
    like the service style or MessageContext.isRPC() or encoding style checks to
    do the same thing.  Replace with common lookups of OperationDescs, where the
    style there tells us how to deal.
  
  * Move style constants from SOAPService to ServiceDesc
  
  * Do a somewhat better job with default namespaces in RPCElement.outputImpl()
  
  * Store style in the Call as an int (quicker + smaller)
  
  * Introduce the "wrapped" style.  I'm imagining a service can be "rpc"
    (encoded), "document" (not encoded, but using 'rpc-style' invocations
    accepting Java types which correspond to the XML types involved - no outer
    method 'wrapper' element), "wrapped" (similar to document but with an
    automatic method 'wrapper' element around the args), and "message" (no
    encoding, service methods take and return SOAPBodyElements).
  
  * Removed a bunch of unused code/vars.
  
  Revision  Changes    Path
  1.81      +75 -27    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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- MessageContext.java	28 Feb 2002 16:09:35 -0000	1.80
  +++ MessageContext.java	5 Mar 2002 14:02:12 -0000	1.81
  @@ -62,10 +62,13 @@
   import org.apache.axis.session.Session;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.LockableHashtable;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import javax.xml.rpc.namespace.QName;
   import java.util.Hashtable;
   import java.io.File;
   
  @@ -167,7 +170,7 @@
        */
       private String  username       = null;
       private String  password       = null;
  -    private int     operationStyle = SOAPService.STYLE_RPC;
  +    private int     operationStyle = ServiceDesc.STYLE_RPC;
       private boolean useSOAPAction  = false;
       private String  SOAPActionURI  = null;
       private String  encodingStyle  = Constants.URI_CURRENT_SOAP_ENC;
  @@ -178,6 +181,47 @@
        */
       private boolean isEncoded = true;
   
  +    private OperationDesc currentOperation = null;
  +    public OperationDesc getOperation()
  +    {
  +        return currentOperation;
  +    }
  +    public void setOperation(OperationDesc operation)
  +    {
  +        currentOperation = operation;
  +    }
  +    public OperationDesc getOperationByQName(QName qname)
  +    {
  +        if (currentOperation != null)
  +            return currentOperation;
  +
  +        if (serviceHandler == null) {
  +            try {
  +                if (log.isDebugEnabled()) {
  +                    log.debug(JavaUtils.getMessage("dispatching00",
  +                                                   qname.getNamespaceURI()));
  +                }
  +
  +                // Try looking this QName up in our mapping table...
  +                setService(axisEngine.getConfig().
  +                           getServiceByNamespaceURI(qname.getNamespaceURI()));
  +            } catch (ConfigurationException e) {
  +                // Didn't find one...
  +            }
  +
  +            if (serviceHandler == null)
  +                return null;
  +        }
  +
  +        ServiceDesc desc = serviceHandler.getServiceDescription();
  +
  +        if (desc != null) {
  +            currentOperation = desc.getOperationByElementQName(qname);
  +            setOperationStyle(desc.getStyle());
  +        }
  +        return currentOperation;
  +    }
  +
       /**
        * Get the active message context.
        * @return the current active message context
  @@ -450,9 +494,8 @@
               SOAPService service = (SOAPService)sh;
               TypeMappingRegistry tmr = service.getTypeMappingRegistry();
               setTypeMappingRegistry(tmr);
  -            setProperty(ISRPC, new Boolean(service.isRPC()));
               setOperationStyle(service.getStyle());
  -            setEncodingStyle((service.getStyle() == SOAPService.STYLE_RPC) ?
  +            setEncodingStyle((service.getStyle() == ServiceDesc.STYLE_RPC) ?
                                           Constants.URI_CURRENT_SOAP_ENC : "");
           }
       }
  @@ -483,9 +526,6 @@
       /** Place to store an AuthenticatedUser */
       public static String AUTHUSER            = "authenticatedUser";
   
  -    /** Is this message an RPC message (instead of just a blob of xml) */
  -    public static String ISRPC               = "is_rpc" ;
  -
       /** If on the client - this is the Call object */
       public static String CALL                = "call_object" ;
   
  @@ -723,10 +763,7 @@
       } // getPassword
   
       /**
  -     * Set the operation style.  IllegalArgumentException is thrown if operationStyle
  -     * is not "rpc" or "document".
  -     *
  -     * @exception IllegalArgumentException if operationStyle is not "rpc" or "document".
  +     * Set the operation style.
        */
       public void setOperationStyle(int operationStyle) {
           this.operationStyle = operationStyle;
  @@ -809,30 +846,41 @@
       /**
        * Utility function to convert string to operation style constants
        * 
  -     * @param operationStyle "rpc" or "document"
  -     * @return either SOAPService.STYLE_RPC or SOAPService.STYLE_DOCUMENT
  -     * @throws IllegalArgumentException
  -     */ 
  +     * @param operationStyle "rpc", "document", or "wrapped"
  +     * @return either STYLE_RPC, STYLE_DOCUMENT or STYLE_WRAPPED (all defined
  +     *         in org.apache.axis.description.ServiceDesc)
  +     */
       public static int getStyleFromString(String operationStyle)
       {
           if ("rpc".equalsIgnoreCase(operationStyle))
  -            return SOAPService.STYLE_RPC;
  +            return ServiceDesc.STYLE_RPC;
           if ("document".equalsIgnoreCase(operationStyle))
  -            return SOAPService.STYLE_DOCUMENT;
  +            return ServiceDesc.STYLE_DOCUMENT;
  +        if ("wrapped".equalsIgnoreCase(operationStyle))
  +            return ServiceDesc.STYLE_WRAPPED;
   
  -        throw new IllegalArgumentException(JavaUtils.getMessage(
  -                    "badProp01",
  -                    new String[] {Call.OPERATION_STYLE_PROPERTY,
  -                    "\"rpc\", \"document\"", operationStyle}));
  +        // Not one of the recognized values.  We're going to return RPC
  +        // as the default, but log an error.
  +        log.error(JavaUtils.getMessage("badStyle", operationStyle));
  +
  +        return ServiceDesc.STYLE_RPC;
       }
  -    
  +
  +    /**
  +     * Utility function to return a string representation of a style
  +     * constant.
  +     */
       public static String getStyleFromInt(int style)
       {
  -        if (style == SOAPService.STYLE_RPC)
  -            return "rpc";
  -        if (style == SOAPService.STYLE_DOCUMENT)
  -            return "document";
  -        
  -        return null;        
  +        switch (style) {
  +            case ServiceDesc.STYLE_RPC:
  +                return "rpc";
  +            case ServiceDesc.STYLE_DOCUMENT:
  +                return "document";
  +            case ServiceDesc.STYLE_WRAPPED:
  +                return "wrapped";
  +        }
  +
  +        return null;
       }
   };
  
  
  
  1.86      +20 -16    xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- Call.java	3 Mar 2002 14:09:08 -0000	1.85
  +++ Call.java	5 Mar 2002 14:02:12 -0000	1.86
  @@ -80,6 +80,8 @@
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.attachments.AttachmentPart; 
   import org.apache.axis.InternalException;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -155,7 +157,7 @@
       private String             username        = null;
       private String             password        = null;
       private boolean            maintainSession = false;
  -    private String             operationStyle  = null;
  +    private int                operationStyle  = ServiceDesc.STYLE_RPC;
       private boolean            useSOAPAction   = false;
       private String             SOAPActionURI   = null;
       private String             encodingStyle   = Constants.URI_CURRENT_SOAP_ENC;
  @@ -357,7 +359,7 @@
                   return new Boolean(getMaintainSession());
               }
               else if (name.equals(OPERATION_STYLE_PROPERTY)) {
  -                return getOperationStyle();
  +                return MessageContext.getStyleFromInt(operationStyle);
               }
               else if (name.equals(SOAPACTION_USE_PROPERTY)) {
                   return new Boolean(useSOAPAction());
  @@ -434,22 +436,21 @@
        * @exception IllegalArgumentException if operationStyle is not "rpc" or "document".
        */
       public void setOperationStyle(String operationStyle) {
  -        if ("rpc".equalsIgnoreCase(operationStyle)
  -                || "document".equalsIgnoreCase(operationStyle)) {
  -            this.operationStyle = operationStyle;
  -        }
  -        else {
  -            throw new IllegalArgumentException(JavaUtils.getMessage(
  -                    "badProp01",
  -                    new String[] {OPERATION_STYLE_PROPERTY,
  -                    "\"rpc\", \"document\"", operationStyle}));
  -        }
  +        this.operationStyle =
  +                MessageContext.getStyleFromString(operationStyle);
  +
  +/*  Not being used for now... --GD
  +        throw new IllegalArgumentException(JavaUtils.getMessage(
  +                "badProp01",
  +                new String[] {OPERATION_STYLE_PROPERTY,
  +                              "\"rpc\", \"document\"", operationStyle}));
  +*/
       } // setOperationStyle
   
       /**
        * Get the operation style.
        */
  -    public String getOperationStyle() {
  +    public int getOperationStyle() {
           return operationStyle;
       } // getOperationStyle
   
  @@ -1622,9 +1623,12 @@
               msgContext.setPassword(password);
           }
           msgContext.setMaintainSession(maintainSession);
  -        if (operationStyle != null) {
  -            msgContext.setOperationStyle(MessageContext.getStyleFromString(operationStyle));
  -        }
  +        OperationDesc operationDesc = new OperationDesc();
  +        msgContext.setOperation(operationDesc);
  +
  +        operationDesc.setStyle(operationStyle);
  +        msgContext.setOperationStyle(operationStyle);
  +
           if (useSOAPAction) {
               msgContext.setUseSOAPAction(true);
           }
  
  
  
  1.14      +2 -0      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java
  
  Index: WSDDConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WSDDConstants.java	3 Mar 2002 14:09:08 -0000	1.13
  +++ WSDDConstants.java	5 Mar 2002 14:02:12 -0000	1.14
  @@ -117,4 +117,6 @@
                                                        "beanMapping");
       public static final QName OPERATION_QNAME = new QName(WSDD_NS,
                                                             "operation");
  +    public static final QName ELEMENTMAP_QNAME = new QName(WSDD_NS,
  +                                                          "elementMapping");
   }
  
  
  
  1.13      +38 -31    xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java
  
  Index: WSDDOperation.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- WSDDOperation.java	3 Mar 2002 14:09:08 -0000	1.12
  +++ WSDDOperation.java	5 Mar 2002 14:02:12 -0000	1.13
  @@ -59,11 +59,15 @@
   import org.w3c.dom.Node;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.handlers.soap.SOAPService;
   import org.xml.sax.helpers.AttributesImpl;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
  +import java.util.HashMap;
   
   /**
    *
  @@ -71,27 +75,39 @@
   public class WSDDOperation
       extends WSDDElement
   {
  -    /** The operation name (String, or QName?) */
  -    private String name;
  -
  -    /** The return QName (if it should be different from <method>Result) */
  -    private QName returnQName;
  +    /** Holds all our actual data */
  +    OperationDesc desc = new OperationDesc();
   
       /**
        *
        * @param e (Element) XXX
        * @throws WSDDException XXX
        */
  -    public WSDDOperation(Element e)
  +    public WSDDOperation(Element e, ServiceDesc parent)
           throws WSDDException
       {
           super(e);
   
  -        name = e.getAttribute("name");
  +        desc.setName(e.getAttribute("name"));
   
           String retQNameStr = e.getAttribute("returnQName");
           if (retQNameStr != null && !retQNameStr.equals(""))
  -            returnQName = XMLUtils.getQNameFromString(retQNameStr, e);
  +            desc.setReturnQName(XMLUtils.getQNameFromString(retQNameStr, e));
  +
  +        if (parent.getStyle() == ServiceDesc.STYLE_DOCUMENT) {
  +            Element [] mappingElements = getChildElements(e, "elementMapping");
  +            if (mappingElements.length > 1) {
  +                // Can only have one for now
  +                throw new WSDDException(JavaUtils.getMessage("onlyOneMapping"));
  +            }
  +
  +            // Register a mapping from an Element QName to a particular
  +            // method so we can dispatch for doc/lit services.
  +            Element el = mappingElements[0];
  +            String elString = el.getAttribute("qname");
  +            QName elQName = XMLUtils.getQNameFromString(elString, el);
  +            desc.setElementQName(elQName);
  +        }
       }
   
       /**
  @@ -101,16 +117,26 @@
               throws IOException {
           AttributesImpl attrs = new AttributesImpl();
   
  -        if (returnQName != null) {
  +        if (desc.getReturnQName() != null) {
               attrs.addAttribute("", "returnQName", "returnQName",
  -                               "CDATA", context.qName2String(returnQName));
  +                               "CDATA",
  +                               context.qName2String(desc.getReturnQName()));
           }
   
  -        if (name != null) {
  -            attrs.addAttribute("", "name", "name", "CDATA", name);
  +        if (desc.getName() != null) {
  +            attrs.addAttribute("", "name", "name", "CDATA", desc.getName());
           }
   
           context.startElement(getElementName(), attrs);
  +
  +        if (desc.getElementQName() != null) {
  +            attrs = new AttributesImpl();
  +            attrs.addAttribute("", "qname", "qname", "CDATA",
  +                               context.qName2String(desc.getElementQName()));
  +            context.startElement(WSDDConstants.ELEMENTMAP_QNAME, attrs);
  +            context.endElement();
  +        }
  +
           context.endElement();
       }
   
  @@ -118,27 +144,8 @@
           return WSDDConstants.OPERATION_QNAME;
       }
   
  -    public QName getReturnQName() {
  -        return returnQName;
  -    }
  -
  -    public void setReturnQName(QName returnQName) {
  -        this.returnQName = returnQName;
  -    }
  -
  -    public String getName() {
  -        return name;
  -    }
  -
  -    public void setName(String name) {
  -        this.name = name;
  -    }
  -
       public OperationDesc getOperationDesc()
       {
  -        OperationDesc desc = new OperationDesc();
  -        desc.setName(name);
  -        desc.setReturnQName(returnQName);
           return desc;
       }
   }
  
  
  
  1.44      +23 -50    xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- WSDDService.java	3 Mar 2002 14:09:08 -0000	1.43
  +++ WSDDService.java	5 Mar 2002 14:02:12 -0000	1.44
  @@ -61,6 +61,8 @@
   import org.apache.axis.encoding.ser.BaseDeserializerFactory;
   import org.apache.axis.encoding.*;
   import org.apache.axis.*;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.description.OperationDesc;
   import org.apache.axis.deployment.DeploymentRegistry;
   import org.apache.axis.deployment.DeploymentException;
   import org.w3c.dom.Document;
  @@ -84,7 +86,6 @@
       extends WSDDTargetedChain
       implements WSDDTypeMappingContainer
   {
  -    public static final QName elMapQName = new QName("", "elementMapping");
       public TypeMappingRegistry tmr = null;
   
       private Vector faultFlows = new Vector();
  @@ -94,13 +95,10 @@
       /** Which namespaces should auto-dispatch to this service? */
       private Vector namespaces = new Vector();
   
  -    /** List of QName -> method mappings for doc/lit dispatching */
  -    private HashMap qName2MethodMap = null;
  -
       private String descriptionURL;
   
       /** Style - document or RPC (the default) */
  -    private int style = SOAPService.STYLE_RPC;
  +    private int style = ServiceDesc.STYLE_RPC;
   
       private SOAPService cachedService = null;
   
  @@ -110,6 +108,8 @@
        */
       private QName providerQName;
   
  +    ServiceDesc desc = new ServiceDesc();
  +
       /**
        * Default constructor
        */
  @@ -127,9 +127,15 @@
       {
           super(e);
   
  +        String modeStr = e.getAttribute("style");
  +        if (modeStr != null && !modeStr.equals("")) {
  +            desc.setStyle(MessageContext.getStyleFromString(modeStr));
  +        }
  +
           Element [] operationElements = getChildElements(e, "operation");
           for (int i = 0; i < operationElements.length; i++) {
  -            WSDDOperation operation = new WSDDOperation(operationElements[i]);
  +            WSDDOperation operation = new WSDDOperation(operationElements[i],
  +                                                        desc);
               operations.add(operation);
           }
   
  @@ -158,24 +164,6 @@
           if (typeStr != null && !typeStr.equals(""))
               providerQName = XMLUtils.getQNameFromString(typeStr, e);
   
  -        String modeStr = e.getAttribute("style");
  -        if (modeStr != null && modeStr.equals("document")) {
  -            style = SOAPService.STYLE_DOCUMENT;
  -
  -            Element [] mappingElements = getChildElements(e, "elementMapping");
  -            if (mappingElements.length > 0 && qName2MethodMap == null) {
  -                qName2MethodMap = new HashMap();
  -            }
  -            for (int i = 0; i < mappingElements.length; i++) {
  -                // Register a mapping from an Element QName to a particular
  -                // method so we can dispatch for doc/lit services.
  -                Element el = mappingElements[i];
  -                String elString = el.getAttribute("element");
  -                QName elQName = XMLUtils.getQNameFromString(elString, el);
  -                String methodName = el.getAttribute("method");
  -                qName2MethodMap.put(elQName, methodName);
  -            }
  -        }
       }
   
       /**
  @@ -228,6 +216,10 @@
           return style;
       }
   
  +    public ServiceDesc getServiceDesc() {
  +        return desc;
  +    }
  +
       /**
        * Set the service style - document or RPC
        */
  @@ -345,14 +337,14 @@
               }
           }
   
  -        service.setElementMap(qName2MethodMap);
  -
           for (Iterator i = operations.iterator(); i.hasNext();) {
  -            WSDDOperation operation = (WSDDOperation) i.next();
  -            service.addOperationDesc(operation.getName(),
  -                                     operation.getOperationDesc());
  +            OperationDesc operationDesc =
  +                    ((WSDDOperation) i.next()).getOperationDesc();
  +            desc.addOperationDesc(operationDesc);
           }
   
  +        service.setServiceDescription(desc);
  +
           cachedService = service;
           return service;
       }
  @@ -371,7 +363,7 @@
               // use the style of the service to map doc/lit or rpc/enc
               String encodingStyle = mapping.getEncodingStyle();
               if (encodingStyle == null) {
  -                if (style == SOAPService.STYLE_RPC)
  +                if (style == ServiceDesc.STYLE_RPC)
                       encodingStyle =Constants.URI_CURRENT_SOAP_ENC;
                   else
                       encodingStyle = "";  // literal
  @@ -431,7 +423,7 @@
               attrs.addAttribute("", "provider", "provider",
                                  "CDATA", context.qName2String(providerQName));
           }
  -        if (style == SOAPService.STYLE_DOCUMENT) {
  +        if (style == ServiceDesc.STYLE_DOCUMENT) {
               attrs.addAttribute("", "style", "style", "CDATA", "document");
           }
   
  @@ -444,25 +436,6 @@
           writeFlowsToContext(context);
           writeParamsToContext(context);
   
  -        if (style == SOAPService.STYLE_DOCUMENT && qName2MethodMap != null) {
  -            Set qnames = qName2MethodMap.keySet();
  -            if (qnames != null) {
  -                Iterator i = qnames.iterator();
  -                while (i.hasNext()) {
  -                    QName elQName = (QName)i.next();
  -                    String methodName = (String)qName2MethodMap.get(elQName);
  -                    String elemName = context.qName2String(elQName);
  -                    attrs = new AttributesImpl();
  -                    attrs.addAttribute("", "method", "method",
  -                                       "CDATA", methodName);
  -                    attrs.addAttribute("", "element", "element",
  -                                       "CDATA", elemName);
  -
  -                    context.startElement(elMapQName, attrs);
  -                    context.endElement();
  -                }
  -            }
  -        }
   
           for (int i=0; i < typeMappings.size(); i++) {
               ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context);
  
  
  
  1.2       +65 -2     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OperationDesc.java	3 Mar 2002 14:16:25 -0000	1.1
  +++ OperationDesc.java	5 Mar 2002 14:02:13 -0000	1.2
  @@ -65,30 +65,46 @@
    * @author Glen Daniels (gdaniels@apache.org)
    */
   public class OperationDesc {
  +    /** The service we're a part of */
       private ServiceDesc parent;
   
       /** Parameter list */
  -    private ArrayList parameters;
  +    private ArrayList parameters = new ArrayList();
   
       /** The operation name (String, or QName?) */
       private String name;
   
  +    /** An XML QName which should dispatch to this method */
  +    private QName elementQName;
  +
       /** The return QName (if it should be different from <method>Result) */
       private QName returnQName;
   
       /** The return type */
       private QName returnType;
   
  -    /** The Java method name this maps to */
  +    /** The Java method name this maps to (is this just name?) */
       private String methodName;
   
  +    /** This operation's style.  If null, we default to our parent's */
  +    private Integer style;
  +
  +    /**
  +     * Default constructor.
  +     */
       public OperationDesc() {
       }
   
  +    /**
  +     * Return the operation's name
  +     */
       public String getName() {
           return name;
       }
   
  +    /**
  +     * Set the operation's name
  +     */
       public void setName(String name) {
           this.name = name;
       }
  @@ -107,6 +123,53 @@
   
       public void setReturnType(QName returnType) {
           this.returnType = returnType;
  +    }
  +
  +    public QName getElementQName() {
  +        return elementQName;
  +    }
  +
  +    public void setElementQName(QName elementQName) {
  +        this.elementQName = elementQName;
  +    }
  +
  +    public ServiceDesc getParent() {
  +        return parent;
  +    }
  +
  +    public void setParent(ServiceDesc parent) {
  +        this.parent = parent;
  +    }
  +
  +    public void setStyle(int style)
  +    {
  +        this.style = new Integer(style);
  +    }
  +
  +    /**
  +     * Return the style of the operation, defaulting to the parent
  +     * ServiceDesc's style if we don't have one explicitly set.
  +     */
  +    public int getStyle()
  +    {
  +        if (style == null) {
  +            if (parent != null) {
  +                return parent.getStyle();
  +            }
  +            return ServiceDesc.STYLE_RPC; // Default
  +        }
  +
  +        return style.intValue();
  +    }
  +
  +    public void addParameter(Parameter param)
  +    {
  +        parameters.add(param);
  +    }
  +
  +    public Parameter getParameter(int i)
  +    {
  +        return (Parameter)parameters.get(i);
       }
   }
   
  
  
  
  1.2       +83 -8     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceDesc.java	3 Mar 2002 14:16:25 -0000	1.1
  +++ ServiceDesc.java	5 Mar 2002 14:02:13 -0000	1.2
  @@ -57,6 +57,7 @@
   import javax.xml.rpc.namespace.QName;
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Iterator;
   
   /**
    * A ServiceDesc is an abstract description of a service.
  @@ -66,19 +67,93 @@
    * @author Glen Daniels (gdaniels@apache.org)
    */
   public class ServiceDesc {
  -    private ArrayList operations;
  -    private HashMap operationsByElementQName;
  +    public static final int STYLE_RPC = 0;
  +    public static final int STYLE_DOCUMENT = 1;
  +    public static final int STYLE_WRAPPED = 2;
  +    public static final int STYLE_MESSAGE = 3;
   
  -    public OperationDesc getOperationByElementQName(QName qname)
  +    /** Style */
  +    private int style = STYLE_RPC;
  +
  +    /** Implementation class */
  +    private String className = null;
  +
  +    /** Our operations - a list of OperationDescs */
  +    private ArrayList operations = new ArrayList();
  +
  +    /** A collection of namespaces which will map to this service */
  +    private ArrayList namespaceMappings = null;
  +
  +    /** Lookup caches */
  +    private HashMap method2OperationMap = null;
  +    private HashMap qname2OperationMap = null;
  +
  +    public int getStyle() {
  +        return style;
  +    }
  +
  +    public void setStyle(int style) {
  +        this.style = style;
  +    }
  +
  +    /**
  +     * Determine whether or not this is a "wrapped" invocation, i.e. whether
  +     * the outermost XML element of the "main" body element represents a
  +     * method call, with the immediate children of that element representing
  +     * arguments to the method.
  +     *
  +     * @return true if this is wrapped (i.e. RPC or WRAPPED style),
  +     *         false otherwise
  +     */
  +    public boolean isWrapped()
       {
  -        if (operationsByElementQName == null) {
  -            initializeCaches();
  +        return ((style == STYLE_RPC) || (style == STYLE_WRAPPED));
  +    }
  +
  +    public void addOperationDesc(OperationDesc operation)
  +    {
  +        operations.add(operation);
  +        operation.setParent(this);
  +    }
  +
  +    public OperationDesc getOperationDescByName(String methodName)
  +    {
  +        if (method2OperationMap == null) {
  +            method2OperationMap = new HashMap();
  +            for (Iterator i = operations.iterator(); i.hasNext();) {
  +                OperationDesc desc = (OperationDesc) i.next();
  +                method2OperationMap.put(desc.getName(), desc);
  +            }
           }
  -        return (OperationDesc)operationsByElementQName.get(qname);
  +        return (OperationDesc)method2OperationMap.get(methodName);
       }
   
  -    private void initializeCaches()
  +    public OperationDesc getOperationByElementQName(QName qname)
       {
  -        operationsByElementQName = new HashMap();
  +        // If we're a wrapped service (i.e. RPC or WRAPPED style), we expect
  +        // this qname to match one of our operation names directly.
  +        if (isWrapped()) {
  +            return getOperationDescByName(qname.getLocalPart());
  +        }
  +
  +        // 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) {
  +            return (OperationDesc)operations.get(0);
  +        }
  +
  +        // 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....
  +        if (qname2OperationMap == null) {
  +            qname2OperationMap = new HashMap();
  +            for (Iterator i = operations.iterator(); i.hasNext();) {
  +                OperationDesc operationDesc = (OperationDesc) i.next();
  +                qname2OperationMap.put(operationDesc.getElementQName(),
  +                                       operationDesc);
  +            }
  +        }
  +
  +        return (OperationDesc)qname2OperationMap.get(qname);
       }
   }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/description/Parameter.java
  
  Index: Parameter.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 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 org.apache.axis.description;
  
  import org.apache.axis.wsdl.toJava.TypeEntry;
  
  import javax.xml.rpc.namespace.QName;
  import java.util.Vector;
  
  /**
   * A Parameter descriptor, collecting the interesting info about an
   * operation parameter.
   *
   * (mostly taken from org.apache.axis.wsdl.toJava.Parameter right now)
   *
   * @author Glen Daniels (gdaniels@apache.org)
   */
  public class Parameter {
  
      // constant values for the parameter mode.
      public static final byte IN = 1;
      public static final byte OUT = 2;
      public static final byte INOUT = 3;
  
      /** The Parameter's XML QName */
      private QName name;
      /** A TypeEntry corresponding to this parameter */
      public TypeEntry typeEntry;
      /** The Parameter mode (in, out, inout) */
      public byte mode = IN;
      /** The XML type of this parameter */
      private QName typeQName;
      /** The order of this parameter */
      private int order = 0;
  
      public String toString() {
          return "(" + typeEntry + ", " + getName() + ", "
                  + (mode == IN ? "IN)" : mode == INOUT ? "INOUT)" : "OUT)");
      } // toString
  
      public QName getQName() {
          return name;
      }
  
      public String getName() {
          return name.getLocalPart();
      }
  
      public void setName(String name) {
          this.name = new QName("", name);
      }
  
      public void setQName(QName name) {
          this.name = name;
      }
  
      public QName getTypeQName() {
          return typeQName;
      }
  
      public void setTypeQName(QName typeQName) {
          this.typeQName = typeQName;
      }
  } // class Parameter
  
  
  
  1.11      +2 -1      xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SerializationContextImpl.java	25 Feb 2002 10:53:39 -0000	1.10
  +++ SerializationContextImpl.java	5 Mar 2002 14:02:13 -0000	1.11
  @@ -59,6 +59,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  +import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.attachments.Attachments;
   import org.apache.axis.client.Call;
  @@ -207,7 +208,7 @@
               // send xsi:type, and don't do multiref in that case.
               SOAPService service = msgContext.getService();
               if (service != null) {
  -                if (service.getStyle() == SOAPService.STYLE_DOCUMENT) {
  +                if (service.getStyle() == ServiceDesc.STYLE_DOCUMENT) {
                       sendXSIType = false;
                       doMultiRefs = false;
                   }
  
  
  
  1.50      +18 -58    xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- SOAPService.java	3 Mar 2002 14:09:08 -0000	1.49
  +++ SOAPService.java	5 Mar 2002 14:02:13 -0000	1.50
  @@ -63,6 +63,7 @@
   import org.apache.axis.MessageContext;
   import org.apache.axis.SimpleTargetedChain;
   import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.providers.java.MsgProvider;
   import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.encoding.Serializer;
  @@ -98,9 +99,6 @@
       protected static Log log =
           LogFactory.getLog(SOAPService.class.getName());
   
  -    public static final int STYLE_RPC = 0;
  -    public static final int STYLE_DOCUMENT = 1;
  -    
       /** Valid transports for this service
        * (server side only!)
        *
  @@ -114,31 +112,10 @@
       private TypeMappingRegistry tmr;
       
       /**
  -     * Style of the service - document or RPC
  -     */ 
  -    private int style = STYLE_RPC;
  -
  -    /**
  -     * Mappings of element QNames -> method names if we're doc/literal and
  -     * not in wrapped mode.
  +     * Our ServiceDescription.  Holds pretty much all the interesting
  +     * metadata about this service.
        */
  -    private HashMap qName2MethodMap = null;
  -
  -    private HashMap method2OperationMap = null;
  -
  -    public void addOperationDesc(String method, OperationDesc operation)
  -    {
  -        if (method2OperationMap == null)
  -            method2OperationMap = new HashMap();
  -        method2OperationMap.put(method, operation);
  -    }
  -
  -    public OperationDesc getOperationDescByName(String methodName)
  -    {
  -        if (method2OperationMap == null)
  -            return null;
  -        return (OperationDesc)method2OperationMap.get(methodName);
  -    }
  +    private ServiceDesc serviceDescription = null;
   
       /**
        * SOAPRequestHandler is used to inject SOAP semantics just before
  @@ -257,18 +234,6 @@
           tmr.delegate(engine.getTypeMappingRegistry());
       }
   
  -    /**
  -     * Is this an RPC service?  Right now, we default to yes, unless
  -     * the provider is in fact a MsgProvider.
  -     *
  -     * @return true if the service is RPC, false if document-oriented
  -     */
  -    public boolean isRPC()
  -    {
  -        return ((pivotHandler == null) ||
  -                (pivotHandler.getClass() != MsgProvider.class));
  -    }
  -
       public boolean availableFromTransport(String transportName)
       {
           if (validTransports != null) {
  @@ -284,33 +249,28 @@
       }
   
       public int getStyle() {
  -        return style;
  +        if (serviceDescription == null) {
  +            serviceDescription = new ServiceDesc();
  +        }
  +
  +        return serviceDescription.getStyle();
       }
   
       public void setStyle(int style) {
  -        this.style = style;
  -    }
  +        if (serviceDescription == null) {
  +            serviceDescription = new ServiceDesc();
  +        }
   
  -    public void setElementMap(HashMap elementMap) {
  -        this.qName2MethodMap = elementMap;
  +        serviceDescription.setStyle(style);
       }
   
  -    /**
  -     * Retreive a method which has been mapped to a particular element
  -     * QName (for document/literal services)
  -     *
  -     * @param elementQName the QName of an XML element to dispatch on
  -     * @return a method which should handle the specified element, or
  -     *         null if no such method has been mapped.
  -     */
  -    public String getMethodForElementName(QName elementQName)
  -    {
  -        if (qName2MethodMap != null) {
  -            return (String)qName2MethodMap.get(elementQName);
  -        }
  -        return null;
  +    public ServiceDesc getServiceDescription() {
  +        return serviceDescription;
       }
   
  +    public void setServiceDescription(ServiceDesc serviceDescription) {
  +        this.serviceDescription = serviceDescription;
  +    }
       /*********************************************************************
        * Administration and management APIs
        *
  
  
  
  1.23      +10 -38    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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- BodyBuilder.java	1 Mar 2002 16:39:19 -0000	1.22
  +++ BodyBuilder.java	5 Mar 2002 14:02:13 -0000	1.23
  @@ -65,6 +65,8 @@
   import org.apache.axis.AxisFault;
   import org.apache.axis.Handler;
   import org.apache.axis.ConfigurationException;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.utils.JavaUtils;
  @@ -82,8 +84,7 @@
   
       private SOAPBodyElement element;
       boolean gotRPCElement = false;
  -    boolean isRPCElement = false;
  -    
  +
       private SOAPEnvelope envelope;
       
       BodyBuilder(SOAPEnvelope envelope)
  @@ -101,8 +102,9 @@
           if (log.isDebugEnabled()) {
               log.debug(JavaUtils.getMessage("enter00", "BodyBuilder.onStartChild()"));
           }
  +
  +        QName qname = new QName(namespace, localName);
           SOAPHandler handler = null;
  -        SOAPService service = null;
   
           /** We're about to create a body element.  So we really need
            * to know at this point if this is an RPC service or not.  It's
  @@ -118,31 +120,12 @@
           if ((root != null) && root.equals("0")) isRoot = false;
   
           MessageContext msgContext = context.getMessageContext();
  -        service = msgContext.getService();
  +        OperationDesc operation = msgContext.getOperationByQName(qname);
   
  -        if (isRoot &&
  -            service == null) {
  -
  -            if (log.isDebugEnabled()) {
  -                log.debug(JavaUtils.getMessage("dispatching00",namespace));
  -            }
  -
  -            try {
  -                service = msgContext.getAxisEngine().
  -                                     getConfig().
  -                                     getServiceByNamespaceURI(namespace);
  -                if (service != null)
  -                    msgContext.setService(service);
  -            } catch (ConfigurationException e) {
  -                // oh well...
  -            }
  -        }
  -        
           /** Now we make a plain SOAPBodyElement IF we either:
            * a) have an non-root element, or
            * b) have a non-RPC service
            */
  -
           if (localName.equals(Constants.ELEM_FAULT) &&
               namespace.equals(Constants.URI_SOAP_ENV)) {
               element = new SOAPFaultElement(namespace, localName, prefix,
  @@ -151,23 +134,12 @@
                                              context);
           } else if (!gotRPCElement) {
               if (isRoot &&
  -                (msgContext.isEncoded() || msgContext.isPropertyTrue("wrapped"))) {
  +                (operation == null ||
  +                 (operation.getStyle() !=
  +                  ServiceDesc.STYLE_MESSAGE))) {
                   gotRPCElement = true;
                   element = new RPCElement(namespace, localName, prefix,
  -                                         attributes, context);
  -            } else {
  -                // If we can figure out a method based on the element name,
  -                // we must want an RPCElement.  !!! This needs cleaning up
  -                //
  -                if (service != null) {
  -                    QName qname = new QName(namespace, localName);
  -                    String method = service.getMethodForElementName(qname);
  -                    if (method != null) {
  -                        element = new RPCElement(namespace, localName, prefix,
  -                                                 attributes, context);
  -                        gotRPCElement = true;
  -                    }
  -                }
  +                                         attributes, context, operation);
               }
           }
   
  
  
  
  1.39      +36 -29    xml-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- RPCElement.java	28 Feb 2002 16:45:51 -0000	1.38
  +++ RPCElement.java	5 Mar 2002 14:02:13 -0000	1.39
  @@ -60,6 +60,8 @@
   import org.apache.axis.Constants;
   import org.apache.axis.MessageContext;
   import org.apache.axis.Handler;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.utils.cache.ClassCache;
   import org.apache.axis.utils.cache.JavaClass;
  @@ -78,8 +80,12 @@
       protected boolean needDeser = false;
       protected boolean elementIsFirstParam = false;
   
  -    public RPCElement(String namespace, String localName, String prefix,
  -                      Attributes attributes, DeserializationContext context)
  +    public RPCElement(String namespace,
  +                      String localName,
  +                      String prefix,
  +                      Attributes attributes,
  +                      DeserializationContext context,
  +                      OperationDesc operation)
       {
           super(namespace, localName, prefix, attributes, context);
   
  @@ -88,22 +94,13 @@
           // This came from parsing XML, so we need to deserialize it sometime
           needDeser = true;
   
  -        // IF we're doc/literal... we can't count on the element name
  -        // being the method name.
  -        SOAPService service = context.getMessageContext().getService();
  -        if (service != null && service.getStyle() == SOAPService.STYLE_DOCUMENT) {
  -            // So see if we can map it using metadata
  -            QName qname = new QName(namespace, localName);
  -            String methodName = service.getMethodForElementName(qname);
  -            if (methodName != null) {
  -                this.name = methodName;
  -
  -                // OK, now that we've found a match, we need to note that
  -                // we should start at this level when deserializing
  -                // "parameters"
  -                elementIsFirstParam = true;
  +        if (operation != null) {
  +            this.name = operation.getName();
   
  -            }
  +            // IF we're doc/literal... we can't count on the element name
  +            // being the method name.
  +            elementIsFirstParam = (operation.getStyle() ==
  +                                   ServiceDesc.STYLE_DOCUMENT);
           }
       }
       
  @@ -199,8 +196,14 @@
               }
           }
   
  -        context.pushElementHandler(new EnvelopeHandler(new RPCHandler(this)));
  -        context.setCurElement(this);
  +        if (elementIsFirstParam) {
  +            context.pushElementHandler(new RPCHandler(this));
  +            context.setCurElement(null);
  +        } else {
  +            context.pushElementHandler(new EnvelopeHandler(new RPCHandler(this)));
  +            context.setCurElement(this);
  +        }
  +
           publishToHandler((org.xml.sax.ContentHandler)context);
       }
       
  @@ -239,25 +242,29 @@
   
       protected void outputImpl(SerializationContext context) throws Exception
       {
  -        // Set default namespace if appropriate (to avoid prefix mappings
  -        // in literal style).  Do this only if there is no encodingStyle.
  -        if (encodingStyle.equals("")) {
  -            context.registerPrefixForURI("", getNamespaceURI());
  -        }
           MessageContext msgContext = context.getMessageContext();
           boolean isRPC = true;
  -        if (msgContext != null) {
  -            if ((msgContext.getOperationStyle() != SOAPService.STYLE_RPC) &&
  -                ! msgContext.isPropertyTrue("wrapped"))
  +        if (msgContext != null &&
  +                (msgContext.getOperationStyle() != ServiceDesc.STYLE_RPC) &&
  +                ! msgContext.isPropertyTrue("wrapped")) {
                   isRPC = false;
           }
   
           if (isRPC) {
  -            context.startElement(new QName(namespaceURI,name), attributes);        
  +            // Set default namespace if appropriate (to avoid prefix mappings
  +            // in literal style).  Do this only if there is no encodingStyle.
  +            if (encodingStyle.equals("")) {
  +                context.registerPrefixForURI("", getNamespaceURI());
  +            }
  +            context.startElement(new QName(namespaceURI,name), attributes);
           }
           
           for (int i = 0; i < params.size(); i++) {
  -            ((RPCParam)params.elementAt(i)).serialize(context);
  +            RPCParam param = (RPCParam)params.elementAt(i);
  +            if (!isRPC && encodingStyle.equals("")) {
  +                context.registerPrefixForURI("", param.getQName().getNamespaceURI());
  +            }
  +            param.serialize(context);
           }
           
           if (isRPC) {
  
  
  
  1.44      +27 -8     xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- RPCProvider.java	3 Mar 2002 14:09:08 -0000	1.43
  +++ RPCProvider.java	5 Mar 2002 14:02:13 -0000	1.44
  @@ -59,10 +59,13 @@
   import org.apache.axis.Constants;
   import org.apache.axis.MessageContext;
   import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.description.Parameter;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
   import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.message.SOAPBodyElement;
   import org.apache.axis.server.ParamList;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.cache.JavaClass;
  @@ -100,6 +103,10 @@
                   "RPCProvider.processMessage()"));
           }
   
  +        SOAPService service = msgContext.getService();
  +        ServiceDesc serviceDesc = service.getServiceDescription();
  +        OperationDesc operation = msgContext.getOperation();
  +
           Vector          bodies = reqEnv.getBodyElements();
           if (log.isDebugEnabled()) {
               log.debug(JavaUtils.getMessage("bodyElems00", "" + bodies.size()));
  @@ -110,10 +117,22 @@
           /* RPC call.                                                      */
           /******************************************************************/
           for ( int bNum = 0 ; bNum < bodies.size() ; bNum++ ) {
  -            if (!(bodies.get(bNum) instanceof RPCElement))
  -                continue;
  -            
  -            RPCElement   body  = (RPCElement) bodies.get( bNum );
  +            RPCElement   body;
  +
  +            if (!(bodies.get(bNum) instanceof RPCElement)) {
  +                SOAPBodyElement bodyEl = (SOAPBodyElement)bodies.get(bNum);
  +                if (operation != null) {
  +                    Parameter param = operation.getParameter(bNum);
  +                    Object val = bodyEl.getValueAsType(param.getTypeQName());
  +                    body = new RPCElement("",
  +                                          operation.getName(),
  +                                          new Object [] { val });
  +                } else {
  +                    continue;
  +                }
  +            } else {
  +                body = (RPCElement) bodies.get( bNum );
  +            }
   
               String       mName      = body.getMethodName();
               Vector       args       = body.getParams();
  @@ -294,7 +313,7 @@
               resBody.setPrefix( body.getPrefix() );
               resBody.setNamespaceURI( body.getNamespaceURI() );
               resBody.setEncodingStyle(msgContext.getEncodingStyle());
  -            SOAPService service = msgContext.getService();
  +
               if ( objRes != null ) {
                   // In the old skeleton a param list was returned, which 
                   // contained the RPC params.  Preserve this for now.
  @@ -311,12 +330,12 @@
                       }
                   }
                   else {
  -                    QName returnQName = getReturnQName(service, mName);
  +                    QName returnQName = getReturnQName(serviceDesc, mName);
                       RPCParam param = new RPCParam(returnQName, objRes);
                       resBody.addParam(param);
                   }
               } else if (method[m].getReturnType() != Void.TYPE) {
  -                QName returnQName = getReturnQName(service, mName);
  +                QName returnQName = getReturnQName(serviceDesc, mName);
                   RPCParam param = new RPCParam(returnQName, objRes);
                   resBody.addParam(param);
               }
  @@ -388,7 +407,7 @@
           return parmName;
       }
   
  -    protected QName getReturnQName(SOAPService service, String methodName)
  +    protected QName getReturnQName(ServiceDesc service, String methodName)
       {
           QName ret = null;
   
  
  
  
  1.64      +15 -13    xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- resources.properties	4 Mar 2002 14:22:48 -0000	1.63
  +++ resources.properties	5 Mar 2002 14:02:13 -0000	1.64
  @@ -634,7 +634,7 @@
   invalidSolResp00={0} is a solicit-response style operation and is unsupported.
   invalidNotif00={0} is a notification style operation and is unsupported.
   
  -multipleBindings00=Warning: Multiple bindings use the same portType: {0}.  Only one interface is currently generated, which may not be what you want. 
  +multipleBindings00=Warning: Multiple bindings use the same portType: {0}.  Only one interface is currently generated, which may not be what you want.
   triedArgs00={0} on object "{1}", method name "{2}", tried argument types:  {3}
   triedClass00=tried class:  {0}, method name:  {1}.
   
  @@ -670,17 +670,19 @@
   noCompiler00=Compiler found in your classpath.  Make sure you added 'tools.jar'
   compilerFail00=Please ensure that you have your JDK's rt.jar listed in your classpath. Jikes needs it to operate.
   
  -exception00=Exception: 
  -axisConfigurationException00=ConfigurationException: 
  -parserConfigurationException00=ParserConfigurationException: 
  -SAXException00=SAXException: 
  -javaNetUnknownHostException00=java.net.UnknownHostException: 
  -javaxMailMessagingException00=javax.mail.MessagingException: 
  -javaIOException00=java.io.IOException: 
  -illegalAccessException00=IllegalAccessException: 
  -illegalArgumentException00=IllegalArgumentException: 
  -invocationTargetException00=InvocationTargetException: 
  -instantiationException00=InstantiationException: 
  -malformedURLException00=MalformedURLException: 
  +exception00=Exception:
  +axisConfigurationException00=ConfigurationException:
  +parserConfigurationException00=ParserConfigurationException:
  +SAXException00=SAXException:
  +javaNetUnknownHostException00=java.net.UnknownHostException:
  +javaxMailMessagingException00=javax.mail.MessagingException:
  +javaIOException00=java.io.IOException:
  +illegalAccessException00=IllegalAccessException:
  +illegalArgumentException00=IllegalArgumentException:
  +invocationTargetException00=InvocationTargetException:
  +instantiationException00=InstantiationException:
  +malformedURLException00=MalformedURLException:
   axisFault00=AxisFault:
   axisFault01=AxisFault: {0}
  +badStyle=Bad string for style value - was ''{0}'', should be ''rpc'', ''document'', or ''wrapped''.
  +onlyOneMapping=Only a single <elementMapping> is allowed per-operation at present.
  
  
  
  1.23      +29 -47    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JavaDeployWriter.java	3 Mar 2002 14:09:08 -0000	1.22
  +++ JavaDeployWriter.java	5 Mar 2002 14:02:13 -0000	1.23
  @@ -190,33 +190,12 @@
           BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
           String serviceName = port.getName();
   
  -        boolean isRPC = (bEntry.getBindingStyle() == BindingEntry.STYLE_RPC);
           boolean hasLiteral = bEntry.hasLiteral();
   
           String prefix = Constants.NSPREFIX_WSDD_JAVA;
           pw.println("  <service name=\"" + serviceName
  -                + "\" provider=\"" + (isRPC ? prefix +":RPC" : prefix +":MSG")
  -                + "\"" + (hasLiteral ? " style=\"literal\"" : "") + ">");
  -
  -        List operations = binding.getBindingOperations();
  -        for (Iterator i = operations.iterator(); i.hasNext();) {
  -            BindingOperation bOperation = (BindingOperation) i.next();
  -            Operation operation = bOperation.getOperation();
  -            // We pass "" as the namespace argument because we're just
  -            // interested in the return type for now.
  -            Parameters params =
  -                    symbolTable.getOperationParameters(operation, "", bEntry);
  -            if (params.returnType instanceof DefinedElement) {
  -                QName returnQName = params.returnType.getQName();
  -                pw.print("      <operation name=\"" + operation.getName() +
  -                         "\" returnQName=\"retNS:" +
  -                         returnQName.getLocalPart() +
  -                         "\" xmlns:retNS=\"" +
  -                         returnQName.getNamespaceURI() +
  -                         "\"");
  -                pw.println("/>");
  -            }
  -        }
  +                + "\" provider=\"" + prefix +":RPC"
  +                + "\"" + (hasLiteral ? " style=\"document\"" : "") + ">");
   
           writeDeployBinding(binding);
           writeDeployTypes(hasLiteral);
  @@ -240,49 +219,52 @@
                            + className + "\"/>");
   
           String methodList = "";
  -        HashMap opMap = new HashMap();
           Iterator operationsIterator = binding.getBindingOperations().iterator();
           for (; operationsIterator.hasNext();) {
  -            BindingOperation op = (BindingOperation) operationsIterator.next();
  -            Operation ptOperation = op.getOperation();
  -            OperationType type = ptOperation.getStyle();
  -            
  +            BindingOperation bindingOper = (BindingOperation) operationsIterator.next();
  +            Operation operation = bindingOper.getOperation();
  +            OperationType type = operation.getStyle();
   
               // These operation types are not supported.  The signature
               // will be a string stating that fact.
               if (type != OperationType.NOTIFICATION
                       && type != OperationType.SOLICIT_RESPONSE) {
  -                methodList = methodList + " " + op.getName();
  +                methodList = methodList + " " + bindingOper.getName();
               }
  -            
  -            // map doc/lit elements to operation
  -            if (bEntry.getInputBodyType(ptOperation) == BindingEntry.USE_LITERAL) {
  -                Map parts = ptOperation.getInput().getMessage().getParts();
  +
  +            // We pass "" as the namespace argument because we're just
  +            // interested in the return type for now.
  +            Parameters params =
  +                    symbolTable.getOperationParameters(operation, "", bEntry);
  +            if (params.returnType instanceof DefinedElement) {
  +                QName returnQName = params.returnType.getQName();
  +                pw.println("      <operation name=\"" + operation.getName() +
  +                         "\" returnQName=\"retNS:" +
  +                         returnQName.getLocalPart() +
  +                         "\" xmlns:retNS=\"" +
  +                         returnQName.getNamespaceURI() +
  +                         "\">");
  +
  +                // map doc/lit elements to this operation
  +                Map parts = operation.getInput().getMessage().getParts();
                   if (!parts.isEmpty()) {
                       Iterator i = parts.values().iterator();
                       Part p = (Part) i.next();
                       QName elementQName = p.getElementName();
  -                    if (elementQName != null) {
  -                        opMap.put(elementQName, op.getName());
  -                    }
  +                    String ns = elementQName.getNamespaceURI();
  +                    pw.println("        <elementMapping xmlns:ns=\"" +
  +                            ns + "\" element=\"ns:" +
  +                            elementQName.getLocalPart() + "\"/>");
                   }
  +
  +                pw.println("      </operation>");
               }
  +
           }
   
           pw.println("      <parameter name=\"allowedMethods\" value=\""
                   + methodList.substring(1) + "\"/>");
   
  -        if (!opMap.isEmpty()) {
  -            Iterator i = opMap.keySet().iterator();
  -            while (i.hasNext()) {
  -                QName qn = (QName) i.next();
  -                String ns = qn.getNamespaceURI();
  -                pw.println("      <elementMapping xmlns:ns=\"" + 
  -                        ns + "\" element=\"ns:" + qn.getLocalPart() + "\" " +
  -                        "method=\"" + opMap.get(qn) + "\"/>");
  -            }
  -        }
  -        
           if (emitter.getScope() == Emitter.APPLICATION_SCOPE) {
               pw.println("      <parameter name=\"scope\" value=\"Application\"/>");
           }
  
  
  
  1.39      +9 -8      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- JavaStubWriter.java	28 Feb 2002 16:45:28 -0000	1.38
  +++ JavaStubWriter.java	5 Mar 2002 14:02:13 -0000	1.39
  @@ -528,9 +528,6 @@
           // Encoding: literal or encoded use.
           int use = bEntry.getInputBodyType(operation.getOperation());
           if (use == BindingEntry.USE_LITERAL) {
  -            if (symbolTable.isWrapped()) {
  -                pw.println("        call.setProperty(\"wrapped\", Boolean.TRUE);");
  -            }
               // Turn off encoding
               pw.println("        call.setEncodingStyle(null);");
               // turn off multirefs
  @@ -539,14 +536,18 @@
               pw.println("        call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);");
           }
           
  -        // Style: document or RPC
  +        // Style: document, RPC, or wrapped
           int style = bEntry.getBindingStyle();
  +        String styleStr = "rpc";
           if (style == BindingEntry.STYLE_DOCUMENT) {
  -            pw.println("        call.setOperationStyle(\"document\");");
  -        } else {
  -            pw.println("        call.setOperationStyle(\"rpc\");");
  +            if (symbolTable.isWrapped()) {
  +                styleStr = "wrapped";
  +            } else {
  +                styleStr = "document";
  +            }
           }
  -            
  +        pw.println("        call.setOperationStyle(\"" + styleStr + "\");");
  +
           
           // Operation name
           pw.println("        call.setOperationName(new javax.xml.rpc.namespace.QName(\"" + namespace + "\", \"" + operation.getName() + "\"));" );
  
  
  
  1.3       +1 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaUndeployWriter.java
  
  Index: JavaUndeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaUndeployWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaUndeployWriter.java	10 Jan 2002 20:08:51 -0000	1.2
  +++ JavaUndeployWriter.java	5 Mar 2002 14:02:13 -0000	1.3
  @@ -132,10 +132,7 @@
           BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
           String serviceName = port.getName();
   
  -        boolean isRPC = (bEntry.getBindingStyle() == BindingEntry.STYLE_RPC);
  -
  -        pw.println("  <service name=\"" + serviceName + "\">");
  -        pw.println("  </service>");
  +        pw.println("  <service name=\"" + serviceName + "\"/>");
       } //writeDeployPort
   
   } // class JavaUndeployWriter