You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2007/02/26 18:35:17 UTC

svn commit: r511914 - in /webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers: RawXMLINOnlyMessageReceiver.java RawXMLINOutMessageReceiver.java

Author: thilina
Date: Mon Feb 26 09:35:15 2007
New Revision: 511914

URL: http://svn.apache.org/viewvc?view=rev&rev=511914
Log:
removing duplicate code... Adding license headers

Modified:
    webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOnlyMessageReceiver.java
    webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOutMessageReceiver.java

Modified: webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOnlyMessageReceiver.java?view=diff&rev=511914&r1=511913&r2=511914
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOnlyMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOnlyMessageReceiver.java Mon Feb 26 09:35:15 2007
@@ -11,55 +11,8 @@
 
 import java.lang.reflect.Method;
 
-public class RawXMLINOnlyMessageReceiver extends AbstractInMessageReceiver
+public class RawXMLINOnlyMessageReceiver extends org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
         implements MessageReceiver, Pingable {
-
-    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) &&
-                    methods[i].getParameterTypes().length == 1 &&
-                    OMElement.class.getName().equals(
-                            methods[i].getParameterTypes()[0].getName()) &&
-                    "void".equals(methods[i].getReturnType().getName())) {
-                return methods[i];
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Invokes the bussiness logic invocation on the service implementation class
-     *
-     * @param msgContext the incoming message context
-     * @throws org.apache.axis2.AxisFault on invalid method (wrong signature)
-     */
-    public void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
-        try {
-
-            // get the implementation class for the Web Service
-            Object obj = getTheImplementationObject(msgContext);
-
-            // find the WebService method
-            Class implClass = obj.getClass();
-
-            AxisOperation op = msgContext.getAxisOperation();
-            Method method = findOperation(op, implClass);
-
-            if (method != null) {
-                method.invoke(
-                        obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
-            } else {
-                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOnly"));
-            }
-
-        } catch (Exception e) {
-            throw AxisFault.makeFault(e);
-        }
-    }
 
     public int ping() throws AxisFault {
         // get the implementation class for the Web Service

Modified: webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOutMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOutMessageReceiver.java?view=diff&rev=511914&r1=511913&r2=511914
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOutMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/samples/ping/src/samples/ping/receivers/RawXMLINOutMessageReceiver.java Mon Feb 26 09:35:15 2007
@@ -1,6 +1,23 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package samples.ping.receivers;
 
 import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.context.MessageContext;
@@ -13,65 +30,8 @@
 
 import java.lang.reflect.Method;
 
-public class RawXMLINOutMessageReceiver extends AbstractInOutSyncMessageReceiver
+public class RawXMLINOutMessageReceiver extends org.apache.axis2.receivers.RawXMLINOutMessageReceiver
         implements MessageReceiver, Pingable {
-
-    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) &&
-                    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 null;
-    }
-
-    /**
-     * Invokes the bussiness logic invocation on the service implementation class
-     *
-     * @param msgContext    the incoming message context
-     * @param newmsgContext the response message context
-     * @throws org.apache.axis2.AxisFault on invalid method (wrong signature) or behaviour (return null)
-     */
-    public void invokeBusinessLogic(MessageContext msgContext, MessageContext newmsgContext)
-            throws AxisFault {
-        try {
-
-            // get the implementation class for the Web Service
-            Object obj = getTheImplementationObject(msgContext);
-
-            // find the WebService method
-            Class implClass = obj.getClass();
-
-            AxisOperation opDesc = msgContext.getAxisOperation();
-            Method method = findOperation(opDesc, implClass);
-
-            if (method != null) {
-                OMElement result = (OMElement) method.invoke(
-                        obj, new Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
-                SOAPFactory fac = getSOAPFactory(msgContext);
-                SOAPEnvelope envelope = fac.getDefaultEnvelope();
-
-                if (result != null) {
-                    envelope.getBody().addChild(result);
-                }
-
-                newmsgContext.setEnvelope(envelope);
-
-            } else {
-                throw new AxisFault(Messages.getMessage("methodDoesNotExistInOut"));
-            }
-        } catch (Exception e) {
-            throw AxisFault.makeFault(e);
-        }
-    }
 
     public int ping() throws AxisFault{
         // get the implementation class for the Web Service



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