Author: chinthaka
Date: Mon Nov  7 22:03:11 2005
New Revision: 331698

URL: http://svn.apache.org/viewcvs?rev=331698&view=rev
Log:
- Now one can set addressing information directly via MEPClient (Call, 
InOnlyMEPClient, etc also inherit this). The much debated setReplyTo(epr) is 
enable, BUT the address of the replyTo epr will be overriden by the AxisEngine, 
which is fair enough. This will enable one to set reference parameters to the 
replyTo, so that he will receive them back, in the IN OUT scenario.
- Fixed a typo in CommonsHTTPTS.

Note : I know that the build is failing whilst running two of the security 
tests, due to a signature verification failure, at this moment. This might be 
due to the explicit default namespace serialization introduced yesterday. Will 
check with Ajith soon and will be fixed soon.

Modified:
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java?rev=331698&r1=331697&r2=331698&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
 Mon Nov  7 22:03:11 2005
@@ -54,7 +54,6 @@
      */
     public void send(AxisOperation axisop, final MessageContext msgctx) throws 
AxisFault {
         prepareInvocation(axisop, msgctx);
-        msgctx.setMessageInformationHeaders(messageInformationHeaders);
         String messageID = String.valueOf("uuid:"+ UUIDGenerator.getUUID());
         msgctx.setMessageID(messageID);
         msgctx.setServiceContext(serviceContext);
@@ -79,51 +78,7 @@
     /**
      * @param action
      */
-    public void setWsaAction(String action) {
-        messageInformationHeaders.setAction(action);
-    }
-
-    /**
-     * @param faultTo
-     */
-    public void setFaultTo(EndpointReference faultTo) {
-        messageInformationHeaders.setFaultTo(faultTo);
-    }
-
-    /**
-     * @param from
-     */
-    public void setFrom(EndpointReference from) {
-        messageInformationHeaders.setFrom(from);
-    }
-
-    /**
-     * @param messageId
-     */
-    public void setMessageId(String messageId) {
-        messageInformationHeaders.setMessageId(messageId);
-    }
-
-    /**
-     * @param relatesTo
-     */
-    public void setRelatesTo(RelatesTo relatesTo) {
-        messageInformationHeaders.setRelatesTo(relatesTo);
-    }
-
-    /**
-     * @param replyTo
-     */
-    public void setReplyTo(EndpointReference replyTo) {
-        messageInformationHeaders.setReplyTo(replyTo);
-    }
 
-    /**
-     * @param to
-     */
-    public void setTo(EndpointReference to) {
-        messageInformationHeaders.setTo(to);
-    }
 
     /**
      * set the transport to used for sending the SOAP Message

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=331698&r1=331697&r2=331698&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
 Mon Nov  7 22:03:11 2005
@@ -46,7 +46,7 @@
  */
 public class InOutMEPClient extends MEPClient {
     protected long timeOutInMilliSeconds = 2000;
-    
+
     AxisEngine engine = null;
 
     protected TransportListener listener;
@@ -68,7 +68,6 @@
     /**
      * The address the message should be send
      */
-    protected EndpointReference to;
 
     //variables use for internal implementations
 
@@ -123,7 +122,7 @@
         prepareInvocation(axisop, msgctx);
 
         // The message ID is sent all the time
-        String messageID = String.valueOf("uuid:"+ UUIDGenerator.getUUID());
+        String messageID = String.valueOf("uuid:" + UUIDGenerator.getUUID());
         msgctx.setMessageID(messageID);
         //
         if (useSeparateListener) {
@@ -162,7 +161,7 @@
             }
         } else {
             //This is the Usual Request-Response Sync implemetation
-            msgctx.setTo(to);
+//            msgctx.setTo(to);
             msgctx.setServiceContext(serviceContext);
             ConfigurationContext syscontext = 
serviceContext.getConfigurationContext();
             msgctx.setConfigurationContext(syscontext);
@@ -173,8 +172,8 @@
 //                    axisop,
 //                    serviceContext);
 
-            OperationContext operationContext = new 
OperationContext(axisop,serviceContext);
-            axisop.registerOperationContext(msgctx,operationContext);
+            OperationContext operationContext = new OperationContext(axisop, 
serviceContext);
+            axisop.registerOperationContext(msgctx, operationContext);
 
             //Send the SOAP Message and receive a response                
             MessageContext response =
@@ -193,10 +192,10 @@
                     } else {
                         //if detail element not present create a new Exception 
from the detail
                         String message = "";
-                        message = message + "Code =" + 
soapFault.getCode()==null?"":
-                                
soapFault.getCode().getValue()==null?"":soapFault.getCode().getValue().getText();
-                        message = message + "Reason =" + 
soapFault.getReason()==null?"":
-                                
soapFault.getReason().getSOAPText()==null?"":soapFault.getReason().getSOAPText().getText();
+                        message = message + "Code =" + soapFault.getCode() == 
null ? "" :
+                                soapFault.getCode().getValue() == null ? "" : 
soapFault.getCode().getValue().getText();
+                        message = message + "Reason =" + soapFault.getReason() 
== null ? "" :
+                                soapFault.getReason().getSOAPText() == null ? 
"" : soapFault.getReason().getSOAPText().getText();
                         throw new AxisFault(message);
                     }
                 }
