JBossWS SVN: r8123 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089: src/main/java/org/jboss/ws/core/jaxws/handler and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-20 05:40:09 -0400 (Wed, 20 Aug 2008)
New Revision: 8123
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml
Removed:
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/ant-import-tests/build-jars-jaxws.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
Log:
[JBPAPP-1089] ClassCastException: org.jboss.ws.core.soap.TextImpl in LogicalMessageImpl.getPayload.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/ant-import-tests/build-jars-jaxws.xml 2008-08-19 18:16:36 UTC (rev 8122)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/ant-import-tests/build-jars-jaxws.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -402,6 +402,18 @@
<exclude name="org/jboss/test/ws/jaxws/jbws2000/*TestCase.class"/>
</fileset>
</jar>
+
+ <!-- jaxws-jbws2285 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws2285.war" webxml="${tests.output.dir}/resources/jaxws/jbws2285/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2285/*.class"/>
+ <exclude name="org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/jbws2285/WEB-INF">
+ <include name="jboss-web.xml"/>
+ <include name="server-handlers.xml"/>
+ </webinf>
+ </war>
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 18:16:36 UTC (rev 8122)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -49,6 +49,8 @@
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.spi.util.ServiceLoader;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* The LogicalMessageContext interface extends MessageContext to provide access to a the
@@ -78,7 +80,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
if (style == Style.RPC)
{
@@ -104,7 +106,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
try
{
if (style == Style.RPC)
@@ -138,9 +140,9 @@
HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
httpMessage.setXmlFragment(new XMLFragment(source));
}
-
+
MessageContextAssociation.peekMessageContext().setModified(true);
-
+
}
public Object getPayload(JAXBContext jaxbContext)
@@ -151,7 +153,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
payload = bodyElement.getObjectValue();
@@ -171,7 +173,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
bodyElement.setObjectValue(payload);
@@ -184,6 +186,23 @@
}
}
+ private SOAPElement getBodyElement(final SOAPBodyImpl soapBody)
+ {
+ SOAPElement bodyElement = null;
+
+ NodeList nodes = soapBody.getChildNodes();
+ for (int i = 0; i < nodes.getLength() && bodyElement == null; i++)
+ {
+ Node current = nodes.item(i);
+ if (current instanceof SOAPElement)
+ {
+ bodyElement = (SOAPElement)current;
+ }
+ }
+
+ return bodyElement;
+ }
+
private SOAPBodyImpl getSOAPBody(SOAPMessage soapMessage)
{
SOAPBodyImpl soapBody = null;
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285 (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285)
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.jws.WebService;
-
-/**
- * Test Endpoint.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285")
-public interface Endpoint
-{
-
- public String echo(final String message);
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285")
+public interface Endpoint
+{
+
+ public String echo(final String message);
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.jws.HandlerChain;
-import javax.jws.WebService;
-
-/**
- * Test Endpoint implementation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285", endpointInterface = "org.jboss.test.ws.jaxws.jbws2285.Endpoint")
-@HandlerChain(file = "WEB-INF/server-handlers.xml")
-public class EndpointImpl implements Endpoint
-{
-
- public String echo(final String message)
- {
- return message;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285", endpointInterface = "org.jboss.test.ws.jaxws.jbws2285.Endpoint")
+@HandlerChain(file = "WEB-INF/server-handlers.xml")
+public class EndpointImpl implements Endpoint
+{
+
+ public String echo(final String message)
+ {
+ return message;
+ }
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.ws.core.soap.NodeImpl;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * [JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl
- * in LogicalMessageImpl.getPayload.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- * @see https://jira.jboss.org/jira/browse/JBWS-2285
- */
-public class JBWS2285TestCase extends JBossWSTest
-{
-
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2285/";
-
- private static Endpoint port;
-
- public static Test suite() throws Exception
- {
- return new JBossWSTestSetup(JBWS2285TestCase.class, "jaxws-jbws2285.war");
- }
-
- public void setUp() throws Exception
- {
- super.setUp();
- URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- QName serviceName = new QName("http://ws.jboss.org/jbws2285", "EndpointImplService");
-
- Service service = Service.create(wsdlURL, serviceName);
- port = service.getPort(Endpoint.class);
- }
-
- public void testCall() throws Exception
- {
- final String message = "Hello!!";
- String response = port.echo(message);
-
- // The logical handler should have replaced the incoming String.
- assertEquals("XXX", response);
- }
-
- public void testSOAPConnection() throws Exception
- {
- SOAPMessage reqMsg = getRequestMessage();
- URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- String response = "";
-
- SOAPBody body = resEnv.getBody();
- Iterator it = body.getChildElements(new QName("http://ws.jboss.org/jbws2285", "echoResponse"));
- Node node = (Node)it.next();
- NodeList nodes = node.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++)
- {
- Node current = nodes.item(i);
- if (current.getNodeName().equals("return"))
- {
- response = ((NodeImpl)current).getValue();
- }
- }
-
- // The logical handler should have replaced the incoming String.
- assertEquals("XXX", response);
- }
-
- private SOAPMessage getRequestMessage() throws SOAPException, IOException
- {
- URL reqMessage = new File("resources/jaxws/jbws2285/request-message.xml").toURL();
- MessageFactory msgFactory = MessageFactory.newInstance();
-
- SOAPMessage reqMsg = msgFactory.createMessage(null, reqMessage.openStream());
- return reqMsg;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.soap.NodeImpl;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * [JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl
+ * in LogicalMessageImpl.getPayload.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ * @see https://jira.jboss.org/jira/browse/JBWS-2285
+ */
+public class JBWS2285TestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2285/";
+
+ private static Endpoint port;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBWS2285TestCase.class, "jaxws-jbws2285.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://ws.jboss.org/jbws2285", "EndpointImplService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(Endpoint.class);
+ }
+
+ public void testCall() throws Exception
+ {
+ final String message = "Hello!!";
+ String response = port.echo(message);
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ public void testSOAPConnection() throws Exception
+ {
+ SOAPMessage reqMsg = getRequestMessage();
+ URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage resMsg = con.call(reqMsg, epURL);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ String response = "";
+
+ SOAPBody body = resEnv.getBody();
+ Iterator it = body.getChildElements(new QName("http://ws.jboss.org/jbws2285", "echoResponse"));
+ Node node = (Node)it.next();
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if (current.getNodeName().equals("return"))
+ {
+ response = ((NodeImpl)current).getValue();
+ }
+ }
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ private SOAPMessage getRequestMessage() throws SOAPException, IOException
+ {
+ URL reqMessage = new File("resources/jaxws/jbws2285/request-message.xml").toURL();
+ MessageFactory msgFactory = MessageFactory.newInstance();
+
+ SOAPMessage reqMsg = msgFactory.createMessage(null, reqMessage.openStream());
+ return reqMsg;
+ }
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.ws.LogicalMessage;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.test.GenericLogicalHandler;
-
-/**
- * Logical handler implementation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-public class LogicalHandler extends GenericLogicalHandler
-{
-
- private static final Logger log = Logger.getLogger(LogicalHandler.class);
-
- @Override
- protected boolean handleInbound(final MessageContext msgContext)
- {
- log.info("handleInbound()");
-
- LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
- LogicalMessage message = lmc.getMessage();
-
- Object payload = message.getPayload();
-
- if (payload instanceof DOMSource == false)
- {
- throw new WSException("Test requires DOMSource payload");
- }
-
- DOMSource domPayload = (DOMSource)payload;
- Node node = domPayload.getNode();
-
- NodeList nodes = node.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++)
- {
- Node current = nodes.item(i);
- if ("arg0".equals(current.getLocalName()))
- {
- current.setTextContent("XXX");
- }
- }
-
- log.info(DOMWriter.printNode(node, false));
-
- return true;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-20 09:40:09 UTC (rev 8123)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.test.GenericLogicalHandler;
+
+/**
+ * Logical handler implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+public class LogicalHandler extends GenericLogicalHandler
+{
+
+ private static final Logger log = Logger.getLogger(LogicalHandler.class);
+
+ @Override
+ protected boolean handleInbound(final MessageContext msgContext)
+ {
+ log.info("handleInbound()");
+
+ LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
+ LogicalMessage message = lmc.getMessage();
+
+ Object payload = message.getPayload();
+
+ if (payload instanceof DOMSource == false)
+ {
+ throw new WSException("Test requires DOMSource payload");
+ }
+
+ DOMSource domPayload = (DOMSource)payload;
+ Node node = domPayload.getNode();
+
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if ("arg0".equals(current.getLocalName()))
+ {
+ current.setTextContent("XXX");
+ }
+ }
+
+ log.info(DOMWriter.printNode(node, false));
+
+ return true;
+ }
+
+}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285 (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285)
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF)
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,7 +0,0 @@
-<?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-jbws2285</context-root>
-</jboss-web>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -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-jbws2285</context-root>
+</jboss-web>
\ No newline at end of file
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,15 +0,0 @@
-<?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> LogicalServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.jbws2285.LogicalHandler </handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -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> LogicalServerHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2285.LogicalHandler </handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,16 +0,0 @@
-<?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.jbws2285.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
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -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.jbws2285.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
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -1,8 +0,0 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://ws.jboss.org/jbws2285">
- <soapenv:Header/>
- <soapenv:Body>
- <jbw:echo>
- <arg0>SSS</arg0>
- </jbw:echo>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml (from rev 8120, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-20 09:40:09 UTC (rev 8123)
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://ws.jboss.org/jbws2285">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>SSS</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
16 years, 1 month
JBossWS SVN: r8122 - in framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test: resources/jaxws/samples/context/WEB-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 14:16:36 -0400 (Tue, 19 Aug 2008)
New Revision: 8122
Removed:
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/resources/jaxws/samples/context/WEB-INF/wsdl/
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
Log:
[JBPAPP-1089] Implement standard message context properties.
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2008-08-19 18:16:23 UTC (rev 8121)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2008-08-19 18:16:36 UTC (rev 8122)
@@ -23,6 +23,7 @@
// $Id$
+import java.io.IOException;
import java.security.Principal;
import javax.annotation.Resource;
@@ -32,10 +33,16 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.spi.annotation.WebContext;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
@WebService(name = "TestEndpoint", serviceName="TestEndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
@SOAPBinding(style = Style.RPC)
@@ -54,11 +61,47 @@
@WebMethod
public String testGetMessageContext()
{
- MessageContext jaxwsContext = (MessageContext)wsCtx.getMessageContext();
- return jaxwsContext != null ? "pass" : "fail";
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ return msgContext == null ? "fail" : "pass";
}
@WebMethod
+ public String testMessageContextProperties()
+ {
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ if (msgContext == null)
+ return "fail";
+
+ // Check standard jaxws properties
+ InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
+ QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
+ QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
+ QName operation = (QName)msgContext.get(MessageContext.WSDL_OPERATION);
+
+ if (!service.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService")))
+ throw new WebServiceException("Invalid qname: " + service);
+ if (!portType.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpoint")))
+ throw new WebServiceException("Invalid qname: " + portType);
+ if (!port.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpointPort")))
+ throw new WebServiceException("Invalid qname: " + port);
+ if (!operation.equals(new QName("http://org.jboss.ws/jaxws/context", "testMessageContextProperties")))
+ throw new WebServiceException("Invalid qname: " + operation);
+
+ try
+ {
+ Element root = DOMUtils.parse(wsdlSource);
+ new DOMWriter(System.out).setPrettyprint(true).print(root);
+ }
+ catch (IOException ex)
+ {
+ throw new WebServiceException("Cannot parse MessageContext.WSDL_DESCRIPTION", ex);
+ }
+
+ return "pass";
+ }
+
+ @WebMethod
public String testGetUserPrincipal()
{
Principal principal = wsCtx.getUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2008-08-19 18:16:23 UTC (rev 8121)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2008-08-19 18:16:36 UTC (rev 8122)
@@ -23,6 +23,7 @@
// $Id: $
+import java.io.IOException;
import java.security.Principal;
import javax.annotation.Resource;
@@ -30,10 +31,17 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-@WebService(name = "TestEndpoint", serviceName = "TestEndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+@WebService(name = "Endpoint", serviceName = "EndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
@SOAPBinding(style = Style.RPC)
public class EndpointJSE
{
@@ -43,11 +51,47 @@
@WebMethod
public String testGetMessageContext()
{
- MessageContext jaxwsContext = (MessageContext)wsCtx.getMessageContext();
- return jaxwsContext != null ? "pass" : "fail";
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ return msgContext == null ? "fail" : "pass";
}
@WebMethod
+ public String testMessageContextProperties()
+ {
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ if (msgContext == null)
+ return "fail";
+
+ // Check standard jaxws properties
+ InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
+ QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
+ QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
+ QName operation = (QName)msgContext.get(MessageContext.WSDL_OPERATION);
+
+ if (!service.equals(new QName("http://org.jboss.ws/jaxws/context", "EndpointService")))
+ throw new WebServiceException("Invalid qname: " + service);
+ if (!portType.equals(new QName("http://org.jboss.ws/jaxws/context", "Endpoint")))
+ throw new WebServiceException("Invalid qname: " + portType);
+ if (!port.equals(new QName("http://org.jboss.ws/jaxws/context", "EndpointPort")))
+ throw new WebServiceException("Invalid qname: " + port);
+ if (!operation.equals(new QName("http://org.jboss.ws/jaxws/context", "testMessageContextProperties")))
+ throw new WebServiceException("Invalid qname: " + operation);
+
+ try
+ {
+ Element root = DOMUtils.parse(wsdlSource);
+ new DOMWriter(System.out).setPrettyprint(true).print(root);
+ }
+ catch (IOException ex)
+ {
+ throw new WebServiceException("Cannot parse MessageContext.WSDL_DESCRIPTION", ex);
+ }
+
+ return "pass";
+ }
+
+ @WebMethod
public String testGetUserPrincipal()
{
Principal principal = wsCtx.getUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java 2008-08-19 18:16:23 UTC (rev 8121)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java 2008-08-19 18:16:36 UTC (rev 8122)
@@ -29,6 +29,10 @@
@WebResult(targetNamespace = "http://org.jboss.ws/jaxws/context", partName = "return")
public String testGetMessageContext();
+ @WebMethod
+ @WebResult(targetNamespace = "http://org.jboss.ws/jaxws/context", partName = "return")
+ public String testMessageContextProperties();
+
/**
*
* @return
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2008-08-19 18:16:23 UTC (rev 8121)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2008-08-19 18:16:36 UTC (rev 8122)
@@ -54,8 +54,9 @@
{
if (port == null)
{
- URL wsdlURL = new File("resources/jaxws/samples/context/WEB-INF/wsdl/TestEndpoint.wsdl").toURL();
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-context?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService");
+
Service service = Service.create(wsdlURL, qname);
port = (TestEndpoint)service.getPort(TestEndpoint.class);
@@ -71,6 +72,12 @@
assertEquals("pass", retStr);
}
+ public void testMessageContextProperties() throws Exception
+ {
+ String retStr = port.testMessageContextProperties();
+ assertEquals("pass", retStr);
+ }
+
public void testGetUserPrincipal() throws Exception
{
String retStr = port.testGetUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2008-08-19 18:16:23 UTC (rev 8121)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2008-08-19 18:16:36 UTC (rev 8122)
@@ -54,8 +54,9 @@
{
if (port == null)
{
- URL wsdlURL = new File("resources/jaxws/samples/context/WEB-INF/wsdl/TestEndpoint.wsdl").toURL();
- QName qname = new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-context?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/context", "EndpointService");
+
Service service = Service.create(wsdlURL, qname);
port = (TestEndpoint)service.getPort(TestEndpoint.class);
@@ -71,6 +72,12 @@
assertEquals("pass", retStr);
}
+ public void testMessageContextProperties() throws Exception
+ {
+ String retStr = port.testMessageContextProperties();
+ assertEquals("pass", retStr);
+ }
+
public void testGetUserPrincipal() throws Exception
{
String retStr = port.testGetUserPrincipal();
16 years, 1 month
JBossWS SVN: r8121 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src: main/java/org/jboss/ws/core/jaxws/handler and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 14:16:23 -0400 (Tue, 19 Aug 2008)
New Revision: 8121
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
Log:
[JBPAPP-1089] Implement standard message context properties.
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src
___________________________________________________________________
Name: svn:externals
- test-framework https://svn.jboss.org/repos/jbossws/framework/branches/jbossws-framework-...
+ test-framework https://svn.jboss.org/repos/jbossws/framework/branches/jbossws-framework-...
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-08-19 18:16:23 UTC (rev 8121)
@@ -23,16 +23,22 @@
// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene(a)jboss.com $
+import java.io.IOException;
+import java.net.URL;
+
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxws.SerializationContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
+import org.xml.sax.InputSource;
/**
* The interface MessageContext abstracts the message context that is processed by a handler in the handle method.
@@ -105,12 +111,43 @@
MessageContextAssociation.popMessageContext();
SOAPMessageContextJAXWS resContext = new SOAPMessageContextJAXWS(reqContext);
resContext.setSOAPMessage(null);
-
+
// Reverse the direction
resContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(!outbound));
-
+
MessageContextAssociation.pushMessageContext(resContext);
return resContext;
}
+ @Override
+ public void setOperationMetaData(OperationMetaData opMetaData)
+ {
+ super.setOperationMetaData(opMetaData);
+
+ // [JBWS-2031] Implement standard message context properties
+ if (opMetaData != null)
+ {
+ EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+
+ URL wsdlURL = serviceMetaData.getWsdlFileOrLocation();
+ if (wsdlURL != null)
+ {
+ try
+ {
+ InputSource inputSource = new InputSource(wsdlURL.openStream());
+ put(MessageContext.WSDL_DESCRIPTION, inputSource);
+ }
+ catch (IOException ex)
+ {
+ throw new WSException("Cannot open: " + wsdlURL);
+ }
+ }
+
+ put(MessageContext.WSDL_SERVICE, serviceMetaData.getServiceName());
+ put(MessageContext.WSDL_PORT, epMetaData.getPortName());
+ put(MessageContext.WSDL_INTERFACE, epMetaData.getPortTypeName());
+ put(MessageContext.WSDL_OPERATION, opMetaData.getQName());
+ }
+ }
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-08-19 17:50:57 UTC (rev 8120)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-08-19 18:16:23 UTC (rev 8121)
@@ -78,7 +78,7 @@
private String wsdlFile;
private URL mappingLocation;
private String wsdlPublishLocation;
-
+
// The optional service handlers
private List<HandlerMetaDataJAXWS> handlers = new ArrayList<HandlerMetaDataJAXWS>();
@@ -89,16 +89,16 @@
// Arbitrary properties given by <call-property>
private Properties properties;
-
+
// derived cached encoding style
private Use encStyle;
-
+
// The security configuration
private WSSecurityConfiguration securityConfig;
-
+
// The key to the wsdl cache
private String wsdlCacheKey;
-
+
public ServiceMetaData(UnifiedMetaData wsMetaData, QName serviceName)
{
this.wsMetaData = wsMetaData;
@@ -190,7 +190,7 @@
{
handlers.add(handler);
}
-
+
public List<HandlerMetaDataJAXWS> getHandlerMetaData()
{
return Collections.unmodifiableList(handlers);
@@ -279,6 +279,28 @@
*/
public WSDLDefinitions getWsdlDefinitions()
{
+ URL wsdlURL = getWsdlFileOrLocation();
+
+ WSDLDefinitions wsdlDefinitions = null;
+ if (wsdlURL != null)
+ {
+ // The key should not after it is assigned
+ if (wsdlCacheKey == null)
+ wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation : wsdlFile);
+
+ wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
+ if (wsdlDefinitions == null)
+ {
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ wsdlDefinitions = factory.parse(wsdlURL);
+ wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
+ }
+ }
+ return wsdlDefinitions;
+ }
+
+ public URL getWsdlFileOrLocation()
+ {
URL wsdlURL = wsdlLocation;
if (wsdlURL == null && wsdlFile != null)
{
@@ -291,7 +313,7 @@
{
// ignore
}
-
+
// Try wsdlFile as child from root
if (wsdlURL == null)
{
@@ -306,23 +328,8 @@
}
}
}
-
- WSDLDefinitions wsdlDefinitions = null;
- if (wsdlURL != null)
- {
- // The key should not after it is assigned
- if (wsdlCacheKey == null)
- wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation : wsdlFile);
-
- wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
- if (wsdlDefinitions == null)
- {
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- wsdlDefinitions = factory.parse(wsdlURL);
- wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
- }
- }
- return wsdlDefinitions;
+
+ return wsdlURL;
}
public TypeMappingImpl getTypeMapping()
16 years, 1 month
JBossWS SVN: r8120 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP: src/main/java/org/jboss/ws/core/jaxws/handler and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 13:50:57 -0400 (Tue, 19 Aug 2008)
New Revision: 8120
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml
Removed:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
Log:
[JBPAPP-1088] ClassCastException: org.jboss.ws.core.soap.TextImpl in LogicalMessageImpl.getPayload.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml 2008-08-19 17:45:22 UTC (rev 8119)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -509,6 +509,18 @@
<include name="wsdl/*"/>
</webinf>
</war>
+
+ <!-- jaxws-jbws2285 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws2285.war" webxml="${tests.output.dir}/resources/jaxws/jbws2285/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2285/*.class"/>
+ <exclude name="org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/jbws2285/WEB-INF">
+ <include name="jboss-web.xml"/>
+ <include name="server-handlers.xml"/>
+ </webinf>
+ </war>
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 17:45:22 UTC (rev 8119)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -49,6 +49,8 @@
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.spi.util.ServiceLoader;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* The LogicalMessageContext interface extends MessageContext to provide access to a the
@@ -78,7 +80,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
if (style == Style.RPC)
{
@@ -104,7 +106,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
try
{
if (style == Style.RPC)
@@ -138,9 +140,9 @@
HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
httpMessage.setXmlFragment(new XMLFragment(source));
}
-
+
MessageContextAssociation.peekMessageContext().setModified(true);
-
+
}
public Object getPayload(JAXBContext jaxbContext)
@@ -151,7 +153,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
payload = bodyElement.getObjectValue();
@@ -171,7 +173,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
bodyElement.setObjectValue(payload);
@@ -184,6 +186,23 @@
}
}
+ private SOAPElement getBodyElement(final SOAPBodyImpl soapBody)
+ {
+ SOAPElement bodyElement = null;
+
+ NodeList nodes = soapBody.getChildNodes();
+ for (int i = 0; i < nodes.getLength() && bodyElement == null; i++)
+ {
+ Node current = nodes.item(i);
+ if (current instanceof SOAPElement)
+ {
+ bodyElement = (SOAPElement)current;
+ }
+ }
+
+ return bodyElement;
+ }
+
private SOAPBodyImpl getSOAPBody(SOAPMessage soapMessage)
{
SOAPBodyImpl soapBody = null;
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285 (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285)
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.jws.WebService;
-
-/**
- * Test Endpoint.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285")
-public interface Endpoint
-{
-
- public String echo(final String message);
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285")
+public interface Endpoint
+{
+
+ public String echo(final String message);
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.jws.HandlerChain;
-import javax.jws.WebService;
-
-/**
- * Test Endpoint implementation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285", endpointInterface = "org.jboss.test.ws.jaxws.jbws2285.Endpoint")
-@HandlerChain(file = "WEB-INF/server-handlers.xml")
-public class EndpointImpl implements Endpoint
-{
-
- public String echo(final String message)
- {
- return message;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285", endpointInterface = "org.jboss.test.ws.jaxws.jbws2285.Endpoint")
+@HandlerChain(file = "WEB-INF/server-handlers.xml")
+public class EndpointImpl implements Endpoint
+{
+
+ public String echo(final String message)
+ {
+ return message;
+ }
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.ws.core.soap.NodeImpl;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * [JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl
- * in LogicalMessageImpl.getPayload.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- * @see https://jira.jboss.org/jira/browse/JBWS-2285
- */
-public class JBWS2285TestCase extends JBossWSTest
-{
-
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2285/";
-
- private static Endpoint port;
-
- public static Test suite() throws Exception
- {
- return new JBossWSTestSetup(JBWS2285TestCase.class, "jaxws-jbws2285.war");
- }
-
- public void setUp() throws Exception
- {
- super.setUp();
- URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- QName serviceName = new QName("http://ws.jboss.org/jbws2285", "EndpointImplService");
-
- Service service = Service.create(wsdlURL, serviceName);
- port = service.getPort(Endpoint.class);
- }
-
- public void testCall() throws Exception
- {
- final String message = "Hello!!";
- String response = port.echo(message);
-
- // The logical handler should have replaced the incoming String.
- assertEquals("XXX", response);
- }
-
- public void testSOAPConnection() throws Exception
- {
- SOAPMessage reqMsg = getRequestMessage();
- URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- String response = "";
-
- SOAPBody body = resEnv.getBody();
- Iterator it = body.getChildElements(new QName("http://ws.jboss.org/jbws2285", "echoResponse"));
- Node node = (Node)it.next();
- NodeList nodes = node.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++)
- {
- Node current = nodes.item(i);
- if (current.getNodeName().equals("return"))
- {
- response = ((NodeImpl)current).getValue();
- }
- }
-
- // The logical handler should have replaced the incoming String.
- assertEquals("XXX", response);
- }
-
- private SOAPMessage getRequestMessage() throws SOAPException, IOException
- {
- URL reqMessage = getResourceFile("jaxws/jbws2285/request-message.xml").toURL();
- MessageFactory msgFactory = MessageFactory.newInstance();
-
- SOAPMessage reqMsg = msgFactory.createMessage(null, reqMessage.openStream());
- return reqMsg;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.soap.NodeImpl;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * [JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl
+ * in LogicalMessageImpl.getPayload.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ * @see https://jira.jboss.org/jira/browse/JBWS-2285
+ */
+public class JBWS2285TestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2285/";
+
+ private static Endpoint port;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBWS2285TestCase.class, "jaxws-jbws2285.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://ws.jboss.org/jbws2285", "EndpointImplService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(Endpoint.class);
+ }
+
+ public void testCall() throws Exception
+ {
+ final String message = "Hello!!";
+ String response = port.echo(message);
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ public void testSOAPConnection() throws Exception
+ {
+ SOAPMessage reqMsg = getRequestMessage();
+ URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage resMsg = con.call(reqMsg, epURL);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ String response = "";
+
+ SOAPBody body = resEnv.getBody();
+ Iterator it = body.getChildElements(new QName("http://ws.jboss.org/jbws2285", "echoResponse"));
+ Node node = (Node)it.next();
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if (current.getNodeName().equals("return"))
+ {
+ response = ((NodeImpl)current).getValue();
+ }
+ }
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ private SOAPMessage getRequestMessage() throws SOAPException, IOException
+ {
+ URL reqMessage = new File("resources/jaxws/jbws2285/request-message.xml").toURL();
+ MessageFactory msgFactory = MessageFactory.newInstance();
+
+ SOAPMessage reqMsg = msgFactory.createMessage(null, reqMessage.openStream());
+ return reqMsg;
+ }
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.jbws2285;
-
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.ws.LogicalMessage;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.test.GenericLogicalHandler;
-
-/**
- * Logical handler implementation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 19th August 2008
- */
-public class LogicalHandler extends GenericLogicalHandler
-{
-
- private static final Logger log = Logger.getLogger(LogicalHandler.class);
-
- @Override
- protected boolean handleInbound(final MessageContext msgContext)
- {
- log.info("handleInbound()");
-
- LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
- LogicalMessage message = lmc.getMessage();
-
- Object payload = message.getPayload();
-
- if (payload instanceof DOMSource == false)
- {
- throw new WSException("Test requires DOMSource payload");
- }
-
- DOMSource domPayload = (DOMSource)payload;
- Node node = domPayload.getNode();
-
- NodeList nodes = node.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++)
- {
- Node current = nodes.item(i);
- if ("arg0".equals(current.getLocalName()))
- {
- current.setTextContent("XXX");
- }
- }
-
- log.info(DOMWriter.printNode(node, false));
-
- return true;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-19 17:50:57 UTC (rev 8120)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.test.GenericLogicalHandler;
+
+/**
+ * Logical handler implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+public class LogicalHandler extends GenericLogicalHandler
+{
+
+ private static final Logger log = Logger.getLogger(LogicalHandler.class);
+
+ @Override
+ protected boolean handleInbound(final MessageContext msgContext)
+ {
+ log.info("handleInbound()");
+
+ LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
+ LogicalMessage message = lmc.getMessage();
+
+ Object payload = message.getPayload();
+
+ if (payload instanceof DOMSource == false)
+ {
+ throw new WSException("Test requires DOMSource payload");
+ }
+
+ DOMSource domPayload = (DOMSource)payload;
+ Node node = domPayload.getNode();
+
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if ("arg0".equals(current.getLocalName()))
+ {
+ current.setTextContent("XXX");
+ }
+ }
+
+ log.info(DOMWriter.printNode(node, false));
+
+ return true;
+ }
+
+}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285 (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285)
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF)
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,7 +0,0 @@
-<?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-jbws2285</context-root>
-</jboss-web>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -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-jbws2285</context-root>
+</jboss-web>
\ No newline at end of file
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,15 +0,0 @@
-<?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> LogicalServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.jbws2285.LogicalHandler </handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -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> LogicalServerHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2285.LogicalHandler </handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,16 +0,0 @@
-<?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.jbws2285.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
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -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.jbws2285.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
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-19 16:42:48 UTC (rev 8116)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -1,8 +0,0 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://ws.jboss.org/jbws2285">
- <soapenv:Header/>
- <soapenv:Body>
- <jbw:echo>
- <arg0>SSS</arg0>
- </jbw:echo>
- </soapenv:Body>
-</soapenv:Envelope>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml (from rev 8116, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-19 17:50:57 UTC (rev 8120)
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://ws.jboss.org/jbws2285">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>SSS</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
16 years, 1 month
JBossWS SVN: r8119 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 13:45:22 -0400 (Tue, 19 Aug 2008)
New Revision: 8119
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
Log:
[JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl in LogicalMessageImpl.getPayload.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 17:24:39 UTC (rev 8118)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 17:45:22 UTC (rev 8119)
@@ -151,7 +151,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = getBodyElement(soapBody);
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
payload = bodyElement.getObjectValue();
@@ -171,7 +171,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = getBodyElement(soapBody);
+ SOAPContentElement bodyElement = (SOAPContentElement)getBodyElement(soapBody);
if (bodyElement != null)
{
bodyElement.setObjectValue(payload);
@@ -184,17 +184,17 @@
}
}
- private SOAPContentElement getBodyElement(final SOAPBodyImpl soapBody)
+ private SOAPElement getBodyElement(final SOAPBodyImpl soapBody)
{
- SOAPContentElement bodyElement = null;
+ SOAPElement bodyElement = null;
NodeList nodes = soapBody.getChildNodes();
for (int i = 0; i < nodes.getLength() && bodyElement == null; i++)
{
Node current = nodes.item(i);
- if (current instanceof SOAPContentElement)
+ if (current instanceof SOAPElement)
{
- bodyElement = (SOAPContentElement)current;
+ bodyElement = (SOAPElement)current;
}
}
16 years, 1 month
JBossWS SVN: r8117 - framework/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 13:18:59 -0400 (Tue, 19 Aug 2008)
New Revision: 8117
Added:
framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089/
Log:
[JBPAPP-1089] Further patch branch.
Copied: framework/branches/jbossws-framework-2.0.1.GA_CP01_JBPAPP-1089 (from rev 8116, framework/tags/jbossws-framework-2.0.1.GA_CP01)
16 years, 1 month
JBossWS SVN: r8116 - in stack/native/trunk/modules: testsuite/native-tests/scripts and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 12:42:48 -0400 (Tue, 19 Aug 2008)
New Revision: 8116
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl in LogicalMessageImpl.getPayload.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 16:33:36 UTC (rev 8115)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2008-08-19 16:42:48 UTC (rev 8116)
@@ -47,6 +47,8 @@
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.spi.util.ServiceLoader;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* The LogicalMessageContext interface extends MessageContext to provide access to a the
@@ -76,7 +78,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
if (style == Style.RPC)
{
@@ -102,7 +104,7 @@
{
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild();
+ SOAPElement bodyElement = getBodyElement(soapBody);
try
{
if (style == Style.RPC)
@@ -136,9 +138,9 @@
HTTPMessageImpl httpMessage = (HTTPMessageImpl)message;
httpMessage.setXmlFragment(new XMLFragment(source));
}
-
+
MessageContextAssociation.peekMessageContext().setModified(true);
-
+
}
public Object getPayload(JAXBContext jaxbContext)
@@ -149,7 +151,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = getBodyElement(soapBody);
if (bodyElement != null)
{
payload = bodyElement.getObjectValue();
@@ -169,7 +171,7 @@
SOAPMessage soapMessage = (SOAPMessage)message;
SOAPBodyImpl soapBody = getSOAPBody(soapMessage);
- SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild();
+ SOAPContentElement bodyElement = getBodyElement(soapBody);
if (bodyElement != null)
{
bodyElement.setObjectValue(payload);
@@ -182,6 +184,23 @@
}
}
+ private SOAPContentElement getBodyElement(final SOAPBodyImpl soapBody)
+ {
+ SOAPContentElement bodyElement = null;
+
+ NodeList nodes = soapBody.getChildNodes();
+ for (int i = 0; i < nodes.getLength() && bodyElement == null; i++)
+ {
+ Node current = nodes.item(i);
+ if (current instanceof SOAPContentElement)
+ {
+ bodyElement = (SOAPContentElement)current;
+ }
+ }
+
+ return bodyElement;
+ }
+
private SOAPBodyImpl getSOAPBody(SOAPMessage soapMessage)
{
SOAPBodyImpl soapBody = null;
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 2008-08-19 16:33:36 UTC (rev 8115)
+++ stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2008-08-19 16:42:48 UTC (rev 8116)
@@ -362,6 +362,18 @@
<include name="wsdl/*"/>
</webinf>
</war>
+
+ <!-- jaxws-jbws2285 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2285.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws2285/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2285/*.class"/>
+ <exclude name="org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2285/WEB-INF">
+ <include name="jboss-web.xml"/>
+ <include name="server-handlers.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">
Added: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/Endpoint.java 2008-08-19 16:42:48 UTC (rev 8116)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285")
+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/jbws2285/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/jbws2285/EndpointImpl.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/EndpointImpl.java 2008-08-19 16:42:48 UTC (rev 8116)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws2285", endpointInterface = "org.jboss.test.ws.jaxws.jbws2285.Endpoint")
+@HandlerChain(file = "WEB-INF/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/jbws2285/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/jbws2285/JBWS2285TestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.java 2008-08-19 16:42:48 UTC (rev 8116)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.soap.NodeImpl;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * [JBWS-2285] ClassCastException: org.jboss.ws.core.soap.TextImpl
+ * in LogicalMessageImpl.getPayload.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ * @see https://jira.jboss.org/jira/browse/JBWS-2285
+ */
+public class JBWS2285TestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2285/";
+
+ private static Endpoint port;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBWS2285TestCase.class, "jaxws-jbws2285.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://ws.jboss.org/jbws2285", "EndpointImplService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(Endpoint.class);
+ }
+
+ public void testCall() throws Exception
+ {
+ final String message = "Hello!!";
+ String response = port.echo(message);
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ public void testSOAPConnection() throws Exception
+ {
+ SOAPMessage reqMsg = getRequestMessage();
+ URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage resMsg = con.call(reqMsg, epURL);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ String response = "";
+
+ SOAPBody body = resEnv.getBody();
+ Iterator it = body.getChildElements(new QName("http://ws.jboss.org/jbws2285", "echoResponse"));
+ Node node = (Node)it.next();
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if (current.getNodeName().equals("return"))
+ {
+ response = ((NodeImpl)current).getValue();
+ }
+ }
+
+ // The logical handler should have replaced the incoming String.
+ assertEquals("XXX", response);
+ }
+
+ private SOAPMessage getRequestMessage() throws SOAPException, IOException
+ {
+ URL reqMessage = getResourceFile("jaxws/jbws2285/request-message.xml").toURL();
+ MessageFactory msgFactory = MessageFactory.newInstance();
+
+ SOAPMessage reqMsg = msgFactory.createMessage(null, reqMessage.openStream());
+ return reqMsg;
+ }
+
+}
Property changes on: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.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/jbws2285/LogicalHandler.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2008-08-19 16:42:48 UTC (rev 8116)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.jbws2285;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.test.GenericLogicalHandler;
+
+/**
+ * Logical handler implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 19th August 2008
+ */
+public class LogicalHandler extends GenericLogicalHandler
+{
+
+ private static final Logger log = Logger.getLogger(LogicalHandler.class);
+
+ @Override
+ protected boolean handleInbound(final MessageContext msgContext)
+ {
+ log.info("handleInbound()");
+
+ LogicalMessageContext lmc = (LogicalMessageContext)msgContext;
+ LogicalMessage message = lmc.getMessage();
+
+ Object payload = message.getPayload();
+
+ if (payload instanceof DOMSource == false)
+ {
+ throw new WSException("Test requires DOMSource payload");
+ }
+
+ DOMSource domPayload = (DOMSource)payload;
+ Node node = domPayload.getNode();
+
+ NodeList nodes = node.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ Node current = nodes.item(i);
+ if ("arg0".equals(current.getLocalName()))
+ {
+ current.setTextContent("XXX");
+ }
+ }
+
+ log.info(DOMWriter.printNode(node, false));
+
+ return true;
+ }
+
+}
Property changes on: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/jboss-web.xml 2008-08-19 16:42:48 UTC (rev 8116)
@@ -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-jbws2285</context-root>
+</jboss-web>
\ No newline at end of file
Property changes on: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/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/jbws2285/WEB-INF/server-handlers.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/server-handlers.xml 2008-08-19 16:42:48 UTC (rev 8116)
@@ -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> LogicalServerHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2285.LogicalHandler </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/resources/jaxws/jbws2285/WEB-INF/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/jbws2285/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/WEB-INF/web.xml 2008-08-19 16:42:48 UTC (rev 8116)
@@ -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.jbws2285.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/jbws2285/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml 2008-08-19 16:42:48 UTC (rev 8116)
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://ws.jboss.org/jbws2285">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>SSS</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Property changes on: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2285/request-message.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 1 month
JBossWS SVN: r8115 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 12:33:36 -0400 (Tue, 19 Aug 2008)
New Revision: 8115
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089/
Log:
[JBPAPP-1089] Branch for patch.
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP01_JBPAPP-1089 (from rev 8114, stack/native/tags/jbossws-native-2.0.1.SP2_CP01)
16 years, 1 month
JBossWS SVN: r8114 - in framework/branches/jbossws-framework-2.0.1.GA_CP/src/test: resources/jaxws/samples/context/WEB-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 08:59:39 -0400 (Tue, 19 Aug 2008)
New Revision: 8114
Removed:
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/resources/jaxws/samples/context/WEB-INF/wsdl/
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
Log:
[JBPAPP-1085] Implement standard message context properties.
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2008-08-19 12:59:14 UTC (rev 8113)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2008-08-19 12:59:39 UTC (rev 8114)
@@ -23,6 +23,7 @@
// $Id$
+import java.io.IOException;
import java.security.Principal;
import javax.annotation.Resource;
@@ -32,10 +33,16 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.spi.annotation.WebContext;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
@WebService(name = "TestEndpoint", serviceName="TestEndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
@SOAPBinding(style = Style.RPC)
@@ -54,11 +61,47 @@
@WebMethod
public String testGetMessageContext()
{
- MessageContext jaxwsContext = (MessageContext)wsCtx.getMessageContext();
- return jaxwsContext != null ? "pass" : "fail";
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ return msgContext == null ? "fail" : "pass";
}
@WebMethod
+ public String testMessageContextProperties()
+ {
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ if (msgContext == null)
+ return "fail";
+
+ // Check standard jaxws properties
+ InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
+ QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
+ QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
+ QName operation = (QName)msgContext.get(MessageContext.WSDL_OPERATION);
+
+ if (!service.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService")))
+ throw new WebServiceException("Invalid qname: " + service);
+ if (!portType.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpoint")))
+ throw new WebServiceException("Invalid qname: " + portType);
+ if (!port.equals(new QName("http://org.jboss.ws/jaxws/context", "TestEndpointPort")))
+ throw new WebServiceException("Invalid qname: " + port);
+ if (!operation.equals(new QName("http://org.jboss.ws/jaxws/context", "testMessageContextProperties")))
+ throw new WebServiceException("Invalid qname: " + operation);
+
+ try
+ {
+ Element root = DOMUtils.parse(wsdlSource);
+ new DOMWriter(System.out).setPrettyprint(true).print(root);
+ }
+ catch (IOException ex)
+ {
+ throw new WebServiceException("Cannot parse MessageContext.WSDL_DESCRIPTION", ex);
+ }
+
+ return "pass";
+ }
+
+ @WebMethod
public String testGetUserPrincipal()
{
Principal principal = wsCtx.getUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2008-08-19 12:59:14 UTC (rev 8113)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2008-08-19 12:59:39 UTC (rev 8114)
@@ -23,6 +23,7 @@
// $Id: $
+import java.io.IOException;
import java.security.Principal;
import javax.annotation.Resource;
@@ -30,10 +31,17 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-@WebService(name = "TestEndpoint", serviceName = "TestEndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+@WebService(name = "Endpoint", serviceName = "EndpointService", targetNamespace = "http://org.jboss.ws/jaxws/context")
@SOAPBinding(style = Style.RPC)
public class EndpointJSE
{
@@ -43,11 +51,47 @@
@WebMethod
public String testGetMessageContext()
{
- MessageContext jaxwsContext = (MessageContext)wsCtx.getMessageContext();
- return jaxwsContext != null ? "pass" : "fail";
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ return msgContext == null ? "fail" : "pass";
}
@WebMethod
+ public String testMessageContextProperties()
+ {
+ MessageContext msgContext = (MessageContext)wsCtx.getMessageContext();
+ if (msgContext == null)
+ return "fail";
+
+ // Check standard jaxws properties
+ InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
+ QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
+ QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
+ QName operation = (QName)msgContext.get(MessageContext.WSDL_OPERATION);
+
+ if (!service.equals(new QName("http://org.jboss.ws/jaxws/context", "EndpointService")))
+ throw new WebServiceException("Invalid qname: " + service);
+ if (!portType.equals(new QName("http://org.jboss.ws/jaxws/context", "Endpoint")))
+ throw new WebServiceException("Invalid qname: " + portType);
+ if (!port.equals(new QName("http://org.jboss.ws/jaxws/context", "EndpointPort")))
+ throw new WebServiceException("Invalid qname: " + port);
+ if (!operation.equals(new QName("http://org.jboss.ws/jaxws/context", "testMessageContextProperties")))
+ throw new WebServiceException("Invalid qname: " + operation);
+
+ try
+ {
+ Element root = DOMUtils.parse(wsdlSource);
+ new DOMWriter(System.out).setPrettyprint(true).print(root);
+ }
+ catch (IOException ex)
+ {
+ throw new WebServiceException("Cannot parse MessageContext.WSDL_DESCRIPTION", ex);
+ }
+
+ return "pass";
+ }
+
+ @WebMethod
public String testGetUserPrincipal()
{
Principal principal = wsCtx.getUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java 2008-08-19 12:59:14 UTC (rev 8113)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/TestEndpoint.java 2008-08-19 12:59:39 UTC (rev 8114)
@@ -29,6 +29,10 @@
@WebResult(targetNamespace = "http://org.jboss.ws/jaxws/context", partName = "return")
public String testGetMessageContext();
+ @WebMethod
+ @WebResult(targetNamespace = "http://org.jboss.ws/jaxws/context", partName = "return")
+ public String testMessageContextProperties();
+
/**
*
* @return
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2008-08-19 12:59:14 UTC (rev 8113)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase.java 2008-08-19 12:59:39 UTC (rev 8114)
@@ -54,8 +54,9 @@
{
if (port == null)
{
- URL wsdlURL = new File("resources/jaxws/samples/context/WEB-INF/wsdl/TestEndpoint.wsdl").toURL();
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-context?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService");
+
Service service = Service.create(wsdlURL, qname);
port = (TestEndpoint)service.getPort(TestEndpoint.class);
@@ -71,6 +72,12 @@
assertEquals("pass", retStr);
}
+ public void testMessageContextProperties() throws Exception
+ {
+ String retStr = port.testMessageContextProperties();
+ assertEquals("pass", retStr);
+ }
+
public void testGetUserPrincipal() throws Exception
{
String retStr = port.testGetUserPrincipal();
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2008-08-19 12:59:14 UTC (rev 8113)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2008-08-19 12:59:39 UTC (rev 8114)
@@ -54,8 +54,9 @@
{
if (port == null)
{
- URL wsdlURL = new File("resources/jaxws/samples/context/WEB-INF/wsdl/TestEndpoint.wsdl").toURL();
- QName qname = new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-context?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/context", "EndpointService");
+
Service service = Service.create(wsdlURL, qname);
port = (TestEndpoint)service.getPort(TestEndpoint.class);
@@ -71,6 +72,12 @@
assertEquals("pass", retStr);
}
+ public void testMessageContextProperties() throws Exception
+ {
+ String retStr = port.testMessageContextProperties();
+ assertEquals("pass", retStr);
+ }
+
public void testGetUserPrincipal() throws Exception
{
String retStr = port.testGetUserPrincipal();
16 years, 1 month