[jboss-svn-commits] JBossWS SVN: r729 - in branches/tdiesler/trunk: . src/test/java/org/jboss/test/ws/jaxws src/test/java/org/jboss/test/ws/jaxws/binding src/test/resources/jaxws src/test/resources/jaxws/binding src/test/resources/jaxws/binding/WEB-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Aug 12 14:13:03 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-08-12 14:12:57 -0400 (Sat, 12 Aug 2006)
New Revision: 729
Added:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java
branches/tdiesler/trunk/src/test/resources/jaxws/binding/
branches/tdiesler/trunk/src/test/resources/jaxws/binding/WEB-INF/
branches/tdiesler/trunk/src/test/resources/jaxws/binding/WEB-INF/web.xml
Modified:
branches/tdiesler/trunk/.project
Log:
Generate WSDL with SOAP-1.2 binding
Add SOAP-1.2 binding test case
Modified: branches/tdiesler/trunk/.project
===================================================================
--- branches/tdiesler/trunk/.project 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/.project 2006-08-12 18:12:57 UTC (rev 729)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>trunk</name>
+ <name>trunk-tdiesler</name>
<comment></comment>
<projects>
</projects>
Added: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler.java 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler.java 2006-08-12 18:12:57 UTC (rev 729)
@@ -0,0 +1,101 @@
+/*
+ * 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.binding;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A client side handler for the ws-addressing
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 24-Nov-2005
+ */
+public class ClientHandler implements SOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(ClientHandler.class);
+
+ /**
+ * Gets the header blocks that can be processed by this Handler instance.
+ */
+ public Set<QName> getHeaders()
+ {
+ return new HashSet<QName>();
+ }
+
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outbound == null)
+ throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
+ }
+
+ public boolean handleOutbound(MessageContext msgContext)
+ {
+ return true;
+ }
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ SOAPElement soapElement = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + ":" + nsURI);
+
+ return true;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ public boolean handleFault(MessageContext messagecontext)
+ {
+ return true;
+ }
+
+ public void close(MessageContext messagecontext)
+ {
+ }
+}
Added: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2006-08-12 18:12:57 UTC (rev 729)
@@ -0,0 +1,68 @@
+/*
+ * 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.binding;
+
+// $Id: $
+
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.Constants;
+
+/**
+ * Test SOAP12 binding type
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-Aug-2006
+ */
+public class SOAPBindingTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(SOAPBindingTestCase.class, "jbossws-jaxws-binding.war");
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jbossws-jaxws-binding?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/binding", "SOAPEndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ SOAPEndpoint port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
+
+ BindingProvider provider = (BindingProvider)port;
+ List<Handler> handlerChain = provider.getBinding().getHandlerChain();
+ handlerChain.add(new ClientHandler());
+
+ String nsURI = port.namespace();
+ assertEquals(Constants.NS_SOAP12_ENV + ":" + Constants.NS_SOAP12_ENV, nsURI);
+ }
+
+}
Added: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2006-08-12 18:12:57 UTC (rev 729)
@@ -0,0 +1,29 @@
+/*
+ * 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.binding;
+
+// $Id: $
+
+public interface SOAPEndpoint
+{
+ public String namespace();
+}
Added: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java 2006-08-12 18:12:57 UTC (rev 729)
@@ -0,0 +1,72 @@
+/*
+ * 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.binding;
+
+// $Id: $
+
+import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+
+ at WebService(name = "SOAPEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/binding")
+ at SOAPBinding(style = Style.RPC)
+
+// This is the SOAP-1.2 binding identifier
+ at BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")
+public class SOAPEndpointBean
+{
+ private static Logger log = Logger.getLogger(SOAPEndpointBean.class);
+
+ @Resource
+ public WebServiceContext context;
+
+ @WebMethod
+ public String namespace()
+ {
+ try
+ {
+ SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
+ SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ log.info(nsURI);
+
+ return nsURI;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Added: branches/tdiesler/trunk/src/test/resources/jaxws/binding/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/binding/WEB-INF/web.xml 2006-08-12 17:50:27 UTC (rev 728)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/binding/WEB-INF/web.xml 2006-08-12 18:12:57 UTC (rev 729)
@@ -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.binding.SOAPEndpointBean</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
More information about the jboss-svn-commits
mailing list