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 2006/10/15 16:11:57 UTC

svn commit: r464198 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java

Author: chinthaka
Date: Sun Oct 15 07:11:55 2006
New Revision: 464198

URL: http://svn.apache.org/viewvc?view=rev&rev=464198
Log:
Fixing http://issues.apache.org/jira/browse/AXIS2-1386.

I consider this as a fix that should go with the next release. Thilina, it is your call to accept this or not for Axis2 1.1. 


Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=464198&r1=464197&r2=464198
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sun Oct 15 07:11:55 2006
@@ -178,8 +178,7 @@
 
             if (transportURL != null) {
                 epr = new EndpointReference(transportURL);
-            }
-            else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
+            } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
                 epr = msgContext.getTo();
             }
 
@@ -208,8 +207,7 @@
             } else {
                 if (msgContext.getProperty(MessageContext.TRANSPORT_OUT) != null) {
                     sendUsingOutputStream(msgContext, format, dataOut);
-                }
-                else {
+                } else {
                     throw new AxisFault("Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
                 }
             }
@@ -265,53 +263,65 @@
         }
 
         format.setDoOptimize(msgContext.isDoingMTOM());
-		format.setDoingSWA(msgContext.isDoingSwA());
-		if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
-				& !(msgContext.isDoingREST())) {
-			StringWriter bufferedSOAPBody = new StringWriter();
-			dataOut.serializeAndConsume(bufferedSOAPBody, format);
-			MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
-					out, msgContext.getAttachmentMap(), format);
-		} else {
-			dataOut.serializeAndConsume(out, format);
-		}
+        format.setDoingSWA(msgContext.isDoingSwA());
+        if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
+                & !(msgContext.isDoingREST())) {
+            StringWriter bufferedSOAPBody = new StringWriter();
+            dataOut.serializeAndConsume(bufferedSOAPBody, format);
+            MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
+                    out, msgContext.getAttachmentMap(), format);
+        } else {
+            dataOut.serializeAndConsume(out, format);
+        }
     }
 