@@ -214,7 +213,6 @@
                                   final Callback callback)
             throws AxisFault {
         prepareInvocation(axisop, msgctx);
-        msgctx.setTo(to);
         try {
             final ConfigurationContext syscontext =
                     serviceContext.getConfigurationContext();
@@ -222,7 +220,7 @@
             engine = new AxisEngine(syscontext);
             checkTransport(msgctx);
             //Use message id all the time!
-            String messageID = String.valueOf("uuid:"+ 
UUIDGenerator.getUUID());
+            String messageID = String.valueOf("uuid:" + 
UUIDGenerator.getUUID());
             msgctx.setMessageID(messageID);
             ////
             if (useSeparateListener) {
@@ -231,15 +229,23 @@
 
                 axisop.setMessageReceiver(callbackReceiver);
                 callbackReceiver.addCallback(messageID, callback);
+
                 //set the replyto such that the response will arrive at the 
transport listener started
-                msgctx.setReplyTo(ListenerManager.replyToEPR(serviceContext
+                // Note that this will only change the replyTo Address 
property in the replyTo EPR
+                EndpointReference replyToFromTransport = 
ListenerManager.replyToEPR(serviceContext
                         .getAxisService()
                         .getName()
                         .getLocalPart()
                         + "/"
                         + axisop.getName().getLocalPart(),
-                        listenerTransport.getName().getLocalPart()));
-                msgctx.setTo(this.to);
+                        listenerTransport.getName().getLocalPart());
+
+                if (msgctx.getReplyTo() == null) {
+                    msgctx.setReplyTo(replyToFromTransport);
+                } else {
+                    
msgctx.getReplyTo().setAddress(replyToFromTransport.getAddress());
+                }
+
                 //create and set the Operation context
                 msgctx.setOperationContext(axisop.findOperationContext(msgctx, 
serviceContext));
                 msgctx.setServiceContext(serviceContext);
@@ -259,24 +265,24 @@
                                                });*/
             } else {
                 // here a bloking invocation happens in a new thread, so the
-                               // progamming model is non blocking
-                 
serviceContext.getConfigurationContext().getThreadPool().execute(new 
NonBlockingInvocationWorker(callback, axisop, msgctx));
+                // progamming model is non blocking
+                
serviceContext.getConfigurationContext().getThreadPool().execute(new 
NonBlockingInvocationWorker(callback, axisop, msgctx));
             }
 
         } catch (OMException e) {
             throw new AxisFault(e.getMessage(), e);
-        }catch (Exception e) {
+        } catch (Exception e) {
             throw new AxisFault(e.getMessage(), e);
         }
 
     }
 
