Author: darran.lofthouse(a)jboss.com
Date: 2009-07-07 12:47:12 -0400 (Tue, 07 Jul 2009)
New Revision: 10316
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/Endpoint.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/EndpointImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/SOAPHandler.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/jboss-web.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/web.xml
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBWS-2698] Calling setPrefix(newPrefix) on any SOAPElement the prefix is not used for
marshalling.
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-04
14:44:05 UTC (rev 10315)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-07
16:47:12 UTC (rev 10316)
@@ -791,6 +791,13 @@
{
visitor.visitSOAPElement(this);
}
+
+ @Override
+ public void setPrefix(String prefix) throws DOMException
+ {
+ super.setPrefix(prefix);
+ elementName = null;
+ }
/**
* The default implementation uses a DOMWriter.
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2009-07-04
14:44:05 UTC (rev 10315)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2009-07-07
16:47:12 UTC (rev 10316)
@@ -558,8 +558,20 @@
<include
name="org/jboss/test/ws/jaxws/jbws2682/Endpoint.class"/>
<include
name="org/jboss/test/ws/jaxws/jbws2682/EndpointImpl.class"/>
</classes>
- </war>
+ </war>
+ <!-- jaxws-jbws2698 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2698.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2698/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2698/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2698/WEB-INF">
+ <include name="jboss-web.xml"/>
+ </webinf>
+ </war>
+
<!-- jaxws-webserviceref -->
<war warfile="${tests.output.dir}/test-libs/jaxws-webserviceref.war"
webxml="${tests.output.dir}/test-resources/jaxws/webserviceref/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/Endpoint.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/Endpoint.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/Endpoint.java 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2698;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 7th July 2009
+ */
+@WebService(name = "Endpoint", targetNamespace =
"http://ws.jboss.org/jbws2698")
+public interface Endpoint
+{
+
+ public String echo(final String message);
+
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/EndpointImpl.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/EndpointImpl.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/EndpointImpl.java 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2698;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 7th July 2009
+ */
+@WebService(name = "Endpoint", targetNamespace =
"http://ws.jboss.org/jbws2698", endpointInterface =
"org.jboss.test.ws.jaxws.jbws2698.Endpoint")
+@HandlerChain(file = "server-handlers.xml")
+public class EndpointImpl implements Endpoint
+{
+
+ public String echo(final String message)
+ {
+ return message;
+ }
+
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.java 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2698;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+import javax.xml.ws.handler.Handler;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-2698] Calling setPrefix(newPrefix) on any SOAPElement the
+ * prefix is not used for marshalling.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 7th July 2009
+ * @see
https://jira.jboss.org/jira/browse/JBWS-2698
+ */
+public class JBWS2698TestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws2698/";
+
+ private static Endpoint port;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBWS2698TestCase.class,
"jaxws-jbws2698.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new
QName("http://ws.jboss.org/jbws2698",
"EndpointImplService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(Endpoint.class);
+
+ BindingProvider bindingProvider = (BindingProvider)port;
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.add(new SOAPHandler());
+ bindingProvider.getBinding().setHandlerChain(handlerChain);
+ }
+
+ public void testCall() throws Exception
+ {
+ String message = "Howdy";
+
+ String response = port.echo(message);
+ assertEquals("Response", message, response);
+ }
+
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/SOAPHandler.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/SOAPHandler.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/SOAPHandler.java 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2698;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+/**
+ * Handler implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 7th July 2009
+ */
+public class SOAPHandler extends GenericSOAPHandler
+{
+ private static final String PREFIX = "JBWS2698";
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ try
+ {
+ SOAPMessage message = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
+ SOAPHeader header = message.getSOAPHeader();
+ SOAPBody body = message.getSOAPBody();
+
+ envelope.addNamespaceDeclaration(PREFIX,
SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
+ envelope.setPrefix(PREFIX);
+ checkPrefix(envelope);
+ header.setPrefix(PREFIX);
+ checkPrefix(header);
+ body.setPrefix(PREFIX);
+ checkPrefix(body);
+
+ message.saveChanges();
+ }
+ catch (SOAPException se)
+ {
+ throw new WSException(se);
+ }
+ return true;
+ }
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ try
+ {
+ SOAPMessage message = ((SOAPMessageContext)msgContext).getMessage();
+
+ SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
+ checkPrefix(envelope);
+ SOAPHeader header = message.getSOAPHeader();
+ checkPrefix(header);
+ SOAPBody body = message.getSOAPBody();
+ checkPrefix(body);
+ }
+ catch (SOAPException se)
+ {
+ throw new WSException(se);
+ }
+
+ return true;
+ }
+
+ private void checkPrefix(final SOAPElement element)
+ {
+ String prefix = element.getPrefix();
+ if (PREFIX.equals(prefix) == false)
+ {
+ throw new WSException("Expected prefix '" + PREFIX + "'
found prefix '" + prefix + "' for element '" +
element.getElementName());
+ }
+
+ }
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/SOAPHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://org.jboss.ws/jaxws/samples/logicalhandler"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name> SOAPHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2698.SOAPHandler
</handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/jboss-web.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/jboss-web.xml
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/jboss-web.xml 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+ <context-root>/jaxws-jbws2698</context-root>
+</jboss-web>
\ No newline at end of file
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/jboss-web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/web.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/web.xml
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/web.xml 2009-07-07
16:47:12 UTC (rev 10316)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
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">
+
+ <servlet>
+ <servlet-name>Endpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws2698.EndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Endpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2698/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF