axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r452775 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers: RawXMLINOnlyMessageReceiver.java RawXMLINOutAsyncMessageReceiver.java RawXMLINOutMessageReceiver.java
Date Wed, 04 Oct 2006 07:18:37 GMT
Author: asankha
Date: Wed Oct  4 00:18:36 2006
New Revision: 452775

URL: http://svn.apache.org/viewvc?view=rev&rev=452775
Log:
Fix 1296 for RawXMLINOutAsyncMessageReceiver and fix the RawXMLINOnlyMessageReceiver and RawXMLINOutMessageReceiver
to properly look at the return types as well when selecting the method for invocation.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java?view=diff&rev=452775&r1=452774&r2=452775
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
Wed Oct  4 00:18:36 2006
@@ -53,7 +53,8 @@
             if (methods[i].getName().equals(methodName) &&
                 methods[i].getParameterTypes().length == 1 &&
                 OMElement.class.getName().equals(
-                    methods[i].getParameterTypes()[0].getName())) {
+                    methods[i].getParameterTypes()[0].getName()) &&
+                "void".equals(methods[i].getReturnType().getName())) {
                 return methods[i];
             }
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java?view=diff&rev=452775&r1=452774&r2=452775
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
Wed Oct  4 00:18:36 2006
@@ -29,24 +29,42 @@
 *
 */
 
+/**
+ * The RawXMLINOutAsyncMessageReceiver MessageReceiver hands over the raw request received
to
+ * the service implementation class as an OMElement. The implementation class is expected
+ * to return back the OMElement to be returned to the caller. This is an asynchronous
+ * MessageReceiver, and finds the service implementation class to invoke by referring to
+ * the "ServiceClass" parameter value specified in the service.xml and looking at the
+ * methods of the form OMElement <<methodName>>(OMElement request)
+ *
+ * @see RawXMLINOnlyMessageReceiver
+ * @see RawXMLINOutMessageReceiver
+ */
 public class RawXMLINOutAsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver {
 
-    public Method findOperation(AxisOperation op, Class ImplClass) {
-        Method method = null;
+    private Method findOperation(AxisOperation op, Class ImplClass) {
         String methodName = op.getName().getLocalPart();
         Method[] methods = ImplClass.getMethods();
 
         for (int i = 0; i < methods.length; i++) {
-            if (methods[i].getName().equals(methodName)) {
-                method = methods[i];
-
-                break;
+            if (methods[i].getName().equals(methodName) &&
+                methods[i].getParameterTypes().length == 1 &&
+                OMElement.class.getName().equals(
+                    methods[i].getParameterTypes()[0].getName()) &&
+                OMElement.class.getName().equals(methods[i].getReturnType().getName())) {
+                return methods[i];
             }
         }
 
-        return method;
+        return null;
     }
 
+    /**
+     * Invokes the bussiness logic invocation on the service implementation class
+     * @param msgContext the incoming message context
+     * @param newmsgContext the response message context
+     * @throws AxisFault on invalid method (wrong signature) or behaviour (return null)
+     */
     public void invokeBusinessLogic(MessageContext msgContext, MessageContext newmsgContext)
             throws AxisFault {
         try {
@@ -65,47 +83,23 @@
             Method method = findOperation(opDesc, ImplClass);
 
             if (method != null) {
-                Class[]  parameters = method.getParameterTypes();
-                Object[] args;
-
-                if ((parameters == null) || (parameters.length == 0)) {
-                    args = new Object[0];
-                } else if (parameters.length == 1) {
-                    OMElement omElement = msgContext.getEnvelope().getBody().getFirstElement();
-                    args = new Object[]{omElement};
-                } else {
-                    throw new AxisFault(Messages.getMessage("rawXmlProviderIsLimited"));
-                }
-
-                OMElement result;
-                try {
-                    result = (OMElement) method.invoke(obj, args);
-                } catch (Exception e) {
-                    throw new AxisFault(e.getMessage());
-                }
-
-                AxisService service = msgContext.getAxisService();
-                service.getTargetNamespace();
-                if (result != null) {
-                    result.declareNamespace(service.getTargetNamespace(),
-                            service.getTargetNamespacePrefix());
-                }
-
-                OMElement bodyContent;
-
+                OMElement result = (OMElement) method.invoke(
+                    obj, new Object[] {msgContext.getEnvelope().getBody().getFirstElement()});
                 SOAPFactory fac = getSOAPFactory(msgContext);
-                bodyContent = result;
-
                 SOAPEnvelope envelope = fac.getDefaultEnvelope();
 
-                if (bodyContent != null) {
-                    envelope.getBody().addChild(bodyContent);
+                if (result != null) {
+                    AxisService service = msgContext.getAxisService();
+                    result.declareNamespace(service.getTargetNamespace(),
+                        service.getTargetNamespacePrefix());
+                    envelope.getBody().addChild(result);
                 }
 
                 newmsgContext.setEnvelope(envelope);
+
             } else {
-                throw new AxisFault(Messages.getMessage("methodNotImplemented",
-                        opDesc.getName().toString()));
+                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut",
+                    opDesc.getName().toString()));
             }
         } catch (Exception e) {
             throw AxisFault.makeFault(e);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java?view=diff&rev=452775&r1=452774&r2=452775
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
Wed Oct  4 00:18:36 2006
@@ -56,7 +56,8 @@
             if (methods[i].getName().equals(methodName) &&
                 methods[i].getParameterTypes().length == 1 &&
                 OMElement.class.getName().equals(
-                    methods[i].getParameterTypes()[0].getName())) {
+                    methods[i].getParameterTypes()[0].getName()) &&
+                OMElement.class.getName().equals(methods[i].getReturnType().getName())) {
                 return methods[i];
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message