axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r170881 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi: InOnlyMEPClient.java InOutMEPClient.java MEPClient.java
Date Thu, 19 May 2005 06:22:32 GMT
Author: hemapani
Date: Wed May 18 23:22:31 2005
New Revision: 170881

URL: http://svn.apache.org/viewcvs?rev=170881&view=rev
Log:
fine tuning and commenting the Client API

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java?rev=170881&r1=170880&r2=170881&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
Wed May 18 23:22:31 2005
@@ -49,6 +49,11 @@
         msgctx.setMessageInformationHeaders(messageInformationHeaders);
         msgctx.setServiceContext(serviceContext);
         ConfigurationContext syscontext = serviceContext.getEngineContext();
+        
+        if(senderTransport == null ){
+            senderTransport = inferTransport(messageInformationHeaders.getTo());
+        }
+        
         TransportInDescription transportIn =
             syscontext.getEngineConfig().getTransportIn(new QName(senderTransport));
         msgctx.setTransportIn(transportIn);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java?rev=170881&r1=170880&r2=170881&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
Wed May 18 23:22:31 2005
@@ -47,8 +47,8 @@
     /**
      * transport that should be used for sending and reciving the message
      */
-    protected String senderTransport = Constants.TRANSPORT_HTTP;
-    protected String listenertransport = Constants.TRANSPORT_HTTP;
+    protected String senderTransport;
+    protected String listenerTransport = Constants.TRANSPORT_HTTP;
 
     /** 
      * Should the two SOAPMessage are sent over same channel over seperate channels.
@@ -58,14 +58,28 @@
      *      SMTP transport support only two channel case
      */
     protected boolean useSeparateListener = false;
+    
+    /**
+     * The address the message should be send
+     */
+    protected EndpointReference to;
+
 
     //variables use for internal implementations
+    
+    /**
+     * The Listener Manager is tempory hack to make it work till will Generalize the Transport
Layer More.
+     */
     protected ListenerManager listenerManager;
+    
+    /**
+     * This is used for the Receiving the Async Messages 
+     */
     protected CallbackReceiver callbackReceiver;
-    protected EndpointReference to;
+    
 
     public InOutMEPClient(ServiceContext serviceContext) {
-        super(serviceContext,WSDLConstants.MEP_URI_OUT_IN);
+        super(serviceContext, WSDLConstants.MEP_URI_OUT_IN);
         //service context has the engine context set in to it ! 
         callbackReceiver = new CallbackReceiver();
         listenerManager = new ListenerManager(serviceContext.getEngineContext());
@@ -81,10 +95,15 @@
         msgctx.setTo(to);
         msgctx.setServiceContext(serviceContext);
         ConfigurationContext syscontext = serviceContext.getEngineContext();
+
+        if (senderTransport == null) {
+            senderTransport = inferTransport(to);
+        }
         final TransportInDescription transportIn =
             syscontext.getEngineConfig().getTransportIn(new QName(senderTransport));
         final TransportOutDescription transportOut =
-            syscontext.getEngineConfig().getTransportOut(new QName(senderTransport));
+            syscontext.getEngineConfig().getTransportOut(new QName(listenerTransport));
+
         msgctx.setTransportIn(transportIn);
         msgctx.setTransportOut(transportOut);
 
@@ -144,10 +163,14 @@
 
             AxisEngine engine = new AxisEngine(syscontext);
 
+            if (senderTransport == null) {
+                senderTransport = inferTransport(to);
+            }
+
             final TransportInDescription transportIn =
                 syscontext.getEngineConfig().getTransportIn(new QName(senderTransport));
             final TransportOutDescription transportOut =
-                syscontext.getEngineConfig().getTransportOut(new QName(senderTransport));
+                syscontext.getEngineConfig().getTransportOut(new QName(listenerTransport));
             msgctx.setOperationContext(axisop.findOperationContext(msgctx, serviceContext,
false));
             msgctx.setServiceContext(serviceContext);
 
@@ -213,6 +236,22 @@
     public void setTo(EndpointReference to) {
         this.to = to;
     }
+
+    /**
+     * Set transport information to the the Call, for find how the each parameter acts see
the commant at the instance 
+     * variables. The senarios supoorted are as follows.
+     * [senderTransport, listenerTransport, useSeparateListener]
+     * http, http, true
+     * http, http, false
+     * http,smtp,true
+     * smtp,http,true
+     * smtp,smtp,true
+     *  
+     * @param senderTransport
+     * @param listenerTransport
+     * @param useSeparateListener
+     * @throws AxisFault
+     */
 
     public void setTransportInfo(
         String senderTransport,

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=170881&r1=170880&r2=170881&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
Wed May 18 23:22:31 2005
@@ -17,6 +17,7 @@
  */
 package org.apache.axis.clientapi;
 
+import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.context.ServiceContext;
 import org.apache.axis.description.OperationDescription;
@@ -32,32 +33,48 @@
 public abstract class MEPClient {
     protected ServiceContext serviceContext;
     protected final String mep;
-    
-    public MEPClient(ServiceContext service,String mep){
+
+    public MEPClient(ServiceContext service, String mep) {
         this.serviceContext = service;
         this.mep = mep;
     }
-    
-    protected void verifyInvocation(OperationDescription axisop) throws AxisFault{
-        if(axisop == null){
+
+    protected void verifyInvocation(OperationDescription axisop) throws AxisFault {
+        if (axisop == null) {
             throw new AxisFault("OperationDescription can not be null");
-         }   
-         
-         if(mep.equals(axisop.getMessageExchangePattern() )){
-             throw new AxisFault("This mepClient supports only "+ mep + " And the Axis Operations
suppiled supports "+ axisop.getMessageExchangePattern());
-         }
+        }
+
+        if (mep.equals(axisop.getMessageExchangePattern())) {
+            throw new AxisFault(
+                "This mepClient supports only "
+                    + mep
+                    + " And the Axis Operations suppiled supports "
+                    + axisop.getMessageExchangePattern());
+        }
     }
-    
+
     protected MessageContext prepareTheSystem(OMElement toSend) throws AxisFault {
-         MessageContext msgctx =
-             new MessageContext(null, null, null, serviceContext.getEngineContext());
+        MessageContext msgctx =
+            new MessageContext(null, null, null, serviceContext.getEngineContext());
 
-         SOAPEnvelope envelope = null;
-         SOAPFactory omfac = OMAbstractFactory.getSOAP11Factory();
-         envelope = omfac.getDefaultEnvelope();
-         envelope.getBody().addChild(toSend);
-         msgctx.setEnvelope(envelope);
-         return msgctx;
-     }
+        SOAPEnvelope envelope = null;
+        SOAPFactory omfac = OMAbstractFactory.getSOAP11Factory();
+        envelope = omfac.getDefaultEnvelope();
+        envelope.getBody().addChild(toSend);
+        msgctx.setEnvelope(envelope);
+        return msgctx;
+    }
+
+    public String inferTransport(EndpointReference epr) {
+        String transport = null;
+        if (epr != null) {
+            String toURL = epr.getAddress();
+            int index = toURL.indexOf(':');
+            if (index > 0) {
+                transport = toURL.substring(0, index);
+            }
+        }
+        return transport;
+    }
 
 }



Mime
View raw message