Author: alessio.soldano(a)jboss.com
Date: 2008-07-04 11:06:09 -0400 (Fri, 04 Jul 2008)
New Revision: 7786
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/handler-chain.xml
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/EndpointBean.java
Log:
[JBWS-2136] Message ctx is required to be a SOAPMessageContext only in a SOAPHandler
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2008-07-04 14:24:02 UTC
(rev 7785)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2008-07-04 15:06:09 UTC
(rev 7786)
@@ -532,8 +532,10 @@
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/test-libs/jaxws-namespace.war"
webxml="${tests.output.dir}/test-resources/jaxws/namespace/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/namespace/CustomHandler.class"/>
<include
name="org/jboss/test/ws/jaxws/namespace/EndpointBean.class"/>
<include
name="org/jboss/test/ws/jaxws/namespace/EndpointInterface.class"/>
+ <include name="org/jboss/test/ws/jaxws/namespace/*.xml"/>
</classes>
<webinf
dir="${tests.output.dir}/test-resources/jaxws/namespace/WEB-INF">
<include name="jboss-web.xml"/>
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java 2008-07-04
15:06:09 UTC (rev 7786)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.namespace;
+
+import java.util.Set;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.DOMWriter;
+
+/**
+ * A simple SOAPHandler checking the exchanged message uses the SEI namespace.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 04-Jul-2008
+ */
+public class CustomHandler implements SOAPHandler
+{
+ private static final Logger log = Logger.getLogger(CustomHandler.class);
+
+ public Set getHeaders()
+ {
+ //don't care
+ return null;
+ }
+
+ public void close(MessageContext arg0)
+ {
+ //nothing to do
+ }
+
+ public boolean handleFault(MessageContext arg0)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean handleMessage(MessageContext context)
+ {
+ log.debug("handleMessage...");
+ try
+ {
+ SOAPMessageContext msgContext = (SOAPMessageContext)context;
+ SOAPBody body = msgContext.getMessage().getSOAPBody();
+ String bodyStr = DOMWriter.printNode(body, false);
+ if (
bodyStr.indexOf("http://example.org/sei") < 0)
+ throw new WebServiceException("Invalid body: " + bodyStr);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ return true;
+ }
+
+}
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/EndpointBean.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/EndpointBean.java 2008-07-04
14:24:02 UTC (rev 7785)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/EndpointBean.java 2008-07-04
15:06:09 UTC (rev 7786)
@@ -21,16 +21,10 @@
*/
package org.jboss.test.ws.jaxws.namespace;
-import javax.annotation.Resource;
+import javax.jws.HandlerChain;
import javax.jws.WebService;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPException;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMWriter;
/**
* Test namespace differences at service and portType levels
@@ -39,30 +33,15 @@
* @since 29-Apr-2005
*/
@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.namespace.EndpointInterface", targetNamespace =
"http://example.org/impl")
+(a)HandlerChain(file="handler-chain.xml")
public class EndpointBean implements EndpointInterface
{
private static final Logger log = Logger.getLogger(EndpointBean.class);
- @Resource
- WebServiceContext context;
-
public String echo(String message)
{
log.info("echo:" + message);
-
- try
- {
- SOAPMessageContext msgContext =
(SOAPMessageContext)context.getMessageContext();
- SOAPBody body = msgContext.getMessage().getSOAPBody();
- String bodyStr = DOMWriter.printNode(body, false);
- if (
bodyStr.indexOf("http://example.org/sei") < 0)
- throw new WebServiceException("Invalid body: " + bodyStr);
- }
- catch (SOAPException ex)
- {
- throw new WebServiceException(ex);
- }
-
+ //message check performed in the configured handler
return message;
}
}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/handler-chain.xml
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/handler-chain.xml
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/handler-chain.xml 2008-07-04
15:06:09 UTC (rev 7786)
@@ -0,0 +1,14 @@
+<?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"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+ <handler>
+ <handler-name>CustomHandler</handler-name>
+
<handler-class>org.jboss.test.ws.jaxws.namespace.CustomHandler</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
\ No newline at end of file
Property changes on:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/namespace/handler-chain.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF