Author: thomas.diesler(a)jboss.com
Date: 2007-10-10 10:30:12 -0400 (Wed, 10 Oct 2007)
New Revision: 4726
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/JBWS1807TestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
stack/native/trunk/src/test/resources/jaxws/jbws1807/
stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/
stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/web.xml
stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/wsdl/
stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/wsdl/provider.wsdl
Modified:
stack/native/trunk/.classpath
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
stack/native/trunk/version.properties
Log:
[JBWS-1807] HTTP bindings for Provider
Modified: stack/native/trunk/.classpath
===================================================================
--- stack/native/trunk/.classpath 2007-10-10 14:23:04 UTC (rev 4725)
+++ stack/native/trunk/.classpath 2007-10-10 14:30:12 UTC (rev 4726)
@@ -38,5 +38,6 @@
<classpathentry combineaccessrules="false" kind="src"
path="/spi"/>
<classpathentry combineaccessrules="false" kind="src"
path="/common"/>
<classpathentry kind="lib" path="thirdparty/junit.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/jboss-jaxb-intros.jar"/>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-10-10 14:23:04 UTC (rev
4725)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-10-10 14:30:12 UTC (rev
4726)
@@ -388,6 +388,16 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1807 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws1807.war"
webxml="${tests.output.dir}/resources/jaxws/jbws1807/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/resources/jaxws/jbws1807/WEB-INF">
+ <include name="wsdl/**"/>
+ </webinf>
+ </war>
+
<!-- jaxws-jbws1813 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws1813.jar">
<fileset dir="${tests.output.dir}/classes">
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-10-10
14:23:04 UTC (rev 4725)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-10-10
14:30:12 UTC (rev 4726)
@@ -36,6 +36,7 @@
import javax.wsdl.Definition;
import javax.wsdl.Import;
import javax.wsdl.Port;
+import javax.wsdl.extensions.http.HTTPAddress;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.xml.namespace.QName;
@@ -316,7 +317,7 @@
// modify the wsdl-1.1 definition
if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
- replaceWSDL11SOAPAddress(wsdlDefinitions, portName,
serviceEndpointURL);
+ replaceWSDL11PortAddress(wsdlDefinitions, portName,
serviceEndpointURL);
}
else
{
@@ -338,13 +339,13 @@
throw new WSException("Cannot find port in wsdl: " + portName);
}
- private static void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName
portQName, String serviceEndpointURL)
+ private static void replaceWSDL11PortAddress(WSDLDefinitions wsdlDefinitions, QName
portQName, String serviceEndpointURL)
{
Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
// search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices());
+ Port wsdlOneOnePort = modifyPortAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices());
// recursivly process imports if none can be found
if (wsdlOneOnePort == null &&
!wsdlOneOneDefinition.getImports().isEmpty())
@@ -358,7 +359,7 @@
while (importsByNS.hasNext())
{
Import anImport = (Import)importsByNS.next();
- wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices());
+ wsdlOneOnePort = modifyPortAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices());
}
}
}
@@ -368,7 +369,7 @@
throw new IllegalArgumentException("Cannot find port with name '"
+ portQName + "' in wsdl document");
}
- private static Port modifySOAPAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
+ private static Port modifyPortAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
{
Port wsdlOneOnePort = null;
Iterator itServices = services.values().iterator();
@@ -391,11 +392,16 @@
SOAPAddress address = (SOAPAddress)extElement;
address.setLocationURI(serviceEndpointURL);
}
- if (extElement instanceof SOAP12Address)
+ else if (extElement instanceof SOAP12Address)
{
SOAP12Address address = (SOAP12Address)extElement;
address.setLocationURI(serviceEndpointURL);
}
+ else if (extElement instanceof HTTPAddress)
+ {
+ HTTPAddress address = (HTTPAddress)extElement;
+ address.setLocationURI(serviceEndpointURL);
+ }
}
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-10-10
14:23:04 UTC (rev 4725)
+++ stack/native/trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-10-10
14:30:12 UTC (rev 4726)
@@ -57,6 +57,7 @@
import javax.wsdl.extensions.ElementExtensible;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.http.HTTPBinding;
import javax.wsdl.extensions.mime.MIMEContent;
import javax.wsdl.extensions.mime.MIMEMultipartRelated;
import javax.wsdl.extensions.mime.MIMEPart;
@@ -991,6 +992,8 @@
QName srcBindingQName = srcBinding.getQName();
log.trace("processBinding: " + srcBindingQName);
+ boolean bindingProcessed = false;
+
if (destWsdl.getBinding(srcBindingQName) == null)
{
PortType srcPortType = getDefinedPortType(srcBinding);
@@ -1009,6 +1012,10 @@
{
bindingType = Constants.NS_SOAP12;
}
+ else if (extElement instanceof HTTPBinding)
+ {
+ bindingType = Constants.NS_HTTP;
+ }
else if ("binding".equals(elementType.getLocalPart()))
{
log.warn("Unsupported binding: " + elementType);
@@ -1020,40 +1027,41 @@
throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain
binding type for: " + srcBindingQName);
// Ignore unknown bindings
- if (Constants.NS_SOAP11.equals(bindingType) == false &&
Constants.NS_SOAP12.equals(bindingType) == false)
- return false;
+ if (Constants.NS_SOAP11.equals(bindingType) ||
Constants.NS_SOAP12.equals(bindingType) || Constants.NS_HTTP.equals(bindingType))
+ {
+ WSDLBinding destBinding = new WSDLBinding(destWsdl, srcBindingQName);
+ destBinding.setInterfaceName(srcPortType.getQName());
+ destBinding.setType(bindingType);
+ processUnknownExtensibilityElements(srcBinding, destBinding);
+ destWsdl.addBinding(destBinding);
- WSDLBinding destBinding = new WSDLBinding(destWsdl, srcBindingQName);
- destBinding.setInterfaceName(srcPortType.getQName());
- destBinding.setType(bindingType);
- processUnknownExtensibilityElements(srcBinding, destBinding);
- destWsdl.addBinding(destBinding);
+ // mark SWA Parts upfront
+ preProcessSWAParts(srcBinding, srcWsdl);
- // mark SWA Parts upfront
- preProcessSWAParts(srcBinding, srcWsdl);
+ processPortType(srcWsdl, srcPortType);
- processPortType(srcWsdl, srcPortType);
-
- String bindingStyle = Style.getDefaultStyle().toString();
- for (ExtensibilityElement extElement : extList)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPBinding)
+ String bindingStyle = Style.getDefaultStyle().toString();
+ for (ExtensibilityElement extElement : extList)
{
- SOAPBinding soapBinding = (SOAPBinding)extElement;
- bindingStyle = soapBinding.getStyle();
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBinding)
+ {
+ SOAPBinding soapBinding = (SOAPBinding)extElement;
+ bindingStyle = soapBinding.getStyle();
+ }
+ else if (extElement instanceof SOAP12Binding)
+ {
+ SOAP12Binding soapBinding = (SOAP12Binding)extElement;
+ bindingStyle = soapBinding.getStyle();
+ }
}
- else if (extElement instanceof SOAP12Binding)
- {
- SOAP12Binding soapBinding = (SOAP12Binding)extElement;
- bindingStyle = soapBinding.getStyle();
- }
+
+ processBindingOperations(srcWsdl, destBinding, srcBinding, bindingStyle);
+ bindingProcessed = true;
}
-
- processBindingOperations(srcWsdl, destBinding, srcBinding, bindingStyle);
}
- return true;
+ return bindingProcessed;
}
/** The port might reference a binding which is defined in another wsdl
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/JBWS1807TestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/JBWS1807TestCase.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/JBWS1807TestCase.java 2007-10-10
14:30:12 UTC (rev 4726)
@@ -0,0 +1,81 @@
+/*
+ * 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.jbws1807;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
+
+/**
+ * HTTP bindings for Provider
+ *
+ *
http://jira.jboss.org/jira/browse/JBWS-1807
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 09-Oct-2007
+ */
+public class JBWS1807TestCase extends JBossWSTest
+{
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws1807";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS1807TestCase.class,
"jaxws-jbws1807.war");
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ Element wsdl = DOMUtils.parse(wsdlURL.openStream());
+ assertNotNull(wsdl);
+ }
+
+ public void testProviderDispatch() throws Exception
+ {
+ String targetNS = "http://ws.com/";
+ QName serviceName = new QName(targetNS, "Provider");
+ QName portName = new QName(targetNS, "ProviderPort");
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
+ Dispatch<Source> dispatch = service.createDispatch(portName, Source.class,
Mode.PAYLOAD);
+ Source resPayload = dispatch.invoke(new
DOMSource(DOMUtils.parse("<input>hello</input>")));
+
+ Element docElement = DOMUtils.sourceToElement(resPayload);
+
assertEquals(DOMUtils.parse("<reply><input>hello</input></reply>"),
docElement);
+ }
+}
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java 2007-10-10
14:30:12 UTC (rev 4726)
@@ -0,0 +1,63 @@
+/*
+ * 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.jbws1807;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+
+@WebServiceProvider(wsdlLocation = "WEB-INF/wsdl/provider.wsdl", portName =
"ProviderPort", serviceName = "Provider", targetNamespace =
"http://ws.com/")
+@ServiceMode(value = Service.Mode.PAYLOAD)
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+public class ProviderImpl implements Provider<Source>
+{
+ // provide logging
+ private final static Logger log = Logger.getLogger(ProviderImpl.class);
+
+ public Source invoke(Source source)
+ {
+ try
+ {
+ String input = DOMWriter.printNode(DOMUtils.sourceToElement(source), false);
+ log.info("invoke: " + input);
+
+ String reply = "<reply>" + input + "</reply>";
+ return new StreamSource(new ByteArrayInputStream(reply.getBytes()));
+ }
+ catch (IOException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+}
\ No newline at end of file
Added: stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/web.xml
(rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/web.xml 2007-10-10
14:30:12 UTC (rev 4726)
@@ -0,0 +1,18 @@
+<?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>ProviderService</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws1807.ProviderImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProviderService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/wsdl/provider.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/wsdl/provider.wsdl
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jbws1807/WEB-INF/wsdl/provider.wsdl 2007-10-10
14:30:12 UTC (rev 4726)
@@ -0,0 +1,59 @@
+<?xml version='1.0'?>
+<definitions name='ProviderService'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+
xmlns:tns='http://ws.com/' targetNamespace='http://ws.com/'
+
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+
+ <message name='m1'>
+ <part name='part1' type='xsd:binary'/>
+ </message>
+
+ <message name='m2'>
+ <part name='response' type='xsd:binary'/>
+ </message>
+
+ <portType name="pt1">
+ <operation name="o1">
+ <input message="tns:m1"/>
+ <output message="tns:m2"/>
+ </operation>
+ </portType>
+ <portType name='pt2'>
+ <operation name='o1'>
+ <input message='tns:echo'/>
+ <output message='tns:echoResponse'/>
+ </operation>
+ </portType>
+
+ <binding name="b1" type="tns:pt2">
+ <http:binding verb="GET"/>
+ <operation name="o1">
+ <http:operation location="o1"/>
+ <input>
+ <http:urlEncoded/>
+ </input>
+ <output>
+ <mime:content type="text/xml"/>
+ </output>
+ </operation>
+ </binding>
+ <binding name='b2' type='tns:pt2'>
+ <soap:binding style='document'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='o1'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="ProviderService">
+ <port name="ProviderPort" binding="tns:b1">
+ <http:address location="REPLACE_WITH_ACTUAL_URL"/>
+ </port>
+ </service>
+
+</definitions>
\ No newline at end of file
Modified: stack/native/trunk/version.properties
===================================================================
--- stack/native/trunk/version.properties 2007-10-10 14:23:04 UTC (rev 4725)
+++ stack/native/trunk/version.properties 2007-10-10 14:30:12 UTC (rev 4726)
@@ -26,10 +26,9 @@
# Dependend integration projects
jbossws-spi=1.0.0.GA
jbossws-common=1.0.0.GA
-jbossws-framework=2.0.1.GA
+jbossws-framework=snapshot
jbossws-jboss40=2.0.1.GA
jbossws-jboss42=2.0.1.GA
-jbossws-jboss50=2.0.1.GA
# JBossAS-5.0
jboss-jbossxb-jboss50=2.0.0.CR4