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 da...@apache.org on 2006/08/10 16:27:16 UTC

svn commit: r430392 [1/2] - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/engine/ core/src/org/apache/axis2/util/ integration/ integration/test-resources...

Author: davidillsley
Date: Thu Aug 10 07:27:14 2006
New Revision: 430392

URL: http://svn.apache.org/viewvc?rev=430392&view=rev
Log:
TargetResolver patches from AXIS2-988

Added:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/TargetResolver.java
    webservices/axis2/trunk/java/modules/integration/test-resources/deployment/
    webservices/axis2/trunk/java/modules/integration/test-resources/deployment/deployment.both.axis2.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/TestTargetResolver.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2_default.xml
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
    webservices/axis2/trunk/java/modules/integration/maven.xml

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java Thu Aug 10 07:27:14 2006
@@ -17,6 +17,15 @@
 
 package org.apache.axis2.deployment;
 
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
@@ -36,18 +45,10 @@
 import org.apache.axis2.phaseresolver.PhaseException;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.util.TargetResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
 public class AxisConfigBuilder extends DescriptionBuilder {
 
     protected static final Log log = LogFactory.getLog(AxisConfigBuilder.class);
@@ -99,6 +100,10 @@
             // Process Observers
             Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
 
+            // Process TargetResolvers
+            OMElement targetResolvers = config_element.getFirstChildWithName(new QName(TAG_TARGET_RESOLVERS));
+            processTargetResolvers(axisConfig, targetResolvers);
+            
             processObservers(obs_ittr);
 
             // processing Phase orders
@@ -135,6 +140,26 @@
 
         } catch (XMLStreamException e) {
             throw new DeploymentException(e);
+        }
+    }
+
+    private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) {
+        if(targetResolvers != null){
+           Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
+           while(iterator.hasNext()){
+               OMElement targetResolver = (OMElement)iterator.next();
+               OMAttribute classNameAttribute = targetResolver.getAttribute(new QName(TAG_CLASS_NAME));
+               String className = classNameAttribute.getAttributeValue();
+               try {
+                   Class classInstance = Class.forName(className);
+                   TargetResolver tr = (TargetResolver)classInstance.newInstance();
+                   axisConfig.addTargetResolver(tr);
+                } catch (Exception e) {
+                    if(log.isTraceEnabled()){
+                        log.trace("processTargetResolvers: Exception thrown initialising TargetResolver: "+e.getMessage());
+                    }
+                }
+           }
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java Thu Aug 10 07:27:14 2006
@@ -44,6 +44,8 @@
     String TAG_LABEL = "label";
     String TAG_HANDLER = "handler";
     String TAG_TYPE = "type";
+    String TAG_TARGET_RESOLVERS = "targetResolvers";
+    String TAG_TARGET_RESOLVER = "targetResolver";
     String TAG_TRANSPORT_SENDER = "transportSender";
     String TAG_TRANSPORT_RECEIVER = "transportReceiver";
     String TAG_SERVICE_GROUP = "serviceGroup";

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2_default.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2_default.xml?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2_default.xml (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2_default.xml Thu Aug 10 07:27:14 2006
@@ -40,6 +40,18 @@
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                          class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
     </messageReceivers>
+    
+    <!-- ================================================= -->
+    <!-- Target Resolvers -->
+    <!-- ================================================= -->
+    <!-- Uncomment the following and specify the class name for your TargetResolver to add -->
+    <!-- a TargetResolver. TargetResolvers are used to process the To EPR for example to -->
+    <!-- choose a server in a cluster -->
+    <!--<targetResolvers>-->
+    <!--<targetResolver class="" />-->
+    <!--</targetResolvers>-->
+    
+    
     <!-- ================================================= -->
     <!-- Transport Ins -->
     <!-- ================================================= -->

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Thu Aug 10 07:27:14 2006
@@ -1,459 +1,463 @@
-/*
-* Copyright 2004,2006 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 org.apache.axis2.description;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFault;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-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.engine.AxisEngine;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.util.CallbackReceiver;
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.axis2.wsdl.WSDLConstants;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class OutInAxisOperation extends InOutAxisOperation {
-    public OutInAxisOperation() {
-        super();
-        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_IN);
-    }
-
-    public OutInAxisOperation(QName name) {
-        super(name);
-        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_IN);
-    }
-
-    public void addMessageContext(MessageContext msgContext,
-                                  OperationContext opContext) throws AxisFault {
-        HashMap mep = opContext.getMessageContexts();
-        MessageContext immsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_IN_VALUE);
-        MessageContext outmsgContext = (MessageContext) mep
-                .get(MESSAGE_LABEL_OUT_VALUE);
-
-        if ((immsgContext != null) && (outmsgContext != null)) {
-            throw new AxisFault(Messages.getMessage("mepcompleted"));
-        }
-
-        if (outmsgContext == null) {
-            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
-        } else {
-            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
-            opContext.setComplete(true);
-        }
-    }
-
-    /**
-     * Returns a MEP client for an Out-IN operation. This client can be used to
-     * interact with a server which is offering an In-Out operation. To use the
-     * client, you must call addMessageContext() with a message context and then
-     * call execute() to execute the client.
-     *
-     * @param sc      The service context for this client to live within. Cannot be
-     *                null.
-     * @param options Options to use as defaults for this client. If any options are
-     *                set specifically on the client then those override options
-     *                here.
-     */
-    public OperationClient createClient(ServiceContext sc, Options options) {
-        return new OutInAxisOperationClient(this, sc, options);
-    }
-}
-
-/**
- * MEP client for moi.
- */
-class OutInAxisOperationClient implements OperationClient {
-
-    private AxisOperation axisOp;
-
-    protected ServiceContext sc;
-
-    protected Options options;
-
-    protected OperationContext oc;
-
-    protected Callback callback;
-
-    /*
-     * indicates whether the MEP execution has completed (and hence ready for
-     * resetting)
-     */
-    boolean completed;
-
-    OutInAxisOperationClient(OutInAxisOperation axisOp, ServiceContext sc,
-                             Options options) {
-        this.axisOp = axisOp;
-        this.sc = sc;
-        this.options = options;
-        this.completed = false;
-        this.oc = new OperationContext(axisOp);
-        this.oc.setParent(this.sc);
-    }
-
-    /**
-     * Sets the options that should be used for this particular client. This
-     * resets the entire set of options to use the new options - so you'd lose
-     * any option cascading that may have been set up.
-     *
-     * @param options the options
-     */
-    public void setOptions(Options options) {
-        this.options = options;
-    }
-
-    /**
-     * Returns the options used by this client. If you want to set a single
-     * option, then the right way is to call getOptions() and set specific
-     * options.
-     *
-     * @return Returns the options, which will never be null.
-     */
-    public Options getOptions() {
-        return options;
-    }
-
-    /**
-     * Adds message context to operation context , so that it will handle the
-     * logic correctly if the OperationContext is null then new one will be
-     * created , and Operation Context will become null when some one calls reset().
-     *
-     * @param mc
-     * @throws AxisFault
-     */
-    public void addMessageContext(MessageContext mc) throws AxisFault {
-        mc.setServiceContext(sc);
-        if (mc.getMessageID() == null) {
-            setMessageID(mc);
-        }
-        axisOp.registerOperationContext(mc, oc);
-    }
-
-    /**
-     * Returns the message context for a given message label.
-     *
-     * @param messageLabel :
-     *                     label of the message and that can be either "Out" or "In" and
-     *                     nothing else
-     * @return Returns MessageContext.
-     * @throws AxisFault
-     */
-    public MessageContext getMessageContext(String messageLabel)
-            throws AxisFault {
-        return oc.getMessageContext(messageLabel);
-    }
-
-    public void setCallback(Callback callback) {
-        this.callback = callback;
-    }
-
-    /**
-     * Create a message ID for the given message context if needed. If user gives an option with
-     * MessageID then just copy that into MessageContext , and with that there can be mutiple
-     * message with same MessageID unless user call setOption for each invocation.
-     * <p/>
-     * If user want to give message ID then the better way is to set the message ID in the option and
-     * call setOption for each invocation then the right thing will happen.
-     * <p/>
-     * If user does not give a message ID then the new one will be created and set that into Message
-     * Context.
-     *
-     * @param mc the message context whose id is to be set
-     */
-    private void setMessageID(MessageContext mc) {
-        // now its the time to put the parameters set by the user in to the
-        // correct places and to the
-        // if there is no message id still, set a new one.
-        String messageId = options.getMessageId();
-        if (messageId == null || "".equals(messageId)) {
-            messageId = UUIDGenerator.getUUID();
-        }
-        mc.setMessageID(messageId);
-    }
-
-
-    /**
-     * Executes the MEP. What this does depends on the specific MEP client. The
-     * basic idea is to have the MEP client execute and do something with the
-     * messages that have been added to it so far. For example, if its an Out-In
-     * MEP, then if the Out message has been set, then executing the client asks
-     * it to send the message and get the In message, possibly using a different
-     * thread.
-     *
-     * @param block Indicates whether execution should block or return ASAP. What
-     *              block means is of course a function of the specific MEP
-     *              client. IGNORED BY THIS MEP CLIENT.
-     * @throws AxisFault if something goes wrong during the execution of the MEP.
-     */
-    public void execute(boolean block) throws AxisFault {
-        if (completed) {
-            throw new AxisFault(Messages.getMessage("mepiscomplted"));
-        }
-        ConfigurationContext cc = sc.getConfigurationContext();
-
-        // copy interesting info from options to message context.
-        MessageContext mc = oc
-                .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-        if (mc == null) {
-            throw new AxisFault(Messages.getMessage("outmsgctxnull"));
-        }
-
-        mc.setOptions(options);
-        // if the transport to use for sending is not specified, try to find it
-        // from the URL
-        TransportOutDescription transportOut = options.getTransportOut();
-        if (transportOut == null) {
-            EndpointReference toEPR = (options.getTo() != null) ? options
-                    .getTo() : mc.getTo();
-            transportOut = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
-        }
-        mc.setTransportOut(transportOut);
-
-
-        if (options.getTransportIn() == null && mc.getTransportIn() == null) {
-            mc.setTransportIn(ClientUtils.inferInTransport(cc
-                    .getAxisConfiguration(), options, mc));
-        } else if (mc.getTransportIn() == null) {
-            mc.setTransportIn(options.getTransportIn());
-        }
-
-        if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
-            String soapaction = axisOp.getSoapAction();
-            if (soapaction != null) {
-                mc.setSoapAction(soapaction);
-            }
-        }
-        addReferenceParameters(mc);
-        if (options.isUseSeparateListener()) {
-            CallbackReceiver callbackReceiver = (CallbackReceiver) axisOp
-                    .getMessageReceiver();
-            callbackReceiver.addCallback(mc.getMessageID(), callback);
-            EndpointReference replyToFromTransport = mc.getConfigurationContext().getListenerManager().
-                    getEPRforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), mc
-                            .getTransportIn().getName()
-                            .getLocalPart());
-
-            if (mc.getReplyTo() == null) {
-                mc.setReplyTo(replyToFromTransport);
-            } else {
-                mc.getReplyTo().setAddress(replyToFromTransport.getAddress());
-            }
-            //if dont do this , this guy will wait till its gets HTTP 202 in the case
-            //HTTP
-            mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE);
-            AxisEngine engine = new AxisEngine(cc);
-            mc.getConfigurationContext().registerOperationContext(mc.getMessageID(), oc);
-            engine.send(mc);
-            
-            // Options object reused so soapAction needs to be removed so
-            // that soapAction+wsa:Action on response don't conflict
-            options.setAction("");
-        } else {
-            if (block) {
-                // Send the SOAP Message and receive a response
-                MessageContext response = send(mc);
-                // check for a fault and return the result
-                if (response != null) {
-                    SOAPEnvelope resEnvelope = response.getEnvelope();
-                    if (resEnvelope.getBody().hasFault()) {
-                        SOAPFault soapFault = resEnvelope.getBody().getFault();
-
-                        //we need to call engine.receiveFault
-                        AxisEngine engine = new AxisEngine(mc.getConfigurationContext());
-                        engine.receiveFault(response);
-                        if (options.isExceptionToBeThrownOnSOAPFault()) {
-                            // does the SOAPFault has a detail element for Excpetion
-
-                            throw new AxisFault(soapFault.getCode(), soapFault.getReason(),
-                                    soapFault.getNode(), soapFault.getRole(), soapFault.getDetail());
-
-                        }
-                    }
-                }
-                completed = true;
-            } else {
-                sc.getConfigurationContext().getThreadPool().execute(
-                        new NonBlockingInvocationWorker(callback, mc));
-            }
-        }
-    }
-
-    private void addReferenceParameters(MessageContext msgctx) {
-        EndpointReference to = msgctx.getTo();
-        if (options.isManageSession()) {
-            EndpointReference tepr = sc.getTargetEPR();
-            if (tepr != null) {
-                Map map = tepr.getAllReferenceParameters();
-                if (map != null) {
-                    Iterator valuse = map.values().iterator();
-                    while (valuse.hasNext()) {
-                        Object refparaelement = valuse.next();
-                        if (refparaelement instanceof OMElement) {
-                            to.addReferenceParameter((OMElement) refparaelement);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Sends the message using a two way transport and waits for a response
-     *
-     * @param msgctx
-     * @return Returns MessageContext.
-     * @throws AxisFault
-     */
-    protected MessageContext send(MessageContext msgctx) throws AxisFault {
-
-        AxisEngine engine = new AxisEngine(msgctx.getConfigurationContext());
-
-        // create the responseMessageContext
-        MessageContext responseMessageContext = new MessageContext();
-
-        // This is a hack - Needs to change
-        responseMessageContext.setOptions(options);
-
-
-        responseMessageContext.setServerSide(false);
-        responseMessageContext.setMessageID(msgctx.getMessageID());
-        addMessageContext(responseMessageContext);
-
-        //sending the message
-        engine.send(msgctx);
-        responseMessageContext.setDoingREST(msgctx.isDoingREST());
-
-        responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgctx
-                .getProperty(MessageContext.TRANSPORT_IN));
-        responseMessageContext.setTransportIn(msgctx.getTransportIn());
-        responseMessageContext.setTransportOut(msgctx.getTransportOut());
-
-        // Options object reused above so soapAction needs to be removed so
-        // that soapAction+wsa:Action on response don't conflict
-        responseMessageContext.setSoapAction("");
-        
-        if (responseMessageContext.getEnvelope() == null) {
-            // If request is REST we assume the responseMessageContext is REST, so
-            // set the variable
-
-            SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(
-                    responseMessageContext, msgctx.getEnvelope().getNamespace()
-                    .getNamespaceURI());
-            if (resenvelope != null) {
-                responseMessageContext.setEnvelope(resenvelope);
-                engine = new AxisEngine(msgctx.getConfigurationContext());
-                engine.receive(responseMessageContext);
-                if (responseMessageContext.getReplyTo() != null) {
-                    sc.setTargetEPR(responseMessageContext.getReplyTo());
-                }
-            } else {
-                throw new AxisFault(Messages
-                        .getMessage("blockingInvocationExpectsResponse"));
-            }
-        }
-        return responseMessageContext;
-    }
-
-    /**
-     * Resets the MEP client to a clean status after the MEP has completed. This
-     * is how you can reuse a MEP client. NOTE: this does not reset the options;
-     * only the internal state so the client can be used again.
-     *
-     * @throws AxisFault if reset is called before the MEP client has completed an
-     *                   interaction.
-     */
-    public void reset() throws AxisFault {
-        if (!completed) {
-            throw new AxisFault(Messages.getMessage("cannotreset"));
-        }
-        oc = null;
-        completed = false;
-    }
-
-    public void complete(MessageContext msgCtxt) throws AxisFault {
-        TransportOutDescription trsout = msgCtxt.getTransportOut();
-        if (trsout != null) {
-            trsout.getSender().cleanup(msgCtxt);
-        }
-    }
-
-    public OperationContext getOperationContext() {
-        return oc;
-    }
-
-    /**
-     * This class is the workhorse for a non-blocking invocation that uses a two
-     * way transport.
-     */
-    private class NonBlockingInvocationWorker implements Runnable {
-        private Callback callback;
-
-        private MessageContext msgctx;
-
-        public NonBlockingInvocationWorker(Callback callback,
-                                           MessageContext msgctx) {
-            this.callback = callback;
-            this.msgctx = msgctx;
-        }
-
-        public void run() {
-            try {
-                // send the request and wait for reponse
-                MessageContext response = send(msgctx);
-                // call the callback
-                if (response != null) {
-                    SOAPEnvelope resenvelope = response.getEnvelope();
-                    SOAPBody body = resenvelope.getBody();
-                    if (body.hasFault()) {
-                        Exception ex = body.getFault().getException();
-
-                        if (ex != null) {
-                            callback.onError(ex);
-                        } else {
-                            callback.onError(new Exception(body.getFault()
-                                    .getReason().getText()));
-                        }
-                    } else {
-                        AsyncResult asyncResult = new AsyncResult(response);
-
-                        callback.onComplete(asyncResult);
-                    }
-                }
-
-                callback.setComplete(true);
-            } catch (Exception e) {
-                callback.onError(e);
-            }
-        }
-    }
-}
+/*
+* Copyright 2004,2006 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 org.apache.axis2.description;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+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.engine.AxisEngine;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.util.CallbackReceiver;
+import org.apache.axis2.util.UUIDGenerator;
+import org.apache.axis2.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class OutInAxisOperation extends InOutAxisOperation {
+    public OutInAxisOperation() {
+        super();
+        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_IN);
+    }
+
+    public OutInAxisOperation(QName name) {
+        super(name);
+        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_IN);
+    }
+
+    public void addMessageContext(MessageContext msgContext,
+                                  OperationContext opContext) throws AxisFault {
+        HashMap mep = opContext.getMessageContexts();
+        MessageContext immsgContext = (MessageContext) mep
+                .get(MESSAGE_LABEL_IN_VALUE);
+        MessageContext outmsgContext = (MessageContext) mep
+                .get(MESSAGE_LABEL_OUT_VALUE);
+
+        if ((immsgContext != null) && (outmsgContext != null)) {
+            throw new AxisFault(Messages.getMessage("mepcompleted"));
+        }
+
+        if (outmsgContext == null) {
+            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
+        } else {
+            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
+            opContext.setComplete(true);
+        }
+    }
+
+    /**
+     * Returns a MEP client for an Out-IN operation. This client can be used to
+     * interact with a server which is offering an In-Out operation. To use the
+     * client, you must call addMessageContext() with a message context and then
+     * call execute() to execute the client.
+     *
+     * @param sc      The service context for this client to live within. Cannot be
+     *                null.
+     * @param options Options to use as defaults for this client. If any options are
+     *                set specifically on the client then those override options
+     *                here.
+     */
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        return new OutInAxisOperationClient(this, sc, options);
+    }
+}
+
+/**
+ * MEP client for moi.
+ */
+class OutInAxisOperationClient implements OperationClient {
+
+    private AxisOperation axisOp;
+
+    protected ServiceContext sc;
+
+    protected Options options;
+
+    protected OperationContext oc;
+
+    protected Callback callback;
+
+    /*
+     * indicates whether the MEP execution has completed (and hence ready for
+     * resetting)
+     */
+    boolean completed;
+
+    OutInAxisOperationClient(OutInAxisOperation axisOp, ServiceContext sc,
+                             Options options) {
+        this.axisOp = axisOp;
+        this.sc = sc;
+        this.options = options;
+        this.completed = false;
+        this.oc = new OperationContext(axisOp);
+        this.oc.setParent(this.sc);
+    }
+
+    /**
+     * Sets the options that should be used for this particular client. This
+     * resets the entire set of options to use the new options - so you'd lose
+     * any option cascading that may have been set up.
+     *
+     * @param options the options
+     */
+    public void setOptions(Options options) {
+        this.options = options;
+    }
+
+    /**
+     * Returns the options used by this client. If you want to set a single
+     * option, then the right way is to call getOptions() and set specific
+     * options.
+     *
+     * @return Returns the options, which will never be null.
+     */
+    public Options getOptions() {
+        return options;
+    }
+
+    /**
+     * Adds message context to operation context , so that it will handle the
+     * logic correctly if the OperationContext is null then new one will be
+     * created , and Operation Context will become null when some one calls reset().
+     *
+     * @param mc
+     * @throws AxisFault
+     */
+    public void addMessageContext(MessageContext mc) throws AxisFault {
+        mc.setServiceContext(sc);
+        if (mc.getMessageID() == null) {
+            setMessageID(mc);
+        }
+        axisOp.registerOperationContext(mc, oc);
+    }
+
+    /**
+     * Returns the message context for a given message label.
+     *
+     * @param messageLabel :
+     *                     label of the message and that can be either "Out" or "In" and
+     *                     nothing else
+     * @return Returns MessageContext.
+     * @throws AxisFault
+     */
+    public MessageContext getMessageContext(String messageLabel)
+            throws AxisFault {
+        return oc.getMessageContext(messageLabel);
+    }
+
+    public void setCallback(Callback callback) {
+        this.callback = callback;
+    }
+
+    /**
+     * Create a message ID for the given message context if needed. If user gives an option with
+     * MessageID then just copy that into MessageContext , and with that there can be mutiple
+     * message with same MessageID unless user call setOption for each invocation.
+     * <p/>
+     * If user want to give message ID then the better way is to set the message ID in the option and
+     * call setOption for each invocation then the right thing will happen.
+     * <p/>
+     * If user does not give a message ID then the new one will be created and set that into Message
+     * Context.
+     *
+     * @param mc the message context whose id is to be set
+     */
+    private void setMessageID(MessageContext mc) {
+        // now its the time to put the parameters set by the user in to the
+        // correct places and to the
+        // if there is no message id still, set a new one.
+        String messageId = options.getMessageId();
+        if (messageId == null || "".equals(messageId)) {
+            messageId = UUIDGenerator.getUUID();
+        }
+        mc.setMessageID(messageId);
+    }
+
+
+    /**
+     * Executes the MEP. What this does depends on the specific MEP client. The
+     * basic idea is to have the MEP client execute and do something with the
+     * messages that have been added to it so far. For example, if its an Out-In
+     * MEP, then if the Out message has been set, then executing the client asks
+     * it to send the message and get the In message, possibly using a different
+     * thread.
+     *
+     * @param block Indicates whether execution should block or return ASAP. What
+     *              block means is of course a function of the specific MEP
+     *              client. IGNORED BY THIS MEP CLIENT.
+     * @throws AxisFault if something goes wrong during the execution of the MEP.
+     */
+    public void execute(boolean block) throws AxisFault {
+        if (completed) {
+            throw new AxisFault(Messages.getMessage("mepiscomplted"));
+        }
+        ConfigurationContext cc = sc.getConfigurationContext();
+
+        // copy interesting info from options to message context.
+        MessageContext mc = oc
+                .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+        if (mc == null) {
+            throw new AxisFault(Messages.getMessage("outmsgctxnull"));
+        }
+
+        mc.setOptions(options);
+        
+        // do Target Resolution
+        cc.getAxisConfiguration().getTargetResolverChain().resolveTarget(mc);
+        
+        // if the transport to use for sending is not specified, try to find it
+        // from the URL
+        TransportOutDescription transportOut = options.getTransportOut();
+        if (transportOut == null) {
+            EndpointReference toEPR = (options.getTo() != null) ? options
+                    .getTo() : mc.getTo();
+            transportOut = ClientUtils.inferOutTransport(cc
+                    .getAxisConfiguration(), toEPR, mc);
+        }
+        mc.setTransportOut(transportOut);
+
+
+        if (options.getTransportIn() == null && mc.getTransportIn() == null) {
+            mc.setTransportIn(ClientUtils.inferInTransport(cc
+                    .getAxisConfiguration(), options, mc));
+        } else if (mc.getTransportIn() == null) {
+            mc.setTransportIn(options.getTransportIn());
+        }
+
+        if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
+            String soapaction = axisOp.getSoapAction();
+            if (soapaction != null) {
+                mc.setSoapAction(soapaction);
+            }
+        }
+        addReferenceParameters(mc);
+        if (options.isUseSeparateListener()) {
+            CallbackReceiver callbackReceiver = (CallbackReceiver) axisOp
+                    .getMessageReceiver();
+            callbackReceiver.addCallback(mc.getMessageID(), callback);
+            EndpointReference replyToFromTransport = mc.getConfigurationContext().getListenerManager().
+                    getEPRforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), mc
+                            .getTransportIn().getName()
+                            .getLocalPart());
+
+            if (mc.getReplyTo() == null) {
+                mc.setReplyTo(replyToFromTransport);
+            } else {
+                mc.getReplyTo().setAddress(replyToFromTransport.getAddress());
+            }
+            //if dont do this , this guy will wait till its gets HTTP 202 in the case
+            //HTTP
+            mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE);
+            AxisEngine engine = new AxisEngine(cc);
+            mc.getConfigurationContext().registerOperationContext(mc.getMessageID(), oc);
+            engine.send(mc);
+            
+            // Options object reused so soapAction needs to be removed so
+            // that soapAction+wsa:Action on response don't conflict
+            options.setAction("");
+        } else {
+            if (block) {
+                // Send the SOAP Message and receive a response
+                MessageContext response = send(mc);
+                // check for a fault and return the result
+                if (response != null) {
+                    SOAPEnvelope resEnvelope = response.getEnvelope();
+                    if (resEnvelope.getBody().hasFault()) {
+                        SOAPFault soapFault = resEnvelope.getBody().getFault();
+
+                        //we need to call engine.receiveFault
+                        AxisEngine engine = new AxisEngine(mc.getConfigurationContext());
+                        engine.receiveFault(response);
+                        if (options.isExceptionToBeThrownOnSOAPFault()) {
+                            // does the SOAPFault has a detail element for Excpetion
+
+                            throw new AxisFault(soapFault.getCode(), soapFault.getReason(),
+                                    soapFault.getNode(), soapFault.getRole(), soapFault.getDetail());
+
+                        }
+                    }
+                }
+                completed = true;
+            } else {
+                sc.getConfigurationContext().getThreadPool().execute(
+                        new NonBlockingInvocationWorker(callback, mc));
+            }
+        }
+    }
+
+    private void addReferenceParameters(MessageContext msgctx) {
+        EndpointReference to = msgctx.getTo();
+        if (options.isManageSession()) {
+            EndpointReference tepr = sc.getTargetEPR();
+            if (tepr != null) {
+                Map map = tepr.getAllReferenceParameters();
+                if (map != null) {
+                    Iterator valuse = map.values().iterator();
+                    while (valuse.hasNext()) {
+                        Object refparaelement = valuse.next();
+                        if (refparaelement instanceof OMElement) {
+                            to.addReferenceParameter((OMElement) refparaelement);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Sends the message using a two way transport and waits for a response
+     *
+     * @param msgctx
+     * @return Returns MessageContext.
+     * @throws AxisFault
+     */
+    protected MessageContext send(MessageContext msgctx) throws AxisFault {
+
+        AxisEngine engine = new AxisEngine(msgctx.getConfigurationContext());
+
+        // create the responseMessageContext
+        MessageContext responseMessageContext = new MessageContext();
+
+        // This is a hack - Needs to change
+        responseMessageContext.setOptions(options);
+
+
+        responseMessageContext.setServerSide(false);
+        responseMessageContext.setMessageID(msgctx.getMessageID());
+        addMessageContext(responseMessageContext);
+
+        //sending the message
+        engine.send(msgctx);
+        responseMessageContext.setDoingREST(msgctx.isDoingREST());
+
+        responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgctx
+                .getProperty(MessageContext.TRANSPORT_IN));
+        responseMessageContext.setTransportIn(msgctx.getTransportIn());
+        responseMessageContext.setTransportOut(msgctx.getTransportOut());
+
+        // Options object reused above so soapAction needs to be removed so
+        // that soapAction+wsa:Action on response don't conflict
+        responseMessageContext.setSoapAction("");
+        
+        if (responseMessageContext.getEnvelope() == null) {
+            // If request is REST we assume the responseMessageContext is REST, so
+            // set the variable
+
+            SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(
+                    responseMessageContext, msgctx.getEnvelope().getNamespace()
+                    .getNamespaceURI());
+            if (resenvelope != null) {
+                responseMessageContext.setEnvelope(resenvelope);
+                engine = new AxisEngine(msgctx.getConfigurationContext());
+                engine.receive(responseMessageContext);
+                if (responseMessageContext.getReplyTo() != null) {
+                    sc.setTargetEPR(responseMessageContext.getReplyTo());
+                }
+            } else {
+                throw new AxisFault(Messages
+                        .getMessage("blockingInvocationExpectsResponse"));
+            }
+        }
+        return responseMessageContext;
+    }
+
+    /**
+     * Resets the MEP client to a clean status after the MEP has completed. This
+     * is how you can reuse a MEP client. NOTE: this does not reset the options;
+     * only the internal state so the client can be used again.
+     *
+     * @throws AxisFault if reset is called before the MEP client has completed an
+     *                   interaction.
+     */
+    public void reset() throws AxisFault {
+        if (!completed) {
+            throw new AxisFault(Messages.getMessage("cannotreset"));
+        }
+        oc = null;
+        completed = false;
+    }
+
+    public void complete(MessageContext msgCtxt) throws AxisFault {
+        TransportOutDescription trsout = msgCtxt.getTransportOut();
+        if (trsout != null) {
+            trsout.getSender().cleanup(msgCtxt);
+        }
+    }
+
+    public OperationContext getOperationContext() {
+        return oc;
+    }
+
+    /**
+     * This class is the workhorse for a non-blocking invocation that uses a two
+     * way transport.
+     */
+    private class NonBlockingInvocationWorker implements Runnable {
+        private Callback callback;
+
+        private MessageContext msgctx;
+
+        public NonBlockingInvocationWorker(Callback callback,
+                                           MessageContext msgctx) {
+            this.callback = callback;
+            this.msgctx = msgctx;
+        }
+
+        public void run() {
+            try {
+                // send the request and wait for reponse
+                MessageContext response = send(msgctx);
+                // call the callback
+                if (response != null) {
+                    SOAPEnvelope resenvelope = response.getEnvelope();
+                    SOAPBody body = resenvelope.getBody();
+                    if (body.hasFault()) {
+                        Exception ex = body.getFault().getException();
+
+                        if (ex != null) {
+                            callback.onError(ex);
+                        } else {
+                            callback.onError(new Exception(body.getFault()
+                                    .getReason().getText()));
+                        }
+                    } else {
+                        AsyncResult asyncResult = new AsyncResult(response);
+
+                        callback.onComplete(asyncResult);
+                    }
+                }
+
+                callback.setComplete(true);
+            } catch (Exception e) {
+                callback.onError(e);
+            }
+        }
+    }
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java Thu Aug 10 07:27:14 2006
@@ -1,384 +1,388 @@
-/*
-* Copyright 2004,2006 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 org.apache.axis2.description;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.async.Callback;
-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.engine.AxisEngine;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.axis2.wsdl.WSDLConstants;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class OutOnlyAxisOperation extends AxisOperation {
-
-    private AxisMessage inFaultMessage;
-
-    // just to keep the inflow , there wont be any usage
-    private ArrayList inPhases;
-
-    private AxisMessage outFaultMessage;
-
-    private AxisMessage outMessage;
-
-    public OutOnlyAxisOperation() {
-        super();
-        createMessage();
-        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_ONLY);
-    }
-
-    public OutOnlyAxisOperation(QName name) {
-        super(name);
-        createMessage();
-        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_ONLY);
-    }
-
-    public void addMessage(AxisMessage message, String label) {
-        if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
-            outMessage = message;
-        } else {
-            throw new UnsupportedOperationException("Not yet implemented");
-        }
-    }
-
-    public void addMessageContext(MessageContext msgContext,
-                                  OperationContext opContext) throws AxisFault {
-        if (!opContext.isComplete()) {
-            opContext.getMessageContexts().put(MESSAGE_LABEL_OUT_VALUE,
-                    msgContext);
-            opContext.setComplete(true);
-        } else {
-            throw new AxisFault(Messages.getMessage("mepcompleted"));
-        }
-    }
-
-    public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault {
-        HashMap mep = opContext.getMessageContexts();
-        MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE);
-
-        if (faultMessageCtxt != null) {
-            throw new AxisFault(Messages.getMessage("mepcompleted"));
-        } else {
-            mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext);
-            opContext.setComplete(true);
-            opContext.cleanup();
-        }
-    }
-
-    private void createMessage() {
-        outMessage = new AxisMessage();
-        outMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-        inFaultMessage = new AxisMessage();
-        outFaultMessage = new AxisMessage();
-        inPhases = new ArrayList();
-    }
-
-    public AxisMessage getMessage(String label) {
-        if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
-            return outMessage;
-        } else {
-            throw new UnsupportedOperationException("Not yet implemented");
-        }
-    }
-
-    public ArrayList getPhasesInFaultFlow() {
-        return inFaultMessage.getMessageFlow();
-    }
-
-    public ArrayList getPhasesOutFaultFlow() {
-        return outFaultMessage.getMessageFlow();
-    }
-
-    public ArrayList getPhasesOutFlow() {
-        return outMessage.getMessageFlow();
-    }
-
-    public ArrayList getRemainingPhasesInFlow() {
-        return inPhases;
-    }
-
-    public void setPhasesInFaultFlow(ArrayList list) {
-        inFaultMessage.setMessageFlow(list);
-    }
-
-    public void setPhasesOutFaultFlow(ArrayList list) {
-        outFaultMessage.setMessageFlow(list);
-    }
-
-    public void setPhasesOutFlow(ArrayList list) {
-        outMessage.setMessageFlow(list);
-    }
-
-    public void setRemainingPhasesInFlow(ArrayList list) {
-        inPhases = list;
-    }
-
-    /**
-     * Returns a MEP client for an Out-only operation. This client can be used to
-     * interact with a server which is offering an In-only operation. To use the
-     * client, you must call addMessageContext() with a message context and then
-     * call execute() to execute the client. Note that the execute method's
-     * block parameter is ignored by this client and also the setMessageReceiver
-     * method cannot be used.
-     *
-     * @param sc      The service context for this client to live within. Cannot be
-     *                null.
-     * @param options Options to use as defaults for this client. If any options are
-     *                set specifically on the client then those override options
-     *                here.
-     */
-    public OperationClient createClient(ServiceContext sc, Options options) {
-        return new OutOnlyAxisOperationClient(this, sc, options);
-    }
-}
-
-/**
- * MEP client for moi.
- */
-class OutOnlyAxisOperationClient implements OperationClient {
-    OutOnlyAxisOperation axisOp;
-
-    ServiceContext sc;
-
-    Options options;
-
-    MessageContext mc;
-
-    OperationContext oc;
-
-    /*
-    * indicates whether the MEP execution has completed (and hence ready for
-    * resetting)
-    */
-    boolean completed;
-
-    OutOnlyAxisOperationClient(OutOnlyAxisOperation axisOp, ServiceContext sc,
-                               Options options) {
-        this.axisOp = axisOp;
-        this.sc = sc;
-        this.options = options;
-        this.completed = false;
-        oc = new OperationContext(axisOp, sc);
-    }
-
-    /**
-     * Sets the options that should be used for this particular client. This
-     * resets the entire set of options to use the new options - so you'd lose
-     * any option cascading that may have been set up.
-     *
-     * @param options the options
-     */
-    public void setOptions(Options options) {
-        this.options = options;
-    }
-
-    /**
-     * Returns the options used by this client. If you want to set a single
-     * option, then the right way is to do getOptions() and set specific
-     * options.
-     *
-     * @return Returns the options, which will never be null.
-     */
-    public Options getOptions() {
-        return options;
-    }
-
-    /**
-     * Adds a message context to the client for processing. This method must not
-     * process the message - it only records it in the MEP client. Processing
-     * only occurs when execute() is called.
-     *
-     * @param mc the message context
-     * @throws AxisFault if this is called inappropriately.
-     */
-    public void addMessageContext(MessageContext mc) throws AxisFault {
-        if (this.mc != null) {
-            throw new AxisFault(Messages.getMessage("cannotaddmsgctx"));
-        }
-        this.mc = mc;
-        if (mc.getMessageID() == null) {
-            setMessageID(mc);
-        }
-        mc.setServiceContext(sc);
-        axisOp.registerOperationContext(mc, oc);
-        this.completed = false;
-    }
-
-    /**
-     * Returns a message from the client - will return null if the requested
-     * message is not available.
-     *
-     * @param messageLabel the message label of the desired message context
-     * @return Returns the desired message context or null if its not available.
-     * @throws AxisFault if the message label is invalid
-     */
-    public MessageContext getMessageContext(String messageLabel)
-            throws AxisFault {
-        if (messageLabel.equals(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)) {
-            return mc;
-        }
-        throw new AxisFault(Messages.getMessage("unknownMsgLabel", messageLabel));
-    }
-
-    /**
-     * Sets the message receiver to be executed when a message comes into the MEP
-     * and the MEP is executed. This is the way the MEP client provides
-     * notification that a message has been received by it. Exactly when its
-     * executed and under what conditions is a function of the specific MEP
-     * client.
-     */
-    public void setCallback(Callback callback) {
-        throw new UnsupportedOperationException(
-                "This feature is not supported by this MEP");
-    }
-
-    /**
-     * Create a message ID for the given message context if needed. If user gives an option with
-     * MessageID then just copy that into MessageContext , and with that there can be mutiple
-     * message with same MessageID unless user call setOption for each invocation.
-     * <p/>
-     * If user want to give message ID then the better way is to set the message ID in the option and
-     * call setOption for each invocation then the right thing will happen.
-     * <p/>
-     * If user does not give a message ID then the new one will be created and set that into Message
-     * Context.
-     *
-     * @param mc the message context whose id is to be set
-     */
-    private void setMessageID(MessageContext mc) {
-        // now its the time to put the parameters set by the user in to the
-        // correct places and to the
-        // if there is no message id still, set a new one.
-        String messageId = options.getMessageId();
-        if (messageId == null || "".equals(messageId)) {
-            messageId = UUIDGenerator.getUUID();
-        }
-        mc.setMessageID(messageId);
-    }
-
-    private void addReferenceParameters(MessageContext msgctx) {
-        EndpointReference to = msgctx.getTo();
-        if (options.isManageSession()) {
-            EndpointReference tepr = sc.getTargetEPR();
-            if (tepr != null) {
-                Map map = tepr.getAllReferenceParameters();
-                Iterator valuse = map.values().iterator();
-                while (valuse.hasNext()) {
-                    Object refparaelement = valuse.next();
-                    if (refparaelement instanceof OMElement) {
-                        to.addReferenceParameter((OMElement) refparaelement);
-                    }
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Executes the MEP. What this does depends on the specific MEP client. The
-     * basic idea is to have the MEP client execute and do something with the
-     * messages that have been added to it so far. For example, if its an Out-In
-     * MEP, then if the Out message has been set, then executing the client asks
-     * it to send the message and get the In message, possibly using a different
-     * thread.
-     *
-     * @param block Indicates whether execution should block or return ASAP. What
-     *              block means is of course a function of the specific MEP
-     *              client. IGNORED BY THIS MEP CLIENT.
-     * @throws AxisFault if something goes wrong during the execution of the MEP.
-     */
-    public void execute(boolean block) throws AxisFault {
-        if (completed) {
-            throw new AxisFault(Messages.getMessage("mepiscomplted"));
-        }
-        ConfigurationContext cc = sc.getConfigurationContext();
-
-        // set options on the message context
-        mc.setOptions(options);
-        // setting messge ID if it null
-        // if the transport to use for sending is not specified, try to find it
-        // from the URL
-        TransportOutDescription senderTransport = options.getTransportOut();
-        if (senderTransport == null) {
-            EndpointReference toEPR = (options.getTo() != null) ? options
-                    .getTo() : mc.getTo();
-            senderTransport = ClientUtils.inferOutTransport(cc
-                    .getAxisConfiguration(), toEPR, mc);
-        }
-        mc.setTransportOut(senderTransport);
-
-        if (mc.getSoapAction() == null) {
-            String soapaction = axisOp.getSoapAction();
-            if (soapaction != null) {
-                mc.setSoapAction(soapaction);
-            }
-        }
-
-        // create the operation context for myself
-        OperationContext oc = new OperationContext(axisOp, sc);
-        oc.addMessageContext(mc);
-        addReferenceParameters(mc);
-        // ship it out
-        AxisEngine engine = new AxisEngine(cc);
-        if (!block) {
-            mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE);
-        }
-        engine.send(mc);
-        // all done
-        completed = true;
-    }
-
-    /**
-     * Resets the MEP client to a clean status after the MEP has completed. This
-     * is how you can reuse a MEP client. NOTE: this does not reset the options;
-     * only the internal state so the client can be used again.
-     *
-     * @throws AxisFault if reset is called before the MEP client has completed an
-     *                   interaction.
-     */
-    public void reset() throws AxisFault {
-        if (!completed) {
-            throw new AxisFault(Messages.getMessage("cannotreset"));
-        }
-        mc = null;
-        completed = false;
-    }
-
-    public void complete(MessageContext msgCtxt) throws AxisFault {
-        TransportOutDescription trsout = msgCtxt.getTransportOut();
-        if (trsout != null) {
-            trsout.getSender().cleanup(msgCtxt);
-        }
-    }
-
-    public OperationContext getOperationContext() {
-        return oc;
-    }
-
-}
+/*
+* Copyright 2004,2006 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 org.apache.axis2.description;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.async.Callback;
+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.engine.AxisEngine;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.UUIDGenerator;
+import org.apache.axis2.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class OutOnlyAxisOperation extends AxisOperation {
+
+    private AxisMessage inFaultMessage;
+
+    // just to keep the inflow , there wont be any usage
+    private ArrayList inPhases;
+
+    private AxisMessage outFaultMessage;
+
+    private AxisMessage outMessage;
+
+    public OutOnlyAxisOperation() {
+        super();
+        createMessage();
+        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_ONLY);
+    }
+
+    public OutOnlyAxisOperation(QName name) {
+        super(name);
+        createMessage();
+        setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_OUT_ONLY);
+    }
+
+    public void addMessage(AxisMessage message, String label) {
+        if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
+            outMessage = message;
+        } else {
+            throw new UnsupportedOperationException("Not yet implemented");
+        }
+    }
+
+    public void addMessageContext(MessageContext msgContext,
+                                  OperationContext opContext) throws AxisFault {
+        if (!opContext.isComplete()) {
+            opContext.getMessageContexts().put(MESSAGE_LABEL_OUT_VALUE,
+                    msgContext);
+            opContext.setComplete(true);
+        } else {
+            throw new AxisFault(Messages.getMessage("mepcompleted"));
+        }
+    }
+
+    public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault {
+        HashMap mep = opContext.getMessageContexts();
+        MessageContext faultMessageCtxt = (MessageContext) mep.get(MESSAGE_LABEL_FAULT_VALUE);
+
+        if (faultMessageCtxt != null) {
+            throw new AxisFault(Messages.getMessage("mepcompleted"));
+        } else {
+            mep.put(MESSAGE_LABEL_FAULT_VALUE, msgContext);
+            opContext.setComplete(true);
+            opContext.cleanup();
+        }
+    }
+
+    private void createMessage() {
+        outMessage = new AxisMessage();
+        outMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+        inFaultMessage = new AxisMessage();
+        outFaultMessage = new AxisMessage();
+        inPhases = new ArrayList();
+    }
+
+    public AxisMessage getMessage(String label) {
+        if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
+            return outMessage;
+        } else {
+            throw new UnsupportedOperationException("Not yet implemented");
+        }
+    }
+
+    public ArrayList getPhasesInFaultFlow() {
+        return inFaultMessage.getMessageFlow();
+    }
+
+    public ArrayList getPhasesOutFaultFlow() {
+        return outFaultMessage.getMessageFlow();
+    }
+
+    public ArrayList getPhasesOutFlow() {
+        return outMessage.getMessageFlow();
+    }
+
+    public ArrayList getRemainingPhasesInFlow() {
+        return inPhases;
+    }
+
+    public void setPhasesInFaultFlow(ArrayList list) {
+        inFaultMessage.setMessageFlow(list);
+    }
+
+    public void setPhasesOutFaultFlow(ArrayList list) {
+        outFaultMessage.setMessageFlow(list);
+    }
+
+    public void setPhasesOutFlow(ArrayList list) {
+        outMessage.setMessageFlow(list);
+    }
+
+    public void setRemainingPhasesInFlow(ArrayList list) {
+        inPhases = list;
+    }
+
+    /**
+     * Returns a MEP client for an Out-only operation. This client can be used to
+     * interact with a server which is offering an In-only operation. To use the
+     * client, you must call addMessageContext() with a message context and then
+     * call execute() to execute the client. Note that the execute method's
+     * block parameter is ignored by this client and also the setMessageReceiver
+     * method cannot be used.
+     *
+     * @param sc      The service context for this client to live within. Cannot be
+     *                null.
+     * @param options Options to use as defaults for this client. If any options are
+     *                set specifically on the client then those override options
+     *                here.
+     */
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        return new OutOnlyAxisOperationClient(this, sc, options);
+    }
+}
+
+/**
+ * MEP client for moi.
+ */
+class OutOnlyAxisOperationClient implements OperationClient {
+    OutOnlyAxisOperation axisOp;
+
+    ServiceContext sc;
+
+    Options options;
+
+    MessageContext mc;
+
+    OperationContext oc;
+
+    /*
+    * indicates whether the MEP execution has completed (and hence ready for
+    * resetting)
+    */
+    boolean completed;
+
+    OutOnlyAxisOperationClient(OutOnlyAxisOperation axisOp, ServiceContext sc,
+                               Options options) {
+        this.axisOp = axisOp;
+        this.sc = sc;
+        this.options = options;
+        this.completed = false;
+        oc = new OperationContext(axisOp, sc);
+    }
+
+    /**
+     * Sets the options that should be used for this particular client. This
+     * resets the entire set of options to use the new options - so you'd lose
+     * any option cascading that may have been set up.
+     *
+     * @param options the options
+     */
+    public void setOptions(Options options) {
+        this.options = options;
+    }
+
+    /**
+     * Returns the options used by this client. If you want to set a single
+     * option, then the right way is to do getOptions() and set specific
+     * options.
+     *
+     * @return Returns the options, which will never be null.
+     */
+    public Options getOptions() {
+        return options;
+    }
+
+    /**
+     * Adds a message context to the client for processing. This method must not
+     * process the message - it only records it in the MEP client. Processing
+     * only occurs when execute() is called.
+     *
+     * @param mc the message context
+     * @throws AxisFault if this is called inappropriately.
+     */
+    public void addMessageContext(MessageContext mc) throws AxisFault {
+        if (this.mc != null) {
+            throw new AxisFault(Messages.getMessage("cannotaddmsgctx"));
+        }
+        this.mc = mc;
+        if (mc.getMessageID() == null) {
+            setMessageID(mc);
+        }
+        mc.setServiceContext(sc);
+        axisOp.registerOperationContext(mc, oc);
+        this.completed = false;
+    }
+
+    /**
+     * Returns a message from the client - will return null if the requested
+     * message is not available.
+     *
+     * @param messageLabel the message label of the desired message context
+     * @return Returns the desired message context or null if its not available.
+     * @throws AxisFault if the message label is invalid
+     */
+    public MessageContext getMessageContext(String messageLabel)
+            throws AxisFault {
+        if (messageLabel.equals(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)) {
+            return mc;
+        }
+        throw new AxisFault(Messages.getMessage("unknownMsgLabel", messageLabel));
+    }
+
+    /**
+     * Sets the message receiver to be executed when a message comes into the MEP
+     * and the MEP is executed. This is the way the MEP client provides
+     * notification that a message has been received by it. Exactly when its
+     * executed and under what conditions is a function of the specific MEP
+     * client.
+     */
+    public void setCallback(Callback callback) {
+        throw new UnsupportedOperationException(
+                "This feature is not supported by this MEP");
+    }
+
+    /**
+     * Create a message ID for the given message context if needed. If user gives an option with
+     * MessageID then just copy that into MessageContext , and with that there can be mutiple
+     * message with same MessageID unless user call setOption for each invocation.
+     * <p/>
+     * If user want to give message ID then the better way is to set the message ID in the option and
+     * call setOption for each invocation then the right thing will happen.
+     * <p/>
+     * If user does not give a message ID then the new one will be created and set that into Message
+     * Context.
+     *
+     * @param mc the message context whose id is to be set
+     */
+    private void setMessageID(MessageContext mc) {
+        // now its the time to put the parameters set by the user in to the
+        // correct places and to the
+        // if there is no message id still, set a new one.
+        String messageId = options.getMessageId();
+        if (messageId == null || "".equals(messageId)) {
+            messageId = UUIDGenerator.getUUID();
+        }
+        mc.setMessageID(messageId);
+    }
+
+    private void addReferenceParameters(MessageContext msgctx) {
+        EndpointReference to = msgctx.getTo();
+        if (options.isManageSession()) {
+            EndpointReference tepr = sc.getTargetEPR();
+            if (tepr != null) {
+                Map map = tepr.getAllReferenceParameters();
+                Iterator valuse = map.values().iterator();
+                while (valuse.hasNext()) {
+                    Object refparaelement = valuse.next();
+                    if (refparaelement instanceof OMElement) {
+                        to.addReferenceParameter((OMElement) refparaelement);
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Executes the MEP. What this does depends on the specific MEP client. The
+     * basic idea is to have the MEP client execute and do something with the
+     * messages that have been added to it so far. For example, if its an Out-In
+     * MEP, then if the Out message has been set, then executing the client asks
+     * it to send the message and get the In message, possibly using a different
+     * thread.
+     *
+     * @param block Indicates whether execution should block or return ASAP. What
+     *              block means is of course a function of the specific MEP
+     *              client. IGNORED BY THIS MEP CLIENT.
+     * @throws AxisFault if something goes wrong during the execution of the MEP.
+     */
+    public void execute(boolean block) throws AxisFault {
+        if (completed) {
+            throw new AxisFault(Messages.getMessage("mepiscomplted"));
+        }
+        ConfigurationContext cc = sc.getConfigurationContext();
+        
+        // set options on the message context
+        mc.setOptions(options);
+        
+        // do Target Resolution
+        cc.getAxisConfiguration().getTargetResolverChain().resolveTarget(mc);
+        
+        // setting messge ID if it null
+        // if the transport to use for sending is not specified, try to find it
+        // from the URL
+        TransportOutDescription senderTransport = options.getTransportOut();
+        if (senderTransport == null) {
+            EndpointReference toEPR = (options.getTo() != null) ? options
+                    .getTo() : mc.getTo();
+            senderTransport = ClientUtils.inferOutTransport(cc
+                    .getAxisConfiguration(), toEPR, mc);
+        }
+        mc.setTransportOut(senderTransport);
+
+        if (mc.getSoapAction() == null) {
+            String soapaction = axisOp.getSoapAction();
+            if (soapaction != null) {
+                mc.setSoapAction(soapaction);
+            }
+        }
+
+        // create the operation context for myself
+        OperationContext oc = new OperationContext(axisOp, sc);
+        oc.addMessageContext(mc);
+        addReferenceParameters(mc);
+        // ship it out
+        AxisEngine engine = new AxisEngine(cc);
+        if (!block) {
+            mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE);
+        }
+        engine.send(mc);
+        // all done
+        completed = true;
+    }
+
+    /**
+     * Resets the MEP client to a clean status after the MEP has completed. This
+     * is how you can reuse a MEP client. NOTE: this does not reset the options;
+     * only the internal state so the client can be used again.
+     *
+     * @throws AxisFault if reset is called before the MEP client has completed an
+     *                   interaction.
+     */
+    public void reset() throws AxisFault {
+        if (!completed) {
+            throw new AxisFault(Messages.getMessage("cannotreset"));
+        }
+        mc = null;
+        completed = false;
+    }
+
+    public void complete(MessageContext msgCtxt) throws AxisFault {
+        TransportOutDescription trsout = msgCtxt.getTransportOut();
+        if (trsout != null) {
+            trsout.getSender().cleanup(msgCtxt);
+        }
+    }
+
+    public OperationContext getOperationContext() {
+        return oc;
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Thu Aug 10 07:27:14 2006
@@ -17,10 +17,12 @@
 package org.apache.axis2.engine;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.*;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.phaseresolver.PhaseResolver;
+import org.apache.axis2.util.TargetResolver;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -105,6 +107,8 @@
     //to keep tarck of system start or not
     private boolean start;
 
+    private ArrayList targetResolvers;
+    
     /**
      * Constructor AxisConfigurationImpl.
      */
@@ -124,6 +128,7 @@
         serviceClassLoader = Thread.currentThread().getContextClassLoader();
         moduleClassLoader = Thread.currentThread().getContextClassLoader();
         this.phasesinfo = new PhasesInfo();
+        targetResolvers = new ArrayList();
     }
 
     public void addMessageReceiver(String mepURL,
@@ -816,5 +821,27 @@
 
     public void setStart(boolean start) {
         this.start = start;
+    }
+    
+    /**
+     * getTargetResolverChain returns and instance of
+     * TargetResolver which iterates over the registered
+     * TargetResolvers, calling each one in turn when
+     * resolveTarget is called
+     */
+    public TargetResolver getTargetResolverChain(){
+        TargetResolver result = new TargetResolver(){
+            public void resolveTarget(MessageContext messageContext) {
+                Iterator iter = targetResolvers.iterator();
+                while(iter.hasNext()){
+                    TargetResolver tr = (TargetResolver)iter.next();
+                    tr.resolveTarget(messageContext);
+                }
+            }};
+        return result;
+    }
+    
+    public void addTargetResolver(TargetResolver tr) {
+        targetResolvers.add(tr);
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Thu Aug 10 07:27:14 2006
@@ -213,6 +213,9 @@
         } else if (processingContext.getReplyTo() != null) {
             faultContext.setTo(processingContext.getReplyTo());
         }
+        
+        // do Target Resolution
+        faultContext.getConfigurationContext().getAxisConfiguration().getTargetResolverChain().resolveTarget(faultContext);
 
         //Determine that we have the correct transport available.
         TransportOutDescription transportOut = faultContext.getTransportOut();

Added: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/TargetResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/TargetResolver.java?rev=430392&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/TargetResolver.java (added)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/TargetResolver.java Thu Aug 10 07:27:14 2006
@@ -0,0 +1,36 @@
+/*
+* Copyright 2006 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 org.apache.axis2.util;
+
+import org.apache.axis2.context.MessageContext;
+
+/**
+ * TargetResolver
+ * 
+ * Interface to be implemented by code to update the invocation target URL
+ * before the transport is selected and the engine invoked.
+ * 
+ * Examples of use:
+ * 1. wsa:To set to a URN value which needs translated to a targetable URL
+ * 2. support clustering where a single URI may repesent multiple servers and one must be selected
+ */
+public interface TargetResolver {
+    /**
+     * resolveTarget examines the MessageContext and updates the MessageContext
+     * in order to resolve the target.
+     */
+    public void resolveTarget(MessageContext messageContext);
+}
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Thu Aug 10 07:27:14 2006
@@ -67,6 +67,11 @@
 
         newmsgCtx.setMessageID(UUIDGenerator.getUUID());
         newmsgCtx.setTo(oldOptions.getReplyTo());
+        
+        // do Target Resolution
+        newmsgCtx.getConfigurationContext().getAxisConfiguration().getTargetResolverChain().resolveTarget(newmsgCtx);
+
+        
         newmsgCtx.getOptions().setAction(oldOptions.getAction());
 
         // add the service group id as a reference parameter

Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/maven.xml?rev=430392&r1=430391&r2=430392&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Thu Aug 10 07:27:14 2006
@@ -840,6 +840,17 @@
             <mkdir dir="target/test-resources/complete_service_repo/services"/>
             <mkdir dir="target/test-resources/complete_service_repo/modules"/>
 
+            <!-- Test with target resolver  -->
+            <mkdir dir="target/test-resources/deployment_repo"/>
+            <mkdir dir="target/test-resources/deployment_repo/conf"/>
+            <mkdir dir="target/test-resources/deployment_repo/services"/>
+            <mkdir dir="target/test-resources/deployment_repo/modules"/>
+                  	
+            <copy file="test-resources/deployment/deployment.both.axis2.xml"
+            	  tofile="target/test-resources/deployment_repo/conf/axis2.xml"/>
+            <copy file="../addressing/target/addressing-${addressing_version}.mar"
+            	  tofile="target/test-resources/deployment_repo/modules/addressing-${addressing_version}.mar"/>
+        	
             <!-- Test with addressing and MTOM client repository-->
             <copy file="test-resources/security/complete.client.axis2.xml"
                   tofile="target/test-resources/complete_client_repo/conf/axis2.xml"/>

Added: webservices/axis2/trunk/java/modules/integration/test-resources/deployment/deployment.both.axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/deployment/deployment.both.axis2.xml?rev=430392&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/deployment/deployment.both.axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/deployment/deployment.both.axis2.xml Thu Aug 10 07:27:14 2006
@@ -0,0 +1,136 @@
+<axisconfig name="AxisJava2.0">
+    <parameter name="hotdeployment" locked="false">true</parameter>
+    <parameter name="hotupdate" locked="false">true</parameter>
+    <parameter name="enableMTOM" locked="false">true</parameter>
+
+    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+    <!-- Engage the addressing module -->
+    <module ref="addressing"/>
+
+    <!-- Target Resolver for TargetResolverTest -->
+    <targetResolvers>
+    	<targetResolver class="org.apache.axis2.deployment.TestTargetResolver" />
+    </targetResolvers>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+          <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+          <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+          <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+      </transportReceiver> -->
+
+    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
+    <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
+    </transportSender>
+    <transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+    </transportSender>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+   <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+       <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+       <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+   </transportSender>
+   -->
+  <phaseOrder type="inflow">
+        <!--  System pre defined phases       -->
+         <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.engine.AddressingBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="InstanceDispatcher"
+                     class="org.apache.axis2.engine.InstanceDispatcher">
+                <order phase="PostDispatch"/>
+            </handler>
+        </phase>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="OperationInPhase"/>
+    </phaseOrder>
+    <phaseOrder type="outflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+    <phaseOrder type="INfaultflow">
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.engine.AddressingBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="InstanceDispatcher"
+                     class="org.apache.axis2.engine.InstanceDispatcher">
+                <order phase="PostDispatch"/>
+            </handler>
+        </phase>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+    </phaseOrder>
+    <phaseOrder type="Outfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+
+</axisconfig>



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