ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snic...@apache.org
Subject cvs commit: xml-soap/java/src/org/apache/soap/providers CORBAProvider.java EntityEJBProvider.java StatefulEJBProvider.java StatelessEJBProvider.java
Date Fri, 11 Oct 2002 18:41:42 GMT
snichol     2002/10/11 11:41:42

  Modified:    java/docs changes.html
               java/src/org/apache/soap/providers CORBAProvider.java
                        EntityEJBProvider.java StatefulEJBProvider.java
                        StatelessEJBProvider.java
  Log:
  Support messaging in the Stateless EJB and CORBA provieders.  Throw an
  exception for messaging calls in the Stateful EJB and Entity EJB providers
  rather than throwing a NPE.
  
  Revision  Changes    Path
  1.48      +3 -0      xml-soap/java/docs/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/docs/changes.html,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- changes.html	4 Oct 2002 19:50:19 -0000	1.47
  +++ changes.html	11 Oct 2002 18:41:41 -0000	1.48
  @@ -90,6 +90,9 @@
         of Maps.</li>
         <li>Read HTTP[S] proxy information from system properties if not explicitly
         specified.</li>
  +      <li>Support messaging in the Stateless EJB and CORBA provieders.  Throw an
  +      exception for messaging calls in the Stateful EJB and Entity EJB providers
  +      rather than throwing a NPE.</li>
       </ul>
     </li>
   </ul>
  
  
  
  1.3       +60 -40    xml-soap/java/src/org/apache/soap/providers/CORBAProvider.java
  
  Index: CORBAProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/providers/CORBAProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CORBAProvider.java	28 Aug 2002 18:53:40 -0000	1.2
  +++ CORBAProvider.java	11 Oct 2002 18:41:41 -0000	1.3
  @@ -87,6 +87,7 @@
       private DeploymentDescriptor dd;
       private Envelope envelope;
       private Call call;
  +    private String methodName;
       private String targetObjectURI;
   
       private String interfaceClassName = null;
  @@ -102,13 +103,23 @@
         this.dd = dd;
         this.envelope = env;
         this.call = call;
  +      this.methodName = methodName;
         this.targetObjectURI = targetObjectURI;
   
  -      // call on a valid method name?
  -      if (!RPCRouter.validCall(dd, call)) {
  -        throw new SOAPException(Constants.FAULT_CODE_SERVER,
  -                                "Method '" + call.getMethodName() +
  -                                "' is not supported.");
  +      if (call != null) {
  +          // RPC call on a valid method name?
  +          if (!RPCRouter.validCall(dd, call)) {
  +              throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                      "Method '" + call.getMethodName () +
  +                                      "' is not supported.");
  +          }
  +      } else {
  +          // Message on a valid method name?
  +          if (!MessageRouter.validMessage(dd, methodName)) {
  +              throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                      "Method '" + methodName +
  +                                      "' is not supported.");
  +          }
         }
   
         // Read deployment descriptor options
  @@ -189,33 +200,40 @@
        */
       public void invoke(SOAPContext reqContext, SOAPContext resContext)
                           throws SOAPException {
  -      // Get information about the call
  -      String methodName = call.getMethodName();
  -      Vector methodParameters = call.getParams();
  -      String respEncStyle = call.getEncodingStyleURI();
  -
         Parameter ret = null;
         Object[] args = null;
         Class[] argTypes = null;
  +      String respEncStyle = null;
   
  -      if (methodParameters != null) {
  -        int parametersCount = methodParameters.size();
  -        args = new Object[parametersCount];
  -        argTypes = new Class[parametersCount];
  -
  -        for (int i = 0; i < parametersCount; i++) {
  -          Parameter param = (Parameter) methodParameters.elementAt(i);
  -          args[i] = param.getValue();
  -          argTypes[i] = param.getType();
  -
  -          if (respEncStyle == null) {
  -            respEncStyle = param.getEncodingStyleURI();
  +      if (call != null) {
  +        // Set up RPC parameters
  +        Vector methodParameters = call.getParams();
  +        respEncStyle = call.getEncodingStyleURI();
  +  
  +        if (methodParameters != null) {
  +          int parametersCount = methodParameters.size();
  +          args = new Object[parametersCount];
  +          argTypes = new Class[parametersCount];
  +  
  +          for (int i = 0; i < parametersCount; i++) {
  +            Parameter param = (Parameter) methodParameters.elementAt(i);
  +            args[i] = param.getValue();
  +            argTypes[i] = param.getType();
  +  
  +            if (respEncStyle == null) {
  +              respEncStyle = param.getEncodingStyleURI();
  +            }
             }
           }
  -      }
  -
  -      if (respEncStyle == null)
  -        respEncStyle = Constants.NS_URI_SOAP_ENC;
  +  
  +        if (respEncStyle == null)
  +          respEncStyle = Constants.NS_URI_SOAP_ENC;
  +      } else {
  +          // Set up message parameters
  +          argTypes = new Class[] {Envelope.class, SOAPContext.class,
  +                                                  SOAPContext.class};
  +          args = new Object[] {envelope, reqContext, resContext};
  +      }  
   
         // Find the method an invoke it
         try {
  @@ -233,19 +251,21 @@
           throw new SOAPException(Constants.FAULT_CODE_SERVER, t.getMessage(), t);
         }
   
  -      // Create the response
  -      try {
  -        Response resp = new Response(targetObjectURI, methodName, ret, null,
  -                                     null, respEncStyle, resContext);
  -        Envelope env = resp.buildEnvelope();
  -        StringWriter sw = new StringWriter();
  -        env.marshall(sw, call.getSOAPMappingRegistry(), resContext);
  -        resContext.setRootPart(sw.toString(), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
  -      } catch (Exception e) {
  -        if (e instanceof SOAPException) throw (SOAPException) e;
  -        throw new SOAPException(Constants.FAULT_CODE_SERVER,
  -                                "Error creating response: " + e,
  -                                e);
  +      if (call != null) {
  +          // process the RPC return value
  +        try {
  +          Response resp = new Response(targetObjectURI, methodName, ret, null,
  +                                       null, respEncStyle, resContext);
  +          Envelope env = resp.buildEnvelope();
  +          StringWriter sw = new StringWriter();
  +          env.marshall(sw, call.getSOAPMappingRegistry(), resContext);
  +          resContext.setRootPart(sw.toString(), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
  +        } catch (Exception e) {
  +          if (e instanceof SOAPException) throw (SOAPException) e;
  +          throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                  "Error creating response: " + e,
  +                                  e);
  +        }
         }
  -   }
  +    }
   }
  
  
  
  1.6       +62 -0     xml-soap/java/src/org/apache/soap/providers/EntityEJBProvider.java
  
  Index: EntityEJBProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/providers/EntityEJBProvider.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EntityEJBProvider.java	28 Aug 2002 18:53:40 -0000	1.5
  +++ EntityEJBProvider.java	11 Oct 2002 18:41:41 -0000	1.6
  @@ -1,3 +1,60 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2000 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 "SOAP" 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 and was
  + * originally based on software copyright (c) 2000, International
  + * Business Machines, Inc., http://www.apache.org.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
   package org.apache.soap.providers;
   
   import java.io.* ;
  @@ -32,6 +89,11 @@
                        String targetObjectURI, 
                        SOAPContext reqContext) throws SOAPException {
   
  +    if (origCall == null) {
  +      throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                              "The provider only supports RPC calls.");
  +    }
  +  
       HttpServlet servletRef = (HttpServlet) reqContext.getProperty( Constants.BAG_HTTPSERVLET
);
       HttpSession sessObj    = (HttpSession) reqContext.getProperty( Constants.BAG_HTTPSESSION
);
   
  
  
  
  1.10      +62 -0     xml-soap/java/src/org/apache/soap/providers/StatefulEJBProvider.java
  
  Index: StatefulEJBProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/providers/StatefulEJBProvider.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StatefulEJBProvider.java	28 Aug 2002 18:53:40 -0000	1.9
  +++ StatefulEJBProvider.java	11 Oct 2002 18:41:41 -0000	1.10
  @@ -1,3 +1,60 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2000 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 "SOAP" 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 and was
  + * originally based on software copyright (c) 2000, International
  + * Business Machines, Inc., http://www.apache.org.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
   package org.apache.soap.providers;
   
   import java.io.* ;
  @@ -230,6 +287,11 @@
                        SOAPContext reqContext)
                 throws SOAPException {
      
  +    if (origCall == null) {
  +      throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                              "The provider only supports RPC calls.");
  +    }
  +  
       HttpServlet servletRef = (HttpServlet) reqContext.getProperty( Constants.BAG_HTTPSERVLET
);
       HttpSession sessObj    = (HttpSession) reqContext.getProperty( Constants.BAG_HTTPSESSION
);
   
  
  
  
  1.9       +62 -42    xml-soap/java/src/org/apache/soap/providers/StatelessEJBProvider.java
  
  Index: StatelessEJBProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/providers/StatelessEJBProvider.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StatelessEJBProvider.java	29 Aug 2002 20:06:13 -0000	1.8
  +++ StatelessEJBProvider.java	11 Oct 2002 18:41:41 -0000	1.9
  @@ -136,30 +136,38 @@
           Parameter ret = null;
           Object[] args = null;
           Class[] argTypes = null;
  +        String respEncStyle = null;
   
  -        String methodName = call.getMethodName();
  -        Vector methodParameters = call.getParams();
  -        String respEncStyle = call.getEncodingStyleURI();
  -
  -        if (methodParameters != null) {
  -            int parametersCount = methodParameters.size ();
  -            args = new Object[parametersCount];
  -            argTypes = new Class[parametersCount];
  -
  -            for (int i = 0; i < parametersCount; i++) {
  -                Parameter param = (Parameter) methodParameters.elementAt (i);
  -                args[i] = param.getValue ();
  -                argTypes[i] = param.getType ();
  -
  -                if (respEncStyle == null) {
  -                    respEncStyle = param.getEncodingStyleURI ();
  +        if (call != null) {
  +            // Set up RPC parameters
  +            Vector methodParameters = call.getParams();
  +            respEncStyle = call.getEncodingStyleURI();
  +    
  +            if (methodParameters != null) {
  +                int parametersCount = methodParameters.size ();
  +                args = new Object[parametersCount];
  +                argTypes = new Class[parametersCount];
  +    
  +                for (int i = 0; i < parametersCount; i++) {
  +                    Parameter param = (Parameter) methodParameters.elementAt (i);
  +                    args[i] = param.getValue ();
  +                    argTypes[i] = param.getType ();
  +    
  +                    if (respEncStyle == null) {
  +                        respEncStyle = param.getEncodingStyleURI ();
  +                    }
                   }
               }
  +    
  +            if (respEncStyle == null)
  +                respEncStyle = Constants.NS_URI_SOAP_ENC;
  +        } else {
  +            // Set up message parameters
  +            argTypes = new Class[] {Envelope.class, SOAPContext.class,
  +                                                    SOAPContext.class};
  +            args = new Object[] {envelope, reqContext, resContext};
           }
   
  -        if (respEncStyle == null)
  -            respEncStyle = Constants.NS_URI_SOAP_ENC;
  -
           try {
               Method m = MethodUtils.getMethod(remoteObjRef, methodName, argTypes);
               Bean result = new Bean(m.getReturnType(), m.invoke(remoteObjRef, args));
  @@ -185,24 +193,27 @@
                                       t);
           }
   
  -        try {
  -            Response resp = new Response(targetObjectURI,       // URI
  -                                         call.getMethodName(),  // Method
  -                                         (Parameter) ret,       // ReturnValue
  -                                         null,                  // Params
  -                                         null,                  // Header
  -                                         respEncStyle,          // encoding
  -                                         resContext);           // response soapcontext
  -            Envelope env = resp.buildEnvelope();
  -            StringWriter sw = new StringWriter();
  -            env.marshall(sw, call.getSOAPMappingRegistry(), resContext);
  -            resContext.setRootPart(sw.toString(), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
  -        } catch( Exception e ) {
  -            if (e instanceof SOAPException)
  -                throw (SOAPException) e;
  -            throw new SOAPException(Constants.FAULT_CODE_SERVER,
  -                                    "Error creating response: " + e,
  -                                    e);
  +        if (call != null) {
  +            // process the RPC return value
  +            try {
  +                Response resp = new Response(targetObjectURI,       // URI
  +                                             call.getMethodName(),  // Method
  +                                             (Parameter) ret,       // ReturnValue
  +                                             null,                  // Params
  +                                             null,                  // Header
  +                                             respEncStyle,          // encoding
  +                                             resContext);           // response soapcontext
  +                Envelope env = resp.buildEnvelope();
  +                StringWriter sw = new StringWriter();
  +                env.marshall(sw, call.getSOAPMappingRegistry(), resContext);
  +                resContext.setRootPart(sw.toString(), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
  +            } catch( Exception e ) {
  +                if (e instanceof SOAPException)
  +                    throw (SOAPException) e;
  +                throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                        "Error creating response: " + e,
  +                                        e);
  +            }
           }
       }
   
  @@ -218,11 +229,20 @@
           this.methodName      = methodName ;
           this.targetObjectURI = targetObjectURI ;
   
  -        // call on a valid method name?
  -        if (!RPCRouter.validCall(dd, call)) {
  -            throw new SOAPException(Constants.FAULT_CODE_SERVER,
  -                                    "Method '" + call.getMethodName () +
  -                                    "' is not supported.");
  +        if (call != null) {
  +            // RPC call on a valid method name?
  +            if (!RPCRouter.validCall(dd, call)) {
  +                throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                        "Method '" + call.getMethodName () +
  +                                        "' is not supported.");
  +            }
  +        } else {
  +            // Message on a valid method name?
  +            if (!MessageRouter.validMessage(dd, methodName)) {
  +                throw new SOAPException(Constants.FAULT_CODE_SERVER,
  +                                        "Method '" + methodName +
  +                                        "' is not supported.");
  +            }
           }
   
           Hashtable props = dd.getProps();
  
  
  

Mime
View raw message