You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/12/01 16:26:27 UTC

svn commit: r350263 - in /webservices/axis2/trunk/java: modules/core/src/org/apache/axis2/client/ modules/core/src/org/apache/axis2/deployment/ modules/integration/test/org/apache/axis2/engine/ modules/integration/test/org/apache/axis2/mail/ modules/sa...

Author: chinthaka
Date: Thu Dec  1 07:26:02 2005
New Revision: 350263

URL: http://svn.apache.org/viewcvs?rev=350263&view=rev
Log:
Deprecating the setTransportInfo method for two reasons.
1. setTransportInfo is not correct for InOnly MEP as we do not need to mention the listener transport
2. user need not give the sender transport protocol as that can be inferred from the to URI.

So I added method to set the listener transport protocol and useSeparateListener flags.

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOnlyMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/clients/PingClient.java
    webservices/axis2/trunk/java/xdocs/Axis2ArchitectureGuide.html

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOnlyMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOnlyMEPClient.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOnlyMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOnlyMEPClient.java Thu Dec  1 07:26:02 2005
@@ -23,14 +23,10 @@
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.wsdl.WSDLConstants;
 
-import javax.xml.namespace.QName;
-
 /**
  * This class handles In-Only (fire and forget) MEP
  */
@@ -73,15 +69,7 @@
         engine.send(msgctx);
     }
 
