axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r484586 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/dispatchers/ test/org/apache/axis2/dispatchers/
Date Fri, 08 Dec 2006 13:16:15 GMT
Author: davidillsley
Date: Fri Dec  8 05:16:12 2006
New Revision: 484586

URL: http://svn.apache.org/viewvc?view=rev&rev=484586
Log:
First part of AXIS2-1457
- New simple dispatchers which dispatch either service or operation
- Unit tests for the new classes
- Will hook these into axis2.xml in future

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/ActionBasedOperationDispatchTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcherTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcherTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcherTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractOperationDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,73 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class AbstractOperationDispatcher extends AbstractHandler {
+
+    public static final String NAME = "AbstractOperationDispatcher";
+    private static final Log log = LogFactory.getLog(AbstractOperationDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AbstractOperationDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+
+    /**
+     * Called by Axis Engine to find the operation.
+     *
+     * @param service
+     * @param messageContext
+     * @return Returns AxisOperation.
+     * @throws AxisFault
+     */
+    public abstract AxisOperation findOperation(AxisService service, MessageContext messageContext)
+            throws AxisFault;
+
+    public abstract void initDispatcher();
+
+    /**
+     * @param msgctx
+     * @throws org.apache.axis2.AxisFault
+     */
+    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
+         if ((msgctx.getAxisService() != null) && (msgctx.getAxisOperation() == null)) {
+            AxisOperation axisOperation = findOperation(msgctx.getAxisService(), msgctx);
+
+            if (axisOperation != null) {
+                if (isDebugEnabled) {
+                    log.debug(Messages.getMessage("operationfound",
+                            axisOperation.getName().getLocalPart()));
+                }
+
+                msgctx.setAxisOperation(axisOperation);
+                //setting axisMessage into messageContext
+                msgctx.setAxisMessage(axisOperation.getMessage(
+                        WSDLConstants.MESSAGE_LABEL_IN_VALUE));
+            }
+        }
+        return InvocationResponse.CONTINUE;
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AbstractServiceDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,67 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class AbstractServiceDispatcher extends AbstractHandler {
+
+    public static final String NAME = "AbstractServiceDispatcher";
+    private static final Log log = LogFactory.getLog(AbstractServiceDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AbstractServiceDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+
+    /**
+     * Called by Axis Engine to find the service.
+     *
+     * @param messageContext
+     * @return Returns AxisService.
+     * @throws AxisFault
+     */
+    public abstract AxisService findService(MessageContext messageContext) throws AxisFault;
+
+    public abstract void initDispatcher();
+
+    /**
+     * @param msgctx
+     * @throws org.apache.axis2.AxisFault
+     */
+    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
+        AxisService axisService = msgctx.getAxisService();
+
+        if (axisService == null) {
+            axisService = findService(msgctx);
+
+            if (axisService != null) {
+                if (isDebugEnabled) {
+                    log.debug(Messages.getMessage("servicefound",
+                            axisService.getName()));
+                }
+                msgctx.setAxisService(axisService);
+            }
+        }
+        return InvocationResponse.CONTINUE;
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/ActionBasedOperationDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,51 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ActionBasedOperationDispatcher extends AbstractOperationDispatcher {
+
+    public static final String NAME = "ActionBasedOperationDispatcher";
+    private static final Log log = LogFactory.getLog(ActionBasedOperationDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+            throws AxisFault {
+        String action = messageContext.getSoapAction();
+
+        if(isDebugEnabled){
+        log.debug("Checking for Operation using Action : " + action);
+        }
+        if (action != null) {
+            AxisOperation op = service.getOperationBySOAPAction(action);
+            if (op == null) {
+                op = service.getOperationByAction(action);
+            }
+            return op;
+        }
+
+        return null;
+    }
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,54 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class RelatesToBasedOperationDispatcher extends AbstractOperationDispatcher {
+
+    public static final String NAME = "RelatesToBasedOperationDispatcher";
+    private static final Log log = LogFactory.getLog(RelatesToBasedOperationDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault {
+        RelatesTo relatesTo = messageContext.getRelatesTo();
+        if(isDebugEnabled){
+            log.debug("Checking for OperationContext using RelatesTo : " + relatesTo);
+        }
+        if((relatesTo!=null) && (relatesTo.getValue()!=null)){
+            ConfigurationContext configurationContext = messageContext.getConfigurationContext();
+            OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue());
+            if(operationContext != null){
+                if(isDebugEnabled){
+                    log.debug("Found OperationContext: " + operationContext);
+                }
+                return operationContext.getAxisOperation();
+            }
+        }
+        return null;
+    }
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,54 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class RelatesToBasedServiceDispatcher extends AbstractServiceDispatcher {
+
+    public static final String NAME = "RelatesToBasedServiceDispatcher";
+    private static final Log log = LogFactory.getLog(RelatesToBasedServiceDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AxisService findService(MessageContext messageContext) throws AxisFault {
+        RelatesTo relatesTo = messageContext.getRelatesTo();
+        if(isDebugEnabled){
+            log.debug("Checking for OperationContext using RelatesTo : " + relatesTo);
+        }
+        if((relatesTo!=null) && (relatesTo.getValue()!=null)){
+            ConfigurationContext configurationContext = messageContext.getConfigurationContext();
+            OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue());
+            if(operationContext != null){
+                if(isDebugEnabled){
+                    log.debug("Found OperationContext: " + operationContext);
+                }
+                return operationContext.getServiceContext().getAxisService();
+            }
+        }
+        return null;
+    }
+    
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,68 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Dispatches the operation based on the information from the target endpoint URL.
+ */
+public class RequestURIBasedOperationDispatcher extends AbstractOperationDispatcher {
+
+    public static final String NAME = "RequestURIBasedOperationDispatcher";
+    private static final Log log = LogFactory.getLog(RequestURIBasedOperationDispatcher.class);
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext)
+     */
+    public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+            throws AxisFault {
+
+        EndpointReference toEPR = messageContext.getTo();
+        if (toEPR != null) {
+            String filePart = toEPR.getAddress();
+            String[] values = Utils.parseRequestURLForServiceAndOperation(filePart,
+                    messageContext.getConfigurationContext().getServiceContextPath());
+
+            if ((values.length >= 2) && (values[1] != null)) {
+                QName operationName = new QName(values[1]);
+                log.debug("Checking for Operation using QName(target endpoint URI fragment) : " + operationName);
+                return service.getOperation(operationName);
+            } else {
+                log.debug("Attempted to check for Operation using target endpoint URI, but the operation fragment was missing");
+                return null;
+            }
+        } else {
+            log.debug("Attempted to check for Operation using null target endpoint URI");
+            return null;
+        }
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,71 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class RequestURIBasedServiceDispatcher extends AbstractServiceDispatcher {
+
+    public static final String NAME = "RequestURIBasedServiceDispatcher";
+    private static final Log log = LogFactory.getLog(RequestURIBasedServiceDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+     */
+    public AxisService findService(MessageContext messageContext) throws AxisFault {
+        EndpointReference toEPR = messageContext.getTo();
+
+        if (toEPR != null) {
+            if(isDebugEnabled){
+                log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+            }
+            String filePart = toEPR.getAddress();
+            //REVIEW: (nagy) Parsing the RequestURI will also give us the operationName if present, so we could conceivably store it in the MessageContext, but doing so and retrieving it is probably no faster than simply reparsing the URI
+            String[] values = Utils.parseRequestURLForServiceAndOperation(filePart,
+                    messageContext.getConfigurationContext().getServiceContextPath());
+
+            if ((values.length >= 1) && (values[0] != null)) {
+                AxisConfiguration registry =
+                        messageContext.getConfigurationContext().getAxisConfiguration();
+
+                return registry.getService(values[0]);
+            } else {
+                if(isDebugEnabled){
+                    log.debug("Attempted to check for Service using target endpoint URI, but the service fragment was missing");
+                }
+                return null;
+            }
+        } else {
+            if(isDebugEnabled){
+                log.debug("Attempted to check for Service using null target endpoint URI");
+            }
+            return null;
+        }
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,60 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SOAPMessageBodyBasedOperationDispatcher extends AbstractOperationDispatcher {
+
+    public static final String NAME = "SOAPMessageBodyBasedOperationDispatcher";
+    private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedOperationDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+            throws AxisFault {
+        OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+        QName operationName = null;
+        if (bodyFirstChild == null) {
+            return null;
+        } else {
+            if(isDebugEnabled){
+            log.debug(
+                    "Checking for Operation using SOAP message body's first child's local name : "
+                            + bodyFirstChild.getLocalName());
+            }
+            operationName = new QName(bodyFirstChild.getLocalName());
+        }
+
+        AxisOperation axisOperation = service.getOperation(operationName);
+
+        if (axisOperation == null) {
+            axisOperation = service.getOperationByMessageName(bodyFirstChild.getLocalName());
+        }
+        return axisOperation;
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcher.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,69 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SOAPMessageBodyBasedServiceDispatcher extends AbstractServiceDispatcher {
+
+    public static final String NAME = "SOAPMessageBodyBasedServiceDispatcher";
+    private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedServiceDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    public AxisService findService(MessageContext messageContext) throws AxisFault {
+        String serviceName = null;
+        OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+
+        if (bodyFirstChild != null) {
+            OMNamespace ns = bodyFirstChild.getNamespace();
+
+            if (ns != null) {
+                String filePart = ns.getNamespaceURI();
+
+                if(isDebugEnabled){
+                log.debug(
+                        "Checking for Service using SOAP message body's first child's namespace : "
+                                + filePart);
+                }
+                String[] values = Utils.parseRequestURLForServiceAndOperation(filePart,
+                        messageContext.getConfigurationContext().getServiceContextPath());
+
+                if (values[0] != null) {
+                    serviceName = values[0];
+
+                    AxisConfiguration registry =
+                            messageContext.getConfigurationContext().getAxisConfiguration();
+
+                    return registry.getService(serviceName);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/ActionBasedOperationDispatchTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/ActionBasedOperationDispatchTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/ActionBasedOperationDispatchTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/ActionBasedOperationDispatchTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,57 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import java.util.ArrayList;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+
+import junit.framework.TestCase;
+
+public class ActionBasedOperationDispatchTest extends TestCase {
+
+    public void testFindOperation() throws Exception{
+        MessageContext messageContext = new MessageContext();
+        AxisService as = new AxisService("Service1");
+        messageContext.setAxisService(as);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        ArrayList op1actions = new ArrayList();
+        op1actions.add("urn:org.apache.axis2.dispatchers.test:operation1");
+        operation1.setWsamappingList(op1actions);
+        
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        ArrayList op2actions = new ArrayList();
+        op2actions.add("urn:org.apache.axis2.dispatchers.test:operation2");
+        operation2.setWsamappingList(op1actions);
+        
+        as.addOperation(operation1);
+        as.addOperation(operation2);
+        
+        as.mapActionToOperation("urn:org.apache.axis2.dispatchers.test:operation1", operation1);
+        as.mapActionToOperation("urn:org.apache.axis2.dispatchers.test:operation2", operation2);
+        
+        messageContext.setWSAAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        
+        ActionBasedOperationDispatcher abod = new ActionBasedOperationDispatcher();
+        abod.invoke(messageContext);
+        assertEquals(operation2, messageContext.getAxisOperation());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedOperationDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,60 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class RelatesToBasedOperationDispatcherTest extends TestCase {
+
+    public void testFindOperation() throws AxisFault{
+
+        MessageContext messageContext = new MessageContext();
+        AxisService as1 = new AxisService("Service1");
+        AxisConfiguration ac = new AxisConfiguration();
+        ac.addService(as1);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        as1.addOperation(operation1);
+        as1.addOperation(operation2);
+        
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        OperationContext oc1 = new OperationContext(operation1);
+        OperationContext oc2 = new OperationContext(operation2);
+        cc.getOperationContextMap().put("urn:org.apache.axis2.dispatchers.messageid:123", oc1);
+        cc.getOperationContextMap().put("urn:org.apache.axis2.dispatchers.messageid:456", oc2);
+        
+        messageContext.setConfigurationContext(cc);
+        messageContext.addRelatesTo(new RelatesTo("urn:org.apache.axis2.dispatchers.messageid:456"));
+        messageContext.setAxisService(as1);
+        
+        RelatesToBasedOperationDispatcher ruisd = new RelatesToBasedOperationDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(operation2, messageContext.getAxisOperation());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RelatesToBasedServiceDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,75 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class RelatesToBasedServiceDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        
+        MessageContext messageContext = new MessageContext();
+        
+        AxisConfiguration ac = new AxisConfiguration();
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        
+        AxisService as1 = new AxisService("Service1");
+        ServiceContext sc1 = new ServiceContext(as1, new ServiceGroupContext(cc, null));
+        
+        AxisService as2 = new AxisService("Service2");
+        
+        ServiceContext sc2 = new ServiceContext(as2, new ServiceGroupContext(cc, null));
+        
+        
+        ac.addService(as1);
+        ac.addService(as2);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        as1.addOperation(operation1);
+        as2.addOperation(operation2);
+        
+        
+        OperationContext oc1 = new OperationContext(operation1);
+        oc1.setParent(sc1);
+        OperationContext oc2 = new OperationContext(operation2);
+        oc2.setParent(sc2);
+        
+        cc.getOperationContextMap().put("urn:org.apache.axis2.dispatchers.messageid:123", oc1);
+        cc.getOperationContextMap().put("urn:org.apache.axis2.dispatchers.messageid:456", oc2);
+        
+        messageContext.setConfigurationContext(cc);
+        messageContext.addRelatesTo(new RelatesTo("urn:org.apache.axis2.dispatchers.messageid:456"));
+        
+        RelatesToBasedServiceDispatcher ruisd = new RelatesToBasedServiceDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(as2, messageContext.getAxisService());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedOperationDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,54 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import junit.framework.TestCase;
+
+public class RequestURIBasedOperationDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        MessageContext messageContext = new MessageContext();
+        AxisService as1 = new AxisService("Service1");
+        AxisConfiguration ac = new AxisConfiguration();
+        ac.addService(as1);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        as1.addOperation(operation1);
+        as1.addOperation(operation2);
+        
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        messageContext.setConfigurationContext(cc);
+        
+        messageContext.setTo(new EndpointReference("http://127.0.0.1:8080/axis2/services/Service1/operation2"));
+        messageContext.setAxisService(as1);
+        
+        RequestURIBasedOperationDispatcher ruisd = new RequestURIBasedOperationDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(operation2, messageContext.getAxisOperation());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,45 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import junit.framework.TestCase;
+
+public class RequestURIBasedServiceDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        MessageContext messageContext = new MessageContext();
+        AxisService as1 = new AxisService("Service1");
+        AxisService as2 = new AxisService("Service2");
+        AxisConfiguration ac = new AxisConfiguration();
+        ac.addService(as1);
+        ac.addService(as2);
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        messageContext.setConfigurationContext(cc);
+        
+        messageContext.setTo(new EndpointReference("http://127.0.0.1:8080/axis2/services/Service2"));
+        
+        RequestURIBasedServiceDispatcher ruisd = new RequestURIBasedServiceDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(as2, messageContext.getAxisService());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,61 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class SOAPMessageBodyBasedOperationDispatcherTest extends TestCase {
+
+    public void testFindOperation() throws AxisFault{
+        MessageContext messageContext = new MessageContext();
+        AxisService as1 = new AxisService("Service1");
+        AxisConfiguration ac = new AxisConfiguration();
+        ac.addService(as1);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        as1.addOperation(operation1);
+        as1.addOperation(operation2);
+        
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        messageContext.setConfigurationContext(cc);
+        
+        messageContext.setAxisService(as1);
+        
+        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
+        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
+        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://test", "pfx"));
+        messageContext.setEnvelope(se);
+        
+        
+        SOAPMessageBodyBasedOperationDispatcher ruisd = new SOAPMessageBodyBasedOperationDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(operation2, messageContext.getAxisOperation());
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java?view=auto&rev=484586
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java Fri Dec  8 05:16:12 2006
@@ -0,0 +1,51 @@
+/*
+* 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 org.apache.axis2.dispatchers;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class SOAPMessageBodyBasedServiceDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        MessageContext messageContext = new MessageContext();
+        AxisService as1 = new AxisService("Service1");
+        AxisService as2 = new AxisService("Service2");
+        AxisConfiguration ac = new AxisConfiguration();
+        ac.addService(as1);
+        ac.addService(as2);
+        ConfigurationContext cc = new ConfigurationContext(ac);
+        messageContext.setConfigurationContext(cc);
+        
+        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
+        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
+        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://127.0.0.1:8080/axis2/services/Service2", "pfx"));
+        messageContext.setEnvelope(se);
+        
+        
+        SOAPMessageBodyBasedServiceDispatcher ruisd = new SOAPMessageBodyBasedServiceDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(as2, messageContext.getAxisService());
+    }
+
+}



---------------------------------------------------------------------
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