[jbossws-commits] JBossWS SVN: r3585 - in branches/jbossws-2.0: jbossws-core and 7 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Jun 14 14:38:23 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-14 14:38:23 -0400 (Thu, 14 Jun 2007)
New Revision: 3585

Added:
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/JBWS1611TestCase.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.java
   branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/
   branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/
   branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/web.xml
Modified:
   branches/jbossws-2.0/build/version.properties
   branches/jbossws-2.0/jbossws-core/.classpath
   branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
   branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
Log:
[JBWS-1611] SOAPAction is not sent in dispath requests

Modified: branches/jbossws-2.0/build/version.properties
===================================================================
--- branches/jbossws-2.0/build/version.properties	2007-06-14 15:10:57 UTC (rev 3584)
+++ branches/jbossws-2.0/build/version.properties	2007-06-14 18:38:23 UTC (rev 3585)
@@ -22,7 +22,7 @@
 jboss-common-logging-spi=2.0.2.GA
 jboss-javaee=5.0.0-SNAPSHOT
 jboss-jaxr=1.2.0.GA
-jboss-jbossxb=2.0.0.CR2
+jboss-jbossxb=1.0.0.GA
 jboss-microcontainer=2.0.0.Beta3
 junit=3.8.1
 stax-api=1.0

Modified: branches/jbossws-2.0/jbossws-core/.classpath
===================================================================
--- branches/jbossws-2.0/jbossws-core/.classpath	2007-06-14 15:10:57 UTC (rev 3584)
+++ branches/jbossws-2.0/jbossws-core/.classpath	2007-06-14 18:38:23 UTC (rev 3585)
@@ -17,7 +17,7 @@
 	<classpathentry kind="lib" path="thirdparty/jboss-microcontainer.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss-remoting.jar" sourcepath="thirdparty/jboss-remoting-src.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jbosssx-client.jar"/>
-	<classpathentry kind="lib" path="thirdparty/jboss-xml-binding.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-xml-binding.jar" sourcepath="thirdparty/jboss-xml-binding-sources.jar"/>
 	<classpathentry kind="lib" path="thirdparty/mail.jar"/>
 	<classpathentry kind="lib" path="thirdparty/servlet-api.jar"/>
 	<classpathentry kind="lib" path="thirdparty/stax-api.jar"/>

Modified: branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml	2007-06-14 15:10:57 UTC (rev 3584)
+++ branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml	2007-06-14 18:38:23 UTC (rev 3585)
@@ -264,6 +264,13 @@
       </fileset>
     </jar>
 
+    <!-- jaxws-jbws1611 -->
+    <war destfile="${tests.output.dir}/libs/jaxws-jbws1611.war" webxml="${tests.output.dir}/resources/jaxws/jbws1611/WEB-INF/web.xml">
+      <classes dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.class"/>
+      </classes>
+    </war>
+
     <!-- jaxws-jbws1666 -->
     <war destfile="${tests.output.dir}/libs/jaxws-jbws1666.war" webxml="${tests.output.dir}/resources/jaxws/jbws1666/WEB-INF/web.xml">
       <classes dir="${tests.output.dir}/classes">

Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java	2007-06-14 15:10:57 UTC (rev 3584)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java	2007-06-14 18:38:23 UTC (rev 3585)
@@ -29,6 +29,7 @@
 import java.util.concurrent.Future;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.Source;
 import javax.xml.ws.AsyncHandler;
@@ -111,6 +112,31 @@
    {
       MessageAbstraction reqMsg = getRequestMessage(obj);
       String targetAddress = epMetaData.getEndpointAddress();
+      
+      // 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.
+      String bindingID = bindingProvider.getBinding().getBindingID();
+      if (bindingID.indexOf("soap") > 0)
+      {
+         String soapAction = null; 
+         Map<String, Object> reqContext = getRequestContext();
+         Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
+         if (Boolean.TRUE.equals(useSOAPAction))
+         {
+            soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
+            if (soapAction == null)
+               throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+         }
+         MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
+         mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+      }
+      
       MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
       Object retObj = getReturnObject(resMsg);
       return retObj;

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/JBWS1611TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/JBWS1611TestCase.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/JBWS1611TestCase.java	2007-06-14 18:38:23 UTC (rev 3585)
@@ -0,0 +1,79 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.ws.jaxws.jbws1611;
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
+import org.jboss.wsf.spi.utils.DOMUtils;
+import org.jboss.wsf.spi.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * [JBWS-1611] SOAPAction is not sent in dispath requests
+ * 
+ * http://jira.jboss.org/jira/browse/JBWS-1611 
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 14-Jun-2007
+ */
+public class JBWS1611TestCase extends JBossWSTest
+{
+   private static final String targetNS = "http://jbws1611.jaxws.ws.test.jboss.org/";
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(JBWS1611TestCase.class, "jaxws-jbws1611.war");
+   }
+
+   public void testWebService() throws Exception
+   {
+      URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1611?wsdl");
+      QName serviceName = new QName(targetNS, "PingEndpointService");
+      QName portName = new QName(targetNS, "PingEndpointPort");
+      Service service = Service.create(wsdlURL, serviceName);
+      Dispatch dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+      dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
+      dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "uri:placeBuyOrder");
+      
+      String payload = "<ns1:ping xmlns:ns1='" + targetNS + "'/>";
+      Source retObj = (Source)dispatch.invoke(new StreamSource(new StringReader(payload)));
+      
+      Element docElement = DOMUtils.sourceToElement(retObj);
+      Element retElement = DOMUtils.getFirstChildElement(docElement);
+      String retPayload = DOMWriter.printNode(retElement, false);
+      assertEquals("<return>&quot;uri:placeBuyOrder&quot;</return>", retPayload);
+   }
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/JBWS1611TestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.java	2007-06-14 18:38:23 UTC (rev 3585)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1611;
+
+import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+
+ at WebService(name = "PingEndpoint", serviceName = "PingEndpointService")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public class PingEndpointImpl
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(PingEndpointImpl.class);
+
+   @Resource
+   WebServiceContext wsctx;
+
+   @WebMethod
+   public String ping()
+   {
+      HttpServletRequest req = (HttpServletRequest)wsctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+      String soapAction = req.getHeader("SOAPAction");
+      log.info("ping: " + soapAction);
+      return soapAction;
+   }
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1611/PingEndpointImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/web.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/web.xml	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/web.xml	2007-06-14 18:38:23 UTC (rev 3585)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+  version="2.4">
+
+  <servlet>
+    <servlet-name>TestService</servlet-name>
+    <servlet-class>org.jboss.test.ws.jaxws.jbws1611.PingEndpointImpl</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>TestService</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>
+


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/resources/jaxws/jbws1611/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list