Author: alessio.soldano(a)jboss.com
Date: 2007-10-30 21:35:11 -0400 (Tue, 30 Oct 2007)
New Revision: 4946
Added:
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler2.java
Modified:
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
Log:
[JBWS-1876] Test case
Added:
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler2.java
===================================================================
---
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler2.java
(rev 0)
+++
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler2.java 2007-10-31
01:35:11 UTC (rev 4946)
@@ -0,0 +1,92 @@
+/*
+ * 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.binding;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+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.core.jaxws.handler.GenericSOAPHandler;
+
+/**
+ * A client side handler
+ *
+ * @author Alessio Soldano, alessio.soldano(a)jboss.com
+ * @since 31-Oct-2007
+ */
+public class ClientHandler2 extends GenericSOAPHandler
+{
+ private static Logger log = Logger.getLogger(ClientHandler2.class);
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ System.out.println(mimeHeaders);
+ if (ct != null)
+ {
+ for (int i = 0; i < ct.length; i++)
+ {
+ if (ct[i].startsWith(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ soapMessage.saveChanges();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ System.out.println(mimeHeaders);
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ if (ct != null)
+ {
+ for (int i = 0; i < ct.length; i++)
+ {
+ if (ct[i].startsWith(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ return true;
+ }
+ }
+ return false;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on:
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/ClientHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
===================================================================
---
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2007-10-30
21:19:12 UTC (rev 4945)
+++
stack/native/branches/asoldano/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2007-10-31
01:35:11 UTC (rev 4946)
@@ -105,6 +105,7 @@
List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(provider.getBinding().getHandlerChain());
handlerChain.add(new ClientHandler());
+ handlerChain.add(new ClientHandler2());
provider.getBinding().setHandlerChain(handlerChain);
String nsURI = port.namespace();