Author: thomas.diesler(a)jboss.com
Date: 2007-01-21 17:53:12 -0500 (Sun, 21 Jan 2007)
New Revision: 2019
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointService.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointWithHandlerChain.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.java
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/application-client.xml
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/jboss-client.xml
Modified:
trunk/jbossws-core/src/main/java/javax/jws/HandlerChain.java
trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/Endpoint.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/JSR181HandlerChainTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientOne.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
Log:
Add support for @HandlerChain on field, method\nMore to come
Modified: trunk/jbossws-core/src/main/java/javax/jws/HandlerChain.java
===================================================================
--- trunk/jbossws-core/src/main/java/javax/jws/HandlerChain.java 2007-01-21 18:51:37 UTC
(rev 2018)
+++ trunk/jbossws-core/src/main/java/javax/jws/HandlerChain.java 2007-01-21 22:53:12 UTC
(rev 2019)
@@ -34,13 +34,11 @@
* handler configuration needs to be shared across multiple Web Services, or where the
handler chain consists of
* handlers for multiple transports.
*
- * It is an error to combine this annotation with the @SOAPMessageHandlers annotation.
- *
* @author thomas.diesler(a)jboss.org
* @since 26-Apr-2005
*/
@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
+@Target(value = { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })
public @interface HandlerChain
{
Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-21 18:51:37 UTC (rev
2018)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-21 22:53:12 UTC (rev
2019)
@@ -216,7 +216,7 @@
</war>
<!-- jaxws-jsr181-handlerchain -->
- <copy
todir="${tests.output.dir}/classes/org/jboss/test/ws/jaxws/jsr181/handlerchain"
file="${tests.output.dir}/resources/jaxws/jsr181/handlerchain/jaxws-handlers.xml"/>
+ <copy
todir="${tests.output.dir}/classes/org/jboss/test/ws/jaxws/jsr181/handlerchain"
file="${tests.output.dir}/resources/jaxws/jsr181/handlerchain/jaxws-handlers.xml"/>
<war warfile="${tests.output.dir}/libs/jaxws-jsr181-handlerchain.war"
webxml="${tests.output.dir}/resources/jaxws/jsr181/handlerchain/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
<include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointImpl.class"/>
@@ -225,6 +225,21 @@
<include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/jaxws-handlers.xml"/>
</classes>
</war>
+ <jar
destfile="${tests.output.dir}/libs/jaxws-jsr181-handlerchain-client.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/Endpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/*Handler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jsr181/handlerchain/jaxws-handlers.xml"/>
+ </fileset>
+ <metainf
dir="${tests.output.dir}/resources/jaxws/jsr181/handlerchain/META-INF">
+ <include name="application-client.xml"/>
+ <include name="jboss-client.xml"/>
+ </metainf>
+ <manifest>
+ <attribute name="main-class"
value="org.jboss.test.ws.jaxws.jsr181.handlerchain.HandlerChainClient"/>
+ </manifest>
+ </jar>
<!-- jaxws-jsr181-oneway -->
<war warfile="${tests.output.dir}/libs/jaxws-jsr181-oneway.war"
webxml="${tests.output.dir}/resources/jaxws/jsr181/oneway/WEB-INF/web.xml">
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/Endpoint.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/Endpoint.java 2007-01-21
18:51:37 UTC (rev 2018)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/Endpoint.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -21,15 +21,12 @@
*/
package org.jboss.test.ws.jaxws.jsr181.handlerchain;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
-public interface Endpoint extends Remote
+public interface Endpoint
{
- public String echo(String input) throws RemoteException;
+ public String echo(String input);
}
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointService.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointService.java
(rev 0)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointService.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -0,0 +1,20 @@
+package org.jboss.test.ws.jaxws.jsr181.handlerchain;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+public class EndpointService extends Service
+{
+ public EndpointService(URL wsdlLocation, QName serviceName)
+ {
+ super(wsdlLocation, serviceName);
+ }
+
+ public Endpoint getEndpointPort()
+ {
+ return (Endpoint)super.getPort(Endpoint.class);
+ }
+
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointWithHandlerChain.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointWithHandlerChain.java
(rev 0)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointWithHandlerChain.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -0,0 +1,34 @@
+/*
+ * 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.jsr181.handlerchain;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+@HandlerChain(file = "jaxws-handlers.xml") // relative path from the class
file
+public interface EndpointWithHandlerChain
+{
+ public String echo(String input);
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/EndpointWithHandlerChain.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.java
(rev 0)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -0,0 +1,76 @@
+/*
+ * 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.jsr181.handlerchain;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.HandlerChain;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+
+import org.jboss.logging.Logger;
+
+public class HandlerChainClient
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerChainClient.class);
+
+ // Test on field
+ @WebServiceRef(name = "Service1")
+ @HandlerChain(file = "jaxws-handlers.xml")
+ static Service service1;
+
+ public static Map<String, String> testResult = new HashMap<String,
String>();
+
+ public static void main(String[] args) throws Exception
+ {
+ String testName = args[0];
+ String reqStr = args[1];
+
+ HandlerChainClient client = new HandlerChainClient();
+ Method method = HandlerChainClient.class.getMethod(testName, new Class[] {
String.class });
+ try
+ {
+ String retStr = (String)method.invoke(client, reqStr);
+ testResult.put(testName, retStr);
+ }
+ catch (InvocationTargetException ex)
+ {
+ log.error("Invocation error", ex);
+ testResult.put(testName, ex.getTargetException().toString());
+ }
+ catch (Exception ex)
+ {
+ log.error("Error", ex);
+ testResult.put(testName, ex.toString());
+ }
+ }
+
+ public String testService1(String reqStr) throws Exception
+ {
+ Endpoint port = service1.getPort(Endpoint.class);
+ return port.echo(reqStr);
+ }
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/HandlerChainClient.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/JSR181HandlerChainTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/JSR181HandlerChainTestCase.java 2007-01-21
18:51:37 UTC (rev 2018)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/jsr181/handlerchain/JSR181HandlerChainTestCase.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -32,6 +32,7 @@
import junit.framework.Test;
+import org.jboss.ejb3.client.ClientLauncher;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
@@ -47,10 +48,10 @@
public static Test suite()
{
- return JBossWSTestSetup.newTestSetup(JSR181HandlerChainTestCase.class,
"jaxws-jsr181-handlerchain.war");
+ return JBossWSTestSetup.newTestSetup(JSR181HandlerChainTestCase.class,
"jaxws-jsr181-handlerchain.war, jaxws-jsr181-handlerchain-client.jar");
}
- public void testHandlerChain() throws Exception
+ public void testDynamicHandlerChain() throws Exception
{
QName serviceName = new QName(targetNS, "EndpointImplService");
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jsr181-handlerchain/TestService?wsdl");
@@ -65,7 +66,26 @@
handlerChain.add(new RoutingHandler());
bindingProvider.getBinding().setHandlerChain(handlerChain);
- String retObj = port.echo("Kermit");
-
assertEquals("Kermit|LogOut|AuthOut|RoutOut|LogIn|AuthIn|RoutIn|endpoint|RoutOut|AuthOut|LogOut|RoutIn|AuthIn|LogIn",
retObj);
+ String resStr = port.echo("Kermit");
+
assertEquals("Kermit|LogOut|AuthOut|RoutOut|LogIn|AuthIn|RoutIn|endpoint|RoutOut|AuthOut|LogOut|RoutIn|AuthIn|LogIn",
resStr);
}
+
+ public void testHandlerChainOnServiceEndpointInterface() throws Exception
+ {
+ QName serviceName = new QName(targetNS, "EndpointImplService");
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jsr181-handlerchain/TestService?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ EndpointWithHandlerChain port =
(EndpointWithHandlerChain)service.getPort(EndpointWithHandlerChain.class);
+
+ String resStr = port.echo("Kermit");
+
assertEquals("Kermit|LogOut|AuthOut|RoutOut|LogIn|AuthIn|RoutIn|endpoint|RoutOut|AuthOut|LogOut|RoutIn|AuthIn|LogIn",
resStr);
+ }
+
+ public void testHandlerChainOnWebServiceRef() throws Throwable
+ {
+ new ClientLauncher().launch(HandlerChainClient.class.getName(),
"jbossws-client", new String[] { "testService1", "Kermit"
});
+ String resStr = HandlerChainClient.testResult.get("testService1");
+
assertEquals("Kermit|LogOut|AuthOut|RoutOut|LogIn|AuthIn|RoutIn|endpoint|RoutOut|AuthOut|LogOut|RoutIn|AuthIn|LogIn",
resStr);
+ }
}
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java 2007-01-21
18:51:37 UTC (rev 2018)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -33,15 +33,15 @@
private static Logger log = Logger.getLogger(SecureEndpointClient.class);
@WebServiceRef(name = "SecureService1")
- public static SecureEndpointService secureService1;
+ static SecureEndpointService secureService1;
@WebServiceRef(name = "SecureService2")
- public static Service secureService2;
+ static Service secureService2;
@WebServiceRef(name = "SecurePort1")
- public static SecureEndpoint securePort1;
+ static SecureEndpoint securePort1;
- public static String retStr;
+ static String retStr;
public static void main(String[] args)
{
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientOne.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientOne.java 2007-01-21
18:51:37 UTC (rev 2018)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientOne.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import javax.naming.InitialContext;
-import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
@@ -45,15 +44,15 @@
// Test on field with name
@WebServiceRef(name = "TestEndpointService3")
- public static TestEndpointService service3;
+ static TestEndpointService service3;
// Test on field without name
@WebServiceRef
- public static TestEndpointService service4;
+ static TestEndpointService service4;
// Test on method with name
@WebServiceRef(name = "TestEndpointService5")
- public static void setServiceSetter5(TestEndpointService service)
+ static void setServiceSetter5(TestEndpointService service)
{
TestEndpointClientOne.service5 = service;
}
@@ -61,7 +60,7 @@
// Test on method without name
@WebServiceRef
- public static void setServiceSetter6(TestEndpointService service)
+ static void setServiceSetter6(TestEndpointService service)
{
TestEndpointClientOne.service6 = service;
}
@@ -69,22 +68,22 @@
// Test on field with name and value
@WebServiceRef(name = "Port2", value = TestEndpointService.class)
- public static TestEndpoint port2;
+ static TestEndpoint port2;
// Test on field with value
@WebServiceRef(value = TestEndpointService.class)
- public static TestEndpoint port3;
+ static TestEndpoint port3;
// Test on field
@WebServiceRef
- public static TestEndpoint port4;
+ static TestEndpoint port4;
// Test on field with name
@WebServiceRef (name = "Port5")
- public static TestEndpoint port5;
+ static TestEndpoint port5;
- public static InitialContext iniCtx;
- public static String retStr;
+ static InitialContext iniCtx;
+ static String retStr;
public static void main(String[] args)
{
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2007-01-21
18:51:37 UTC (rev 2018)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2007-01-21
22:53:12 UTC (rev 2019)
@@ -46,22 +46,22 @@
// Test on field
@WebServiceRef(name = "Service3")
- public static Service service3;
+ static Service service3;
// Test on field
@WebServiceRef(name = "Service4")
- public static TestEndpointService service4;
+ static TestEndpointService service4;
// Test on field
@WebServiceRef(name = "Port2")
- public static TestEndpoint port2;
+ static TestEndpoint port2;
// Test on field
@WebServiceRef(name = "Port3")
- public static TestEndpoint port3;
+ static TestEndpoint port3;
- public static InitialContext iniCtx;
- public static Map<String, String> testResult = new HashMap<String,
String>();
+ static InitialContext iniCtx;
+ static Map<String, String> testResult = new HashMap<String, String>();
public static void main(String[] args) throws Exception
{
Added:
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/application-client.xml
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/application-client.xml
(rev 0)
+++
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/application-client.xml 2007-01-21
22:53:12 UTC (rev 2019)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-client version="5"
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
http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
+
+ <display-name>EndpointService</display-name>
+
+</application-client>
Property changes on:
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/application-client.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/jboss-client.xml
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/jboss-client.xml
(rev 0)
+++
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/jboss-client.xml 2007-01-21
22:53:12 UTC (rev 2019)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-client PUBLIC "-//JBoss//DTD Application Client 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
+
+<jboss-client>
+ <jndi-name>jbossws-client</jndi-name>
+
+ <service-ref>
+ <service-ref-name>Service1</service-ref-name>
+
<wsdl-override>http://@jbosstest.host.name@:8080/jaxws-jsr181-handlerchain/TestService?wsdl</wsdl-override>
+ </service-ref>
+
+</jboss-client>
\ No newline at end of file
Property changes on:
trunk/jbossws-tests/src/main/resources/jaxws/jsr181/handlerchain/META-INF/jboss-client.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF