[jboss-svn-commits] JBossWS SVN: r751 - in trunk/src/main/java/org/jboss/ws: jaxws/core soap

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Aug 14 18:09:42 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-08-14 18:09:38 -0400 (Mon, 14 Aug 2006)
New Revision: 751

Modified:
   trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
   trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
   trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
Log:
[JBWS-983] Configure SOAPAction on the Call object

Modified: trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java	2006-08-14 21:35:10 UTC (rev 750)
+++ trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java	2006-08-14 22:09:38 UTC (rev 751)
@@ -23,13 +23,24 @@
 
 // $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler at jboss.com $
 
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Call;
+import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.common.SOAPMessageContextBase;
 import org.jboss.ws.jaxrpc.Use;
 import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 
 /**
@@ -40,6 +51,9 @@
  */
 public class SOAP11BindingImpl extends SOAPBindingImpl
 {
+   // provide logging
+   private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
+   
    /** Create the SOAP-1.1 message */
    protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
    {
@@ -56,4 +70,35 @@
          
       return soapMessage;
    }
+
+   /** On the client side, generate the payload from IN parameters. */
+   public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+   {
+      SOAPMessage reqMessage = (SOAPMessage) super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+
+      // Set the SOAPAction 
+      MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+      String soapAction = opMetaData.getSOAPAction();
+
+      // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted value equal to the value of the soapAction attribute of
+      // soapbind:operation, if present in the corresponding WSDL description.
+
+      // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted empty string value, if in the corresponding WSDL description,
+      // the soapAction attribute of soapbind:operation is either not present, or
+      // present with an empty string as its value.
+
+      SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+      if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
+         log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+      String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
+      if (soapActionProperty != null)
+         soapAction = soapActionProperty;
+
+      mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+      return reqMessage;
+   }
 }

Modified: trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java	2006-08-14 21:35:10 UTC (rev 750)
+++ trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java	2006-08-14 22:09:38 UTC (rev 751)
@@ -37,7 +37,6 @@
 import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
-import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.Name;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPBodyElement;
@@ -91,6 +90,7 @@
  */
 public abstract class SOAPBindingImpl extends BindingImpl implements SOAPBinding
 {
+	// provide logging
    private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
    
    private boolean mtomEnabled;
@@ -231,11 +231,6 @@
             }
          }
 
-         // Set the SOAPAction 
-         MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
-         String soapAction = opMetaData.getSOAPAction();
-         mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
-         
          return reqMessage;
       }
       catch (Exception e)

Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java	2006-08-14 21:35:10 UTC (rev 750)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java	2006-08-14 22:09:38 UTC (rev 751)
@@ -232,13 +232,14 @@
       // with a quoted empty string value, if in the corresponding WSDL description,
       // the soapAction attribute of soapbind:operation is either not present, or
       // present with an empty string as its value.
-
+	   
       MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
       String[] action = mimeHeaders.getHeader("SOAPAction");
       if (action != null && action.length > 0)
       {
          String soapAction = action[0];
 
+         // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
          if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
             soapAction = "\"" + soapAction + "\"";
 




More information about the jboss-svn-commits mailing list