-    public void writeMessageWithCommons(MessageContext msgContext,
+    public void writeMessageWithCommons(MessageContext messageContext,
                                         EndpointReference toEPR,
                                         OMElement dataout,
                                         OMOutputFormat format)
             throws AxisFault {
         try {
             URL url = new URL(toEPR.getAddress());
-            String soapActionString = msgContext.getSoapAction();
 
-            if ((soapActionString == null) || (soapActionString.length() == 0)) {
-                soapActionString = msgContext.getWSAAction();
-            }
+            String soapActionString = "\"\"";
 
             Object disableSoapAction =
-                msgContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
-            
-            if (soapActionString == null || JavaUtils.isTrueExplicitly(disableSoapAction)) {
+                    messageContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
+
+            if (!JavaUtils.isTrueExplicitly(disableSoapAction)) {
+                // first try to get the SOAP action from message context
+                soapActionString = messageContext.getSoapAction();
+                if ((soapActionString == null) || (soapActionString.length() == 0)) {
+                    // now let's try to get WSA action
+                    soapActionString = messageContext.getWSAAction();
+                    if (messageContext.getAxisOperation() != null && ((soapActionString == null) || (soapActionString.length() == 0))) {
+                        // last option is to get it from the axis operation
+                        soapActionString = messageContext.getAxisOperation().getSoapAction();
+                    }
+                }
+
+            }
+
+
+            if (soapActionString == null) {
                 soapActionString = "\"\"";
-            } 
+            }
 
             // select the Message Sender depending on the REST status
             AbstractHTTPSender sender;
 
-            if (!msgContext.isDoingREST()) {
+            if (!messageContext.isDoingREST()) {
                 sender = new SOAPOverHTTPSender();
             } else {
                 sender = new RESTSender();
             }
-            if (msgContext.getProperty(HTTPConstants.CHUNKED) != null) {
-                chunked = JavaUtils.isTrueExplicitly(msgContext.getProperty(
+            if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
+                chunked = JavaUtils.isTrueExplicitly(messageContext.getProperty(
                         HTTPConstants.CHUNKED));
             }
 
-            if (msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
-                httpVersion = (String) msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
+            if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
+                httpVersion = (String) messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
             }
 
             // Following order needed to be preserved because,
@@ -320,7 +330,7 @@
             sender.setHttpVersion(httpVersion);
             sender.setFormat(format);
 
-            sender.send(msgContext, dataout, url, soapActionString);
+            sender.send(messageContext, dataout, url, soapActionString);
         } catch (MalformedURLException e) {
             throw new AxisFault(e);
         } catch (HttpException e) {



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


Re: svn commit: r464198 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java

Posted by Thilina Gunarathne <cs...@gmail.com>.
IIRC I did not raised an objection to this...

~Thilina

On 10/15/06, chinthaka@apache.org <ch...@apache.org> wrote:
> Author: chinthaka
> Date: Sun Oct 15 07:11:55 2006
> New Revision: 464198
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=464198
> Log:
> Fixing http://issues.apache.org/jira/browse/AXIS2-1386.
>
> I consider this as a fix that should go with the next release. Thilina, it is your call to accept this or not for Axis2 1.1.
>
>
> Modified:
>     webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
>
> Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=464198&r1=464197&r2=464198
> ==============================================================================
> --- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
> +++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sun Oct 15 07:11:55 2006
> @@ -178,8 +178,7 @@
>
>              if (transportURL != null) {
>                  epr = new EndpointReference(transportURL);
> -            }
> -            else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
> +            } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
>                  epr = msgContext.getTo();
>              }
>
> @@ -208,8 +207,7 @@
>              } else {
>                  if (msgContext.getProperty(MessageContext.TRANSPORT_OUT) != null) {
>                      sendUsingOutputStream(msgContext, format, dataOut);
> -                }
> -                else {
> +                } else {
>                      throw new AxisFault("Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
>                  }
>              }
> @@ -265,53 +263,65 @@
>          }
>
>          format.setDoOptimize(msgContext.isDoingMTOM());
> -               format.setDoingSWA(msgContext.isDoingSwA());
> -               if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
> -                               & !(msgContext.isDoingREST())) {
> -                       StringWriter bufferedSOAPBody = new StringWriter();
> -                       dataOut.serializeAndConsume(bufferedSOAPBody, format);
> -                       MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
> -                                       out, msgContext.getAttachmentMap(), format);
> -               } else {
> -                       dataOut.serializeAndConsume(out, format);
> -               }
> +        format.setDoingSWA(msgContext.isDoingSwA());
> +        if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
> +                & !(msgContext.isDoingREST())) {
> +            StringWriter bufferedSOAPBody = new StringWriter();
> +            dataOut.serializeAndConsume(bufferedSOAPBody, format);
> +            MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
> +                    out, msgContext.getAttachmentMap(), format);
> +        } else {
> +            dataOut.serializeAndConsume(out, format);
> +        }
>      }
>
> -    public void writeMessageWithCommons(MessageContext msgContext,
> +    public void writeMessageWithCommons(MessageContext messageContext,
>                                          EndpointReference toEPR,
>                                          OMElement dataout,
>                                          OMOutputFormat format)
>              throws AxisFault {
>          try {
>              URL url = new URL(toEPR.getAddress());
> -            String soapActionString = msgContext.getSoapAction();
>
> -            if ((soapActionString == null) || (soapActionString.length() == 0)) {
> -                soapActionString = msgContext.getWSAAction();
> -            }
> +            String soapActionString = "\"\"";
>
>              Object disableSoapAction =
> -                msgContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
> -
> -            if (soapActionString == null || JavaUtils.isTrueExplicitly(disableSoapAction)) {
> +                    messageContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
> +
> +            if (!JavaUtils.isTrueExplicitly(disableSoapAction)) {
> +                // first try to get the SOAP action from message context
> +                soapActionString = messageContext.getSoapAction();
> +                if ((soapActionString == null) || (soapActionString.length() == 0)) {
> +                    // now let's try to get WSA action
> +                    soapActionString = messageContext.getWSAAction();
> +                    if (messageContext.getAxisOperation() != null && ((soapActionString == null) || (soapActionString.length() == 0))) {
> +                        // last option is to get it from the axis operation
> +                        soapActionString = messageContext.getAxisOperation().getSoapAction();
> +                    }
> +                }
> +
> +            }
> +
> +
> +            if (soapActionString == null) {
>                  soapActionString = "\"\"";
> -            }
> +            }
>
>              // select the Message Sender depending on the REST status
>              AbstractHTTPSender sender;
>
> -            if (!msgContext.isDoingREST()) {
> +            if (!messageContext.isDoingREST()) {
>                  sender = new SOAPOverHTTPSender();
>              } else {
>                  sender = new RESTSender();
>              }
> -            if (msgContext.getProperty(HTTPConstants.CHUNKED) != null) {
> -                chunked = JavaUtils.isTrueExplicitly(msgContext.getProperty(
> +            if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
> +                chunked = JavaUtils.isTrueExplicitly(messageContext.getProperty(
>                          HTTPConstants.CHUNKED));
>              }
>
> -            if (msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
> -                httpVersion = (String) msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
> +            if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
> +                httpVersion = (String) messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
>              }
>
>              // Following order needed to be preserved because,
> @@ -320,7 +330,7 @@
>              sender.setHttpVersion(httpVersion);
>              sender.setFormat(format);
>
> -            sender.send(msgContext, dataout, url, soapActionString);
> +            sender.send(messageContext, dataout, url, soapActionString);
>          } catch (MalformedURLException e) {
>              throw new AxisFault(e);
>          } catch (HttpException e) {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>


-- 
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

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


Re: svn commit: r464198 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java

Posted by Thilina Gunarathne <cs...@gmail.com>.
IIRC I did not raised an objection to this...

~Thilina

On 10/15/06, chinthaka@apache.org <ch...@apache.org> wrote:
> Author: chinthaka
> Date: Sun Oct 15 07:11:55 2006
> New Revision: 464198
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=464198
> Log:
> Fixing http://issues.apache.org/jira/browse/AXIS2-1386.
>
> I consider this as a fix that should go with the next release. Thilina, it is your call to accept this or not for Axis2 1.1.
>
>
> Modified:
>     webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
>
> Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=464198&r1=464197&r2=464198
> ==============================================================================
> --- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
> +++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Sun Oct 15 07:11:55 2006
> @@ -178,8 +178,7 @@
>
>              if (transportURL != null) {
>                  epr = new EndpointReference(transportURL);
> -            }
> -            else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
> +            } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
>                  epr = msgContext.getTo();
>              }
>
> @@ -208,8 +207,7 @@
>              } else {
>                  if (msgContext.getProperty(MessageContext.TRANSPORT_OUT) != null) {
>                      sendUsingOutputStream(msgContext, format, dataOut);
> -                }
> -                else {
> +                } else {
>                      throw new AxisFault("Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
>                  }
>              }
> @@ -265,53 +263,65 @@
>          }
>
>          format.setDoOptimize(msgContext.isDoingMTOM());
> -               format.setDoingSWA(msgContext.isDoingSwA());
> -               if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
> -                               & !(msgContext.isDoingREST())) {
> -                       StringWriter bufferedSOAPBody = new StringWriter();
> -                       dataOut.serializeAndConsume(bufferedSOAPBody, format);
> -                       MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
> -                                       out, msgContext.getAttachmentMap(), format);
> -               } else {
> -                       dataOut.serializeAndConsume(out, format);
> -               }
> +        format.setDoingSWA(msgContext.isDoingSwA());
> +        if (!(msgContext.isDoingMTOM()) & (msgContext.isDoingSwA())
> +                & !(msgContext.isDoingREST())) {
> +            StringWriter bufferedSOAPBody = new StringWriter();
> +            dataOut.serializeAndConsume(bufferedSOAPBody, format);
> +            MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
> +                    out, msgContext.getAttachmentMap(), format);
> +        } else {
> +            dataOut.serializeAndConsume(out, format);
> +        }
>      }
>
> -    public void writeMessageWithCommons(MessageContext msgContext,
> +    public void writeMessageWithCommons(MessageContext messageContext,
>                                          EndpointReference toEPR,
>                                          OMElement dataout,
>                                          OMOutputFormat format)
>              throws AxisFault {
>          try {
>              URL url = new URL(toEPR.getAddress());
> -            String soapActionString = msgContext.getSoapAction();
>
> -            if ((soapActionString == null) || (soapActionString.length() == 0)) {
> -                soapActionString = msgContext.getWSAAction();
> -            }
> +            String soapActionString = "\"\"";
>
>              Object disableSoapAction =
> -                msgContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
> -
> -            if (soapActionString == null || JavaUtils.isTrueExplicitly(disableSoapAction)) {
> +                    messageContext.getOptions().getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
> +
> +            if (!JavaUtils.isTrueExplicitly(disableSoapAction)) {
> +                // first try to get the SOAP action from message context
> +                soapActionString = messageContext.getSoapAction();
> +                if ((soapActionString == null) || (soapActionString.length() == 0)) {
> +                    // now let's try to get WSA action
> +                    soapActionString = messageContext.getWSAAction();
> +                    if (messageContext.getAxisOperation() != null && ((soapActionString == null) || (soapActionString.length() == 0))) {
> +                        // last option is to get it from the axis operation
> +                        soapActionString = messageContext.getAxisOperation().getSoapAction();
> +                    }
> +                }
> +
> +            }
> +
> +
> +            if (soapActionString == null) {
>                  soapActionString = "\"\"";
> -            }
> +            }
>
>              // select the Message Sender depending on the REST status
>              AbstractHTTPSender sender;
>
> -            if (!msgContext.isDoingREST()) {
> +            if (!messageContext.isDoingREST()) {
>                  sender = new SOAPOverHTTPSender();
>              } else {
>                  sender = new RESTSender();
>              }
> -            if (msgContext.getProperty(HTTPConstants.CHUNKED) != null) {
> -                chunked = JavaUtils.isTrueExplicitly(msgContext.getProperty(
> +            if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
> +                chunked = JavaUtils.isTrueExplicitly(messageContext.getProperty(
>                          HTTPConstants.CHUNKED));
>              }
>
> -            if (msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
> -                httpVersion = (String) msgContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
> +            if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
> +                httpVersion = (String) messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
>              }
>
>              // Following order needed to be preserved because,
> @@ -320,7 +330,7 @@
>              sender.setHttpVersion(httpVersion);
>              sender.setFormat(format);
>
> -            sender.send(msgContext, dataout, url, soapActionString);
> +            sender.send(messageContext, dataout, url, soapActionString);
>          } catch (MalformedURLException e) {
>              throw new AxisFault(e);
>          } catch (HttpException e) {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>


-- 
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

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