-    protected void configureTransportInformation() throws AxisFault {
-        AxisConfiguration axisConfig = this.serviceContext.getConfigurationContext().getAxisConfiguration();
-        String senderTrasportProtocol = clientOptions.getSenderTrasportProtocol();
-        if (axisConfig != null) {
-            clientOptions.setSenderTransport(axisConfig.getTransportOut(new QName(senderTrasportProtocol)));
-        }
-        if (this.clientOptions.getSenderTransport() == null) {
-            throw new AxisFault(Messages.getMessage("unknownTransport", senderTrasportProtocol));
-        }
-
+    protected void configureTransportInformation(MessageContext msgCtx) throws AxisFault {
+        inferTransportOutDescription(msgCtx);
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/InOutMEPClient.java Thu Dec  1 07:26:02 2005
@@ -27,7 +27,6 @@
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.i18n.Messages;
@@ -254,10 +253,9 @@
 
 
 
-    protected void configureTransportInformation() throws AxisFault {
+    protected void configureTransportInformation(MessageContext msgCtx) throws AxisFault {
         AxisConfiguration axisConfig = this.serviceContext.getConfigurationContext().getAxisConfiguration();
         String listenerTransportProtocol = clientOptions.getListenerTransportProtocol();
-        String senderTrasportProtocol = clientOptions.getSenderTrasportProtocol();
         if (axisConfig != null) {
             if (listenerTransportProtocol != null && !"".equals(listenerTransportProtocol)) {
                 TransportInDescription transportIn = axisConfig.getTransportIn(new QName(listenerTransportProtocol));
@@ -266,13 +264,8 @@
                 }
                 clientOptions.setListenerTransport(transportIn);
             }
-            if (senderTrasportProtocol != null && "".equals(senderTrasportProtocol)) {
-                TransportOutDescription transportOut = axisConfig.getTransportOut(new QName(senderTrasportProtocol));
-                if (transportOut == null) {
-                    throw new AxisFault(Messages.getMessage("unknownTransport", senderTrasportProtocol));
-                }
-                clientOptions.setSenderTransport(transportOut);
-            }
+
+            inferTransportOutDescription(msgCtx);
         }
 
         if (clientOptions.isUseSeperateListener()) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java Thu Dec  1 07:26:02 2005
@@ -68,7 +68,7 @@
         // user must provide the minimum information for the engine to proceed with the invocation.
         // For the time being, I think he should at least provide the toEPR. So I should check that is
         // available either from the message context or from the options.
-        if ( (msgCtx == null || msgCtx.getTo() == null) && (clientOptions == null || clientOptions.getTo() == null ) ) {
+        if ((msgCtx == null || msgCtx.getTo() == null) && (clientOptions == null || clientOptions.getTo() == null)) {
             throw new AxisFault("Can not proceed without options being set for invocation. Set the" +
                     "properties for this invocation via MEPClient.setOptions(Options) first.");
         }
@@ -98,7 +98,7 @@
         addUserAddedSOAPHeaders(msgCtx, clientOptions);
 
         //find and set the transport details
-        configureTransportInformation();
+        configureTransportInformation(msgCtx);
 
     }
 
@@ -108,7 +108,7 @@
      * This will be called within the prepare invocation method, so user should not bother to call
      * this explicitly.
      */
-    protected abstract void configureTransportInformation() throws AxisFault;
+    protected abstract void configureTransportInformation(MessageContext msgCtxt) throws AxisFault;
 
     private void extractPropertiesFromOptionsToContexts(MessageContext msgCtx) throws AxisFault {
 
@@ -174,12 +174,19 @@
      * @throws AxisFault
      */
     protected TransportOutDescription inferTransport(EndpointReference epr) throws AxisFault {
-        String transport = null;
         if (epr != null) {
-            String toURL = epr.getAddress();
-            int index = toURL.indexOf(':');
+            return inferTransport(epr.getAddress());
+        } else {
+            throw new AxisFault(Messages.getMessage("cannotInferTransport"));
+        }
+    }
+
+    protected TransportOutDescription inferTransport(String uri) throws AxisFault {
+        String transport = null;
+        if (uri != null) {
+            int index = uri.indexOf(':');
             if (index > 0) {
-                transport = toURL.substring(0, index);
+                transport = uri.substring(0, index);
             }
         }
 
@@ -203,8 +210,8 @@
 
         // I added code to check the nullity in the prepareInvocation(). But it seems that this method
         // can be called before prepareInvocation().
-        if(clientOptions == null){
-           throw new AxisFault("Can not proceed without options being set for invocation. Set the" +
+        if (clientOptions == null) {
+            throw new AxisFault("Can not proceed without options being set for invocation. Set the" +
                     "properties for this invocation via MEPClient.setOptions(Options) first.");
         }
 
@@ -318,6 +325,33 @@
             soapHeaderList = new ArrayList();
         }
         soapHeaderList.add(soapHeaderBlock);
+    }
+
+    protected void inferTransportOutDescription(MessageContext msgCtx) throws AxisFault {
+        // user can set the transport by giving a TransportOutDescription or we will deduce that from the
+        // to epr information
+
+        // if user has not set the TransportOutDescription, lets infer that
+        if (clientOptions.getSenderTransport() == null) {
+            AxisConfiguration axisConfig = this.serviceContext.getConfigurationContext().getAxisConfiguration();
+
+            // we have a deprecated method for user to set the transport protocol directly. Lets support that also
+            String senderTrasportProtocol = clientOptions.getSenderTrasportProtocol();
+            if (axisConfig != null) {
+                if (senderTrasportProtocol == null || "".equals(senderTrasportProtocol)) {
+                    // by this time we have passed all the information we collected via Options to the
+                    // message context
+                    clientOptions.setSenderTransport(inferTransport(msgCtx.getTo()));
+                } else {
+                    // if he has not set the transport information, we gonna infer that from the to EPR
+                    clientOptions.setSenderTransport(axisConfig.getTransportOut(new QName(senderTrasportProtocol)));
+                }
+            }
+            if (this.clientOptions.getSenderTransport() == null) {
+                throw new AxisFault(Messages.getMessage("unknownTransport", senderTrasportProtocol));
+            }
+        }
+
     }
 
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Options.java Thu Dec  1 07:26:02 2005
@@ -207,14 +207,6 @@
         }
     }
 
-    public String getSenderTrasportProtocol() {
-        return senderTrasportProtocol;
-    }
-
-    public void setSenderTransportProtocol(String senderTrasportProtocol) throws AxisFault {
-        this.senderTrasportProtocol = senderTrasportProtocol;
-    }
-
     public TransportInDescription getListenerTransport() {
         return listenerTransport;
     }
@@ -299,6 +291,14 @@
         return listenerTransportProtocol;
     }
 
+    public void setListenerTransportProtocol(String listenerTransportProtocol) {
+        this.listenerTransportProtocol = listenerTransportProtocol;
+    }
+
+    public String getSenderTrasportProtocol() {
+        return senderTrasportProtocol;
+    }
+
 
     /**
      * Sets transport information to the call. The senarios supported are as follows:
@@ -315,6 +315,9 @@
      * @param listenerTransport
      * @param useSeperateListener
      * @throws AxisFault
+     * @deprecated Use setListenerTransportProtocol(String) and useSeparateListener(boolean) instead.
+     *             You do not need to setSenderTransportProtocol(String) as sender transport can be inferred from the
+     *             to EPR. But still you can setSenderTransport(TransportOutDescription).
      */
 
     public void setTransportInfo(String senderTransport, String listenerTransport,
@@ -332,10 +335,10 @@
                 throw new AxisFault(Messages.getMessage("useSeparateListenerLimited"));
             }
         } else {
-            this.useSeperateListener = useSeperateListener;
+            setUseSeperateListener(useSeperateListener);
         }
 
-        this.listenerTransportProtocol = listenerTransport;
+        setListenerTransportProtocol(listenerTransport);
         this.senderTrasportProtocol = senderTransport;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/axis2.xml Thu Dec  1 07:26:02 2005
@@ -71,7 +71,7 @@
     </transportSender>
 
     <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
-   <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+   <transportSender name="mailto" 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>

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java Thu Dec  1 07:26:02 2005
@@ -39,6 +39,7 @@
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.transport.local.LocalTransportReceiver;
+import org.apache.axis2.transport.local.LocalTransportSender;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -56,6 +57,7 @@
     private SOAPEnvelope envelope;
 
     private boolean finish = false;
+    private TransportOutDescription tOut;
 
     public MessageContextInjectionTest() {
         super(MessageContextInjectionTest.class.getName());
@@ -71,7 +73,8 @@
         TransportInDescription tIn = new TransportInDescription(new QName(Constants.TRANSPORT_LOCAL));
         config.addTransportIn(tIn);
 
-        TransportOutDescription tOut = new TransportOutDescription(new QName(Constants.TRANSPORT_LOCAL));
+        tOut = new TransportOutDescription(new QName(Constants.TRANSPORT_LOCAL));
+        tOut.setSender(new LocalTransportSender());
         config.addTransportOut(tOut);
 
         LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(
@@ -118,9 +121,8 @@
         Options options = new Options();
         sender.setClientOptions(options);
         options.setTo(targetEPR);
-        options.setSenderTransportProtocol(Constants.TRANSPORT_LOCAL);
+        options.setSenderTransport(tOut);
         options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-        
         sender.send(operationName.getLocalPart(), payload);
 
     }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/OneWayRawXMLTest.java Thu Dec  1 07:26:02 2005
@@ -20,7 +20,6 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.client.MessageSender;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
@@ -87,7 +86,6 @@
         Options options = new Options();
         sender.setClientOptions(options);
         options.setTo(targetEPR);
-        options.setSenderTransportProtocol(Constants.TRANSPORT_HTTP);
 
         sender.send(operationName.getLocalPart(), payload);
         int index = 0;

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java Thu Dec  1 07:26:02 2005
@@ -46,7 +46,7 @@
 
 public class MailOneWayRawXMLTest extends TestCase {
     private EndpointReference targetEPR =
-            new EndpointReference("foo@127.0.0.1" +
+            new EndpointReference("mailto:foo@127.0.0.1" +
             "/axis/services/EchoXMLService/echoOMElement");
     private Log log = LogFactory.getLog(getClass());
     private QName serviceName = new QName("EchoXMLService");
@@ -129,7 +129,6 @@
 
         Options options = new Options();
         options.setTo(targetEPR);
-        options.setSenderTransportProtocol(Constants.TRANSPORT_MAIL);
 
         sender.send(operationName.getLocalPart(), payload);
         int index = 0;

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java Thu Dec  1 07:26:02 2005
@@ -17,7 +17,6 @@
 package userguide.clients;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.MessageSender;
 import org.apache.axis2.client.Options;
@@ -39,7 +38,6 @@
         Options options = new Options();
         options.setTo(
                 new EndpointReference(toEpr));
-        options.setSenderTransportProtocol(Constants.TRANSPORT_MAIL);
         msgSender.setClientOptions(options);
 
         msgSender.send("echo", getPayload());

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/clients/PingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/clients/PingClient.java?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/clients/PingClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/clients/PingClient.java Thu Dec  1 07:26:02 2005
@@ -16,7 +16,6 @@
 package userguide.clients;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.MessageSender;
 import org.apache.axis2.client.Options;
@@ -38,7 +37,6 @@
             Options options = new Options();
             msgSender.setClientOptions(options);
             options.setTo(targetEPR);
-            options.setSenderTransportProtocol(Constants.TRANSPORT_HTTP);
 
             msgSender.send("ping", payload);
 

Modified: webservices/axis2/trunk/java/xdocs/Axis2ArchitectureGuide.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/Axis2ArchitectureGuide.html?rev=350263&r1=350262&r2=350263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/Axis2ArchitectureGuide.html (original)
+++ webservices/axis2/trunk/java/xdocs/Axis2ArchitectureGuide.html Thu Dec  1 07:26:02 2005
@@ -321,10 +321,10 @@
 
 <p>The two pipes does not differentiate between the Server and the Client,
 the SOAP Processing Model handles the complexity and provides two abstract
-pipes to the user. Each pipe is a set of Handlers, the different areas of the
+pipes to the user. Each pipe is a set of Handlers. The different areas or the stages of the
 pipes are given names, and according to the Axis2 slang those are named
 'Phases'. A Handler always runs inside a Phase, and the Phase provides a
-mechanism to specify the ordering of Handlers. Both Pipes has built in
+mechanism to specify the ordering of Handlers. Both Pipes have built in
 Phases, and both define the areas for 'User Phases' which can be defined by
 the user.</p>
 
@@ -342,10 +342,10 @@
 
 <p>There are four special handlers defined in Axis2.</p>
 <ol>
-  <li><p style="margin-bottom: 0in">Dispatchers - Find the Service the SOAP
+  <li>
+    <p style="margin-bottom: 0in">Dispatchers - Finds the service and the operation the SOAP
     message is directed to, always run on the In-Pipe and inside the Dispatch
-    Phase. There is a inbuilt Dispatcher, that run in any case and user may
-    override it by placing the dispatchers before the inbuilt Dispatcher.</p>
+    Phase. The in-built dispatchers dispatches to a particular operation depending on various conditions like WS-Addressing information, URI information, SOAP action information, etc., </p>
   </li>
   <li><p style="margin-bottom: 0in"><a name="mr"></a>Message Receiver -
     Consume the SOAP Message and run on the Message Processing Phase in the