[jbossws-commits] JBossWS SVN: r16333 - in shared-testsuite/trunk/testsuite/src/test: java/org/jboss/test/ws/jaxws and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu May 31 10:55:42 EDT 2012


Author: alessio.soldano at jboss.com
Date: 2012-05-31 10:55:41 -0400 (Thu, 31 May 2012)
New Revision: 16333

Added:
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java
   shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java
   shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/
   shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/
   shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
Modified:
   shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3505] Adding testcase


Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml	2012-05-31 14:51:55 UTC (rev 16332)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml	2012-05-31 14:55:41 UTC (rev 16333)
@@ -112,6 +112,20 @@
 			</fileset>
 		</jar>
 
+        <!-- jaxws-clientConfig -->
+		<war warfile="${tests.output.dir}/test-libs/jaxws-clientConfig.war" needxmlfile="false">
+			<classes dir="${tests.output.dir}/test-classes">
+				<include name="org/jboss/test/ws/jaxws/clientConfig/Endpoint*.class" />
+			</classes>
+		</war>
+		
+        <!-- jaxws-clientConfig-client -->
+	    <jar destfile="${tests.output.dir}/test-libs/jaxws-clientConfig-client.jar">
+	      <metainf dir="${tests.output.dir}/test-resources/jaxws/clientConfig/META-INF">
+	        <include name="jaxws-client-config.xml" />
+	      </metainf>
+	    </jar>
+
 		<!-- jaxws-complex -->
 		<war warfile="${tests.output.dir}/test-libs/jaxws-complex.war" webxml="${tests.output.dir}/test-resources/jaxws/complex/WEB-INF/web.xml">
 			<classes dir="${tests.output.dir}/test-classes">

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+
+import junit.framework.Test;
+
+import org.jboss.ws.api.configuration.ClientConfigurer;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Verifies client configuration setup
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 31-May-2012
+ */
+public class ClientConfigurationTestCase extends JBossWSTest
+{
+   private static final String targetNS = "http://clientConfig.jaxws.ws.test.jboss.org/";
+
+   public static Test suite()
+   {
+      return new JBossWSTestSetup(ClientConfigurationTestCase.class, "jaxws-clientConfig.war,jaxws-clientConfig-client.jar");
+   }
+   
+   public void testClientConfigurer()
+   {
+      Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class).iterator();
+      assertTrue(it.hasNext());
+      ClientConfigurer configurer = it.next();
+      assertNotNull(configurer);
+      assertEquals("org.jboss.ws.common.configuration.ConfigHelper", configurer.getClass().getName());
+   }
+
+   public void testCustomClientConfiguration() throws Exception
+   {
+      QName serviceName = new QName(targetNS, "EndpointImplService");
+      URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl?wsdl");
+
+      Service service = Service.create(wsdlURL, serviceName);
+      Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+      
+      BindingProvider bp = (BindingProvider)port;
+      @SuppressWarnings("rawtypes")
+      List<Handler> hc = bp.getBinding().getHandlerChain();
+      hc.add(new UserHandler());
+      bp.getBinding().setHandlerChain(hc);
+      
+      ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
+      configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+
+      String resStr = port.echo("Kermit");
+      assertEquals("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn", resStr);
+   }
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class CustomHandler extends GenericSOAPHandler
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(CustomHandler.class);
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      log.info("handleInbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|CustomIn");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      log.info("handleOutbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|CustomOut");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+ at WebService(name="Endpoint")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+   public String echo(String input);
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+
+ at WebService(name="Endpoint")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public class EndpointImpl
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+   @WebMethod
+   public String echo(String input)
+   {
+      log.info("echo: " + input);
+      return input + "|endpoint";
+   }
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class LogHandler extends GenericSOAPHandler
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(LogHandler.class);
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      log.info("handleInbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|LogIn");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      log.info("handleOutbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+         
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|LogOut");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class RoutingHandler extends GenericSOAPHandler
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(RoutingHandler.class);
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      log.info("handleInbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|RoutIn");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      log.info("handleOutbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|RoutOut");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+}

Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class UserHandler extends GenericSOAPHandler
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(UserHandler.class);
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      log.info("handleInbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|UserIn");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      log.info("handleOutbound");
+
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+         SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+         String value = soapElement.getValue();
+         soapElement.setValue(value + "|UserOut");
+      }
+      catch (SOAPException e)
+      {
+         throw  new WebServiceException(e);
+      }
+
+      return true;
+   }
+}

Added: shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml	                        (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml	2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+  xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-config_4_0.xsd">
+  
+  <client-config>
+    <config-name>Custom Client Config</config-name>
+    <pre-handler-chains>
+      <javaee:handler-chain>
+        <javaee:handler>
+          <javaee:handler-name>Routing Handler</javaee:handler-name>
+          <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.RoutingHandler</javaee:handler-class>
+        </javaee:handler>
+        <javaee:handler>
+          <javaee:handler-name>Custom Handler</javaee:handler-name>
+          <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.CustomHandler</javaee:handler-class>
+        </javaee:handler>
+      </javaee:handler-chain>
+    </pre-handler-chains>
+    <post-handler-chains>
+      <javaee:handler-chain>
+        <javaee:handler>
+          <javaee:handler-name>Log Handler</javaee:handler-name>
+          <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.LogHandler</javaee:handler-class>
+        </javaee:handler>
+      </javaee:handler-chain>
+    </post-handler-chains>
+  </client-config>
+  
+</jaxws-config>
\ No newline at end of file



More information about the jbossws-commits mailing list