-    /**
-        * @param to
-        */
-    public void setTo(EndpointReference to) {
-        this.to = to;
-    }
+//    /**
+//     * @param to
+//     */
+//    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
@@ -349,7 +355,7 @@
      */
     private void checkTransport(MessageContext msgctx) throws AxisFault {
         if (senderTransport == null) {
-            senderTransport = inferTransport(to);
+            senderTransport = inferTransport(msgctx.getTo());
         }
         if (listenerTransport == null) {
             listenerTransport =
@@ -412,7 +418,7 @@
 
         public void run() {
             try {
-                OperationContext opcontxt = new 
OperationContext(axisop,serviceContext);
+                OperationContext opcontxt = new OperationContext(axisop, 
serviceContext);
                 msgctx.setOperationContext(opcontxt);
                 msgctx.setServiceContext(serviceContext);
                 //send the request and wait for reponse
@@ -421,15 +427,15 @@
                 //call the callback                        
                 SOAPEnvelope resenvelope = response.getEnvelope();
                 SOAPBody body = resenvelope.getBody();
-                if (body.hasFault()){
+                if (body.hasFault()) {
                     Exception ex = body.getFault().getException();
-                    if (ex !=null){
+                    if (ex != null) {
                         callback.reportError(ex);
-                    }else{
+                    } else {
                         //todo this needs to be fixed
                         callback.reportError(new 
Exception(body.getFault().getReason().getText()));
                     }
-                }else{
+                } else {
                     AsyncResult asyncResult = new AsyncResult(response);
                     callback.onComplete(asyncResult);
                 }
@@ -444,6 +450,7 @@
     /**
      * This will be used in invoke blocking scenario. Client will wait the 
amount of time specified here
      * and if there is no response, call will timeout. This should be given in 
multiples of 100 and defaults to 2000.
+     *
      * @param timeOutInMilliSeconds
      */
     public void setTimeOutInMilliSeconds(long timeOutInMilliSeconds) {

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java?rev=331698&r1=331697&r2=331698&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
 Mon Nov  7 22:03:11 2005
@@ -18,6 +18,8 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.MessageInformationHeaders;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisOperation;
@@ -46,6 +48,8 @@
     protected String soapAction = "";
     protected String wsaAction;
 
+    protected MessageInformationHeaders messageInformationHeaders;
+
     protected List soapHeaderList;
 
     /*
@@ -64,6 +68,7 @@
     public MEPClient(ServiceContext service, String mep) {
         this.serviceContext = service;
         this.mep = mep;
+        messageInformationHeaders = new MessageInformationHeaders();
     }
 
     /**
@@ -87,9 +92,7 @@
         if (serviceContext.getAxisService().getOperation(axisop.getName()) == 
null) {
             serviceContext.getAxisService().addOperation(axisop);
         }
-        if (wsaAction != null) {
-            msgCtx.setWSAAction(wsaAction);
-        }
+        msgCtx.setMessageInformationHeaders(messageInformationHeaders);
         msgCtx.setSoapAction(soapAction);
 
         // check user has put any SOAPHeader using the call MEPClient methods 
and add them, if any, to the
@@ -215,9 +218,6 @@
     /**
      * @param string
      */
-    public void setWsaAction(String string) {
-        wsaAction = string;
-    }
 
     /**
      * @param exceptionToBeThrownOnSOAPFault - If there is a SOAP Fault in the 
body of the incoming
@@ -238,6 +238,59 @@
         }
         soapHeaderList.add(omElement);
     }
+
+    
//==============================================================================
+    // Use these methods to set Addressing specific information to the SOAP 
envelope.
+    
//===============================================================================
+
+    public void setWsaAction(String action) {
+        messageInformationHeaders.setAction(action);
+    }
+
+    /**
+     * @param faultTo
+     */
+    public void setFaultTo(EndpointReference faultTo) {
+        messageInformationHeaders.setFaultTo(faultTo);
+    }
+
+    /**
+     * @param from
+     */
+    public void setFrom(EndpointReference from) {
+        messageInformationHeaders.setFrom(from);
+    }
+
+    /**
+     * @param messageId
+     */
+    public void setMessageId(String messageId) {
+        messageInformationHeaders.setMessageId(messageId);
+    }
+
+    /**
+     * @param relatesTo
+     */
+    public void setRelatesTo(RelatesTo relatesTo) {
+        messageInformationHeaders.setRelatesTo(relatesTo);
+    }
+
+    /**
+     * @param replyTo
+     */
+    public void setReplyTo(EndpointReference replyTo) {
+        messageInformationHeaders.setReplyTo(replyTo);
+    }
+
+    /**
+     * @param to
+     */
+    public void setTo(EndpointReference to) {
+        messageInformationHeaders.setTo(to);
+    }
+
+    // 
==============================================================================
+
 
     private SOAPFactory getCorrectSOAPFactory(MessageContext msgCtx) {
         String soapNSURI = msgCtx.getEnvelope().getNamespace().getName();

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=331698&r1=331697&r2=331698&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
 Mon Nov  7 22:03:11 2005
@@ -701,7 +701,7 @@
      * getting host configuration to support standard http/s, proxy and NTLM 
support
      */
     private HostConfiguration getHostConfiguration(HttpClient client, 
MessageContext msgCtx, URL targetURL) throws AxisFault {
-        boolean isHostProxy = isProxyListered(msgCtx); //list the proxy
+        boolean isHostProxy = isProxyListed(msgCtx); //list the proxy
         int port = targetURL.getPort();
         if (port == -1) port = 80;
         // to see the host is a proxy and in the proxy list - available in 
axis2.xml
@@ -717,7 +717,7 @@
         return config;
     }
 
-    private boolean isProxyListered(MessageContext msgCtx) throws AxisFault {
+    private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
         boolean returnValue = false;
         Parameter par = null;
         proxyOutSetting = msgCtx.getSystemContext()


Reply via email to