You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wo...@apache.org on 2008/03/03 19:48:24 UTC

svn commit: r633234 [17/24] - in /webservices/axis2/trunk/java: ./ modules/jaxws-integration/ modules/jaxws-integration/test/ modules/jaxws-integration/test/client/ modules/jaxws-integration/test/org/ modules/jaxws-integration/test/org/apache/ modules/...

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WSGenTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WSGenTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WSGenTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WSGenTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample;
+
+import javax.xml.ws.BindingProvider;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.sample.wsgen.client.WSGenService;
+import org.apache.axis2.jaxws.sample.wsgen.client.WSGenInterface;
+import org.apache.axis2.jaxws.TestLogger;
+
+public class WSGenTests extends TestCase {
+    
+    String axisEndpoint = "http://localhost:6060/axis2/services/WSGenService.WSGenPort";
+    
+    public void testWSGen() {
+        try{
+            TestLogger.logger.debug("----------------------------------");
+            TestLogger.logger.debug("test: " + getName());
+            
+            WSGenService service = new WSGenService();
+            WSGenInterface proxy = service.getWSGenPort();
+            
+            BindingProvider p = (BindingProvider)proxy;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                    axisEndpoint);  
+            String outString = "this is a wonderful test";
+            String s = proxy.echoString(outString);
+
+            TestLogger.logger.debug("String s = " + s);
+            assertEquals(outString, s);
+            TestLogger.logger.debug("----------------------------------");
+        } catch(Exception e) {
+            e.printStackTrace();
+            fail("We should not get an exception, but we did");
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WrapTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WrapTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WrapTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/WrapTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * 
+ */
+package org.apache.axis2.jaxws.sample;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Holder;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.sample.wrap.sei.DocLitWrap;
+import org.apache.axis2.jaxws.sample.wrap.sei.DocLitWrapService;
+import org.apache.axis2.jaxws.TestLogger;
+import org.test.sample.wrap.Header;
+import org.test.sample.wrap.HeaderPart0;
+import org.test.sample.wrap.HeaderPart1;
+import org.test.sample.wrap.HeaderResponse;
+
+public class WrapTests extends TestCase {
+
+    String axisEndpoint = "http://localhost:6060/axis2/services/DocLitWrapService.DocLitWrapImplPort";
+	
+	/**
+	 * 
+	 */
+	public WrapTests() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @param arg0
+	 */
+	public WrapTests(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+	
+	public void testTwoWaySync(){
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+		try{
+			String reqString = "Test twoWay Sync";
+			DocLitWrapService service = new DocLitWrapService();
+			DocLitWrap proxy = service.getDocLitWrapPort();
+	        BindingProvider p = (BindingProvider) proxy;
+	        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+
+			String response = proxy.twoWay(reqString);
+            TestLogger.logger.debug("Sync Response =" + response);
+            TestLogger.logger.debug("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testOneWayVoidWithNoInputParams(){
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+		try{
+			
+			DocLitWrapService service = new DocLitWrapService();
+			DocLitWrap proxy = service.getDocLitWrapPort();
+	        BindingProvider p = (BindingProvider) proxy;
+	        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+			proxy.oneWayVoid();
+
+            TestLogger.logger.debug("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testTwoWayHolder(){
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+		try{
+			String holderString = new String("Test twoWay Sync");
+			Integer holderInteger = new Integer(0);
+			Holder<String> strHolder = new Holder<String>(holderString);
+			Holder<Integer> intHolder = new Holder<Integer>(holderInteger);
+			DocLitWrapService service = new DocLitWrapService();
+			DocLitWrap proxy = service.getDocLitWrapPort();
+	        BindingProvider p = (BindingProvider) proxy;
+	        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+			proxy.twoWayHolder(strHolder, intHolder);
+            TestLogger.logger.debug("Holder Response String =" + strHolder.value);;
+            TestLogger.logger.debug("Holder Response Integer =" + intHolder.value);
+            TestLogger.logger.debug("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testTwoWayWithHeadersAndHolders(){
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+		try{
+			Header header = new Header();
+			header.setOut(0);
+			HeaderPart0 hp0= new HeaderPart0();
+			hp0.setHeaderType("Client setup Header Type for HeaderPart0");
+			HeaderPart1 hp1 = new HeaderPart1();
+			hp1.setHeaderType("Client setup Header Type for HeaderPart0");
+			Holder<HeaderPart0> holder = new Holder<HeaderPart0>(hp0);
+			DocLitWrapService service = new DocLitWrapService();
+			DocLitWrap proxy = service.getDocLitWrapPort();
+	        BindingProvider p = (BindingProvider) proxy;
+	        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+			HeaderResponse hr = proxy.header(header, holder, hp1);
+			hp0=holder.value;
+            TestLogger.logger.debug("Holder Response String =" + hp0.getHeaderType());
+            TestLogger.logger.debug("Header Response Long =" + hr.getOut());
+            TestLogger.logger.debug("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+
+	public void testTwoWayHolderAsync(){
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+		try{
+			String holderString = new String("Test twoWay Sync");
+			Integer holderInteger = new Integer(0);
+			Holder<String> strHolder = new Holder<String>(holderString);
+			Holder<Integer> intHolder = new Holder<Integer>(holderInteger);
+			DocLitWrapService service = new DocLitWrapService();
+			DocLitWrap proxy = service.getDocLitWrapPort();
+	        BindingProvider p = (BindingProvider) proxy;
+	        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+			proxy.twoWayHolder(strHolder, intHolder);
+            TestLogger.logger.debug("Holder Response String =" + strHolder.value);;
+            TestLogger.logger.debug("Holder Response Integer =" + intHolder.value);
+            TestLogger.logger.debug("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+    
+    /**
+     * This is a test of a doc/lit method that passes the 
+     * request in a header.  This can only be reproduced via
+     * annotations and WSGEN.  WSImport will not allow this.
+     */
+    public void testEchoStringWSGEN1() {
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+        try{
+            String request = "hello world";
+            
+            DocLitWrapService service = new DocLitWrapService();
+            DocLitWrap proxy = service.getDocLitWrapPort();
+            BindingProvider p = (BindingProvider) proxy;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+            String response = proxy.echoStringWSGEN1(request);
+            assertTrue(response.equals(request));
+            TestLogger.logger.debug("------------------------------");
+        }catch(Exception e){
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    /**
+     * This is a test of a doc/lit method that passes the 
+     * response in a header.  This can only be reproduced via
+     * annotations and WSGEN.  WSImport will not allow this.
+     */
+    
+    public void testEchoStringWSGEN2() {
+        TestLogger.logger.debug("------------------------------");
+        TestLogger.logger.debug("Test : " + getName());
+        try{
+            String request = "hello world 2";
+            
+            DocLitWrapService service = new DocLitWrapService();
+            DocLitWrap proxy = service.getDocLitWrapPort();
+            BindingProvider p = (BindingProvider) proxy;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+            String response = proxy.echoStringWSGEN2(request);
+            assertTrue(response.equals(request));
+            TestLogger.logger.debug("------------------------------");
+        }catch(Exception e){
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersFault_Exception.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersFault_Exception.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersFault_Exception.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersFault_Exception.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbers;
+
+import javax.xml.ws.WebFault;
+
+import org.test.addnumbers.AddNumbersFault;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebFault(faultBean="", name = "AddNumbersFault", targetNamespace = "http://duke/org")
+public class AddNumbersFault_Exception
+    extends Exception
+{
+
+    /**
+     * Java type that goes as soapenv:Fault detail element.
+     * 
+     */
+    private AddNumbersFault faultInfo;
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     */
+    public AddNumbersFault_Exception(String message, AddNumbersFault faultInfo) {
+        super(message);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     * @param cause
+     */
+    public AddNumbersFault_Exception(String message, AddNumbersFault faultInfo, Throwable cause) {
+        super(message, cause);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @return
+     *     returns fault bean: duke.org.AddNumbersFault
+     */
+    public AddNumbersFault getFaultInfo() {
+        return faultInfo;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortType.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortType.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbers;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebService(name = "AddNumbersPortType", targetNamespace = "http://org/test/addnumbers")
+public interface AddNumbersPortType {
+
+
+    /**
+     * 
+     * @param arg1
+     * @param arg0
+     * @return
+     *     returns int
+     * @throws AddNumbersFault_Exception
+     */
+    @WebMethod
+    @WebResult(targetNamespace = "http://org/test/addnumbers")
+    @RequestWrapper(localName = "addNumbers", targetNamespace = "http://org/test/addnumbers", className = "org.test.addnumbers.AddNumbers")
+    @ResponseWrapper(localName = "addNumbersResponse", targetNamespace = "http://org/test/addnumbers", className = "org.test.addnumbers.AddNumbersResponse")
+    public int addNumbers(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbers")
+        int arg0,
+        @WebParam(name = "arg1", targetNamespace = "http://org/test/addnumbers")
+        int arg1)
+        throws AddNumbersFault_Exception
+    ;
+
+    /**
+     * 
+     * @param arg0
+     */
+    @WebMethod
+    @Oneway
+    @RequestWrapper(localName = "oneWayInt", targetNamespace = "http://org/test/addnumbers", className = "org.test.addnumbers.OneWayInt")
+    public void oneWayInt(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbers")
+        int arg0);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbers;
+
+import java.util.Map;
+
+import org.apache.axis2.jaxws.TestLogger;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+
+@WebService(serviceName="AddNumbersService",endpointInterface="org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType")
+public class AddNumbersPortTypeImpl implements AddNumbersPortType {
+
+    @Resource
+    private WebServiceContext ctx;
+    
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType#addNumbers(int, int)
+	 */
+	public int addNumbers(int arg0, int arg1) throws AddNumbersFault_Exception {
+        TestLogger.logger.debug(">> Received addNumbers request for " + arg0 + " and " + arg1);
+        
+        checkProperties();
+        
+        return arg0+arg1;
+	}
+	
+	private void checkProperties() {
+	    MessageContext mc = ctx.getMessageContext();
+	    Map headers = (Map)mc.get(MessageContext.HTTP_REQUEST_HEADERS);
+	    // the map should contain some headers
+	    if (headers == null || headers.isEmpty()) {
+	        throw new RuntimeException("HTTP request headers map is null or empty!");
+	    }
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType#oneWayInt(int)
+	 */
+	public void oneWayInt(int arg0) {
+        TestLogger.logger.debug(">> Received one-way request.");
+        return;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersService.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersService.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,79 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbers;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebServiceClient(name = "AddNumbersService", targetNamespace = "http://org/test/addnumbers", wsdlLocation = "AddNumbers1.wsdl")
+public class AddNumbersService
+    extends Service
+{
+
+    private final static URL ADDNUMBERSSERVICE_WSDL_LOCATION;
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/sample/addnumbers/META-INF/AddNumbers.wsdl";
+    static {
+        URL url = null;
+        try {
+        	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        	}
+        	File file = new File(wsdlLocation);
+        	url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        ADDNUMBERSSERVICE_WSDL_LOCATION = url;
+    }
+
+    public AddNumbersService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public AddNumbersService() {
+        super(ADDNUMBERSSERVICE_WSDL_LOCATION, new QName("http://org/test/addnumbers", "AddNumbersService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns AddNumbersPortType
+     */
+    @WebEndpoint(name = "AddNumbersPort")
+    public AddNumbersPortType getAddNumbersPort() {
+        return (AddNumbersPortType)super.getPort(new QName("http://org/test/addnumbers", "AddNumbersPort"), AddNumbersPortType.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientHandlers.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientHandlers.xml?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientHandlers.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientHandlers.xml Mon Mar  3 10:47:38 2008
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+
+	<jws:handler-chain name="LoggingHandlerChain">
+		<protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersClientLogicalHandler</jws:handler-class>
+		</jws:handler>
+	</jws:handler-chain>
+	
+</jws:handler-chains>
+

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringBufferInputStream;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils;
+import org.apache.axis2.jaxws.message.XMLFault;
+import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
+import org.apache.axis2.jaxws.utility.SAAJFactory;
+
+/*
+ * You can't actually specify whether a handler is for client or server,
+ * you just have to check in the handleMessage and/or handleFault to make
+ * sure what direction we're going.
+ */
+
+public class AddNumbersClientLogicalHandler 
+implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        return true;
+    }
+
+    public boolean handleMessage(LogicalMessageContext messagecontext) {
+        Boolean outbound = 
+            (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (!outbound) {  // inbound response on the client
+            
+            // make sure standard property is available
+            
+            Object bob = messagecontext.get(LogicalMessageContext.HTTP_RESPONSE_CODE);
+            if (bob == null) {
+                throw new NullPointerException("bob is null");
+            }
+            
+            // previously caused a NPE due to internal Properties.putAll(map);
+            // where 'map' had a key/value pair with null value.  So, internally
+            // we now use HashMap instead of Properties.
+            int size = messagecontext.size();
+            
+            /*
+             * These props were set on the outbound flow.  Inbound flow handlers
+             * should have access to them.
+             */
+            String propKey = "AddNumbersClientProtocolHandlerOutboundAppScopedProperty";
+            String myClientVal = (String)messagecontext.get(propKey);
+            if (myClientVal == null) {
+                throw new RuntimeException("Property " + propKey + " was null.  " +
+                                "MEPContext is not searching hard enough for the property.");
+            }
+            
+            // Check for the presences of the attachment property
+            propKey = MessageContext.INBOUND_MESSAGE_ATTACHMENTS;
+            Map map = (Map) messagecontext.get(propKey);
+            if (map == null) {
+                throw new RuntimeException("Property " + propKey + " was null");
+            }
+            if (!(map instanceof AttachmentsAdapter)) {
+                throw new RuntimeException("Expected AttachmentAddapter for Property " + 
+                                           propKey);
+            }
+            propKey = "AddNumbersClientProtocolHandlerOutboundHandlerScopedProperty";
+            myClientVal = (String)messagecontext.get(propKey);
+            if (myClientVal == null) {
+                throw new RuntimeException("Property " + propKey + " was null.  " +
+                                "MEPContext is not searching hard enough for the property.");
+            }
+            
+            /*
+             * These props were set on the inbound flow.  Inbound flow handlers
+             * should have access to them.
+             */
+            propKey = "AddNumbersClientProtocolHandlerInboundAppScopedProperty";
+            myClientVal = (String)messagecontext.get(propKey);
+            if (myClientVal == null) {
+                throw new RuntimeException("Property " + propKey + " was null.  " +
+                                "MEPContext is not searching hard enough for the property.");
+            }
+            propKey = "AddNumbersClientProtocolHandlerInboundHandlerScopedProperty";
+            myClientVal = (String)messagecontext.get(propKey);
+            if (myClientVal == null) {
+                throw new RuntimeException("Property " + propKey + " was null.  " +
+                                "MEPContext is not searching hard enough for the property.");
+            }
+            LogicalMessage msg = messagecontext.getMessage();
+            String st = getStringFromSourcePayload(msg.getPayload());
+            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
+            st = replaceFirstArg(st, txt);
+            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
+        }
+        else {
+            LogicalMessage msg = messagecontext.getMessage();
+            
+            Source s = msg.getPayload();
+            s = msg.getPayload();
+            
+            String st = getStringFromSourcePayload(msg.getPayload());
+            if (st.contains(">99</arg0>")) {
+                throw new ProtocolException("I don't like the value 99");
+            } else if (st.contains(">999</arg0>")) {
+                XMLFault xmlFault = MethodMarshallerUtils.createXMLFaultFromSystemException(new RuntimeException("I don't like the value 999"));
+                try {
+                    javax.xml.soap.MessageFactory mf = SAAJFactory.createMessageFactory(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
+                    SOAPMessage message = mf.createMessage();
+                    SOAPBody body = message.getSOAPBody();
+                    SOAPFault soapFault = XMLFaultUtils.createSAAJFault(xmlFault, body);
+                    throw new SOAPFaultException(soapFault);
+                } catch (SOAPException soape) {
+                    throw new RuntimeException("Got SOAPException.  That's bad.");
+                }
+            }
+            
+            // Check for the presences of the attachment property
+            String propKey = MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS;
+            Map map = (Map) messagecontext.get(propKey);
+            if (map == null) {
+                throw new RuntimeException("Property " + propKey + " was null");
+            }
+            if (!(map instanceof AttachmentsAdapter)) {
+                throw new RuntimeException("Expected AttachmentAddapter for Property " +
+                                           propKey);
+            }
+        }
+        return true;
+    }
+    
+    private static String getFirstArg(String payloadString) {
+        StringTokenizer st = new StringTokenizer(payloadString, ">");
+        st.nextToken();  // skip first token.
+        st.nextToken();  // skip second
+        String tempString = st.nextToken();
+        String returnString = new StringTokenizer(tempString, "<").nextToken();
+        return returnString;
+    }
+    
+    private static String replaceFirstArg(String payloadString, String newArg) {
+        String firstArg = getFirstArg(payloadString);
+        payloadString = payloadString.replaceFirst(firstArg, newArg);
+        return payloadString;
+    }
+    
+    private static String getStringFromSourcePayload(Source payload) {
+        try {
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer trans = factory.newTransformer();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(baos);
+
+            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.transform(payload, result);
+
+            return new String(baos.toByteArray());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler2.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler2.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler2.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringBufferInputStream;
+import java.util.StringTokenizer;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+/*
+ * You can't actually specify whether a handler is for client or server,
+ * you just have to check in the handleMessage and/or handleFault to make
+ * sure what direction we're going.
+ */
+
+public class AddNumbersClientLogicalHandler2 implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        return true;
+    }
+
+    public boolean handleMessage(LogicalMessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (outbound) {  // outbound request on the client
+            LogicalMessage msg = messagecontext.getMessage();
+            Source payload = msg.getPayload();
+            String st = getStringFromSourcePayload(payload);
+            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) * 2);
+            st = replaceFirstArg(st, txt);
+            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
+        }
+        return true;
+    }
+    
+    private static String getFirstArg(String payloadString) {
+        StringTokenizer st = new StringTokenizer(payloadString, ">");
+        st.nextToken();  // skip first token.
+        st.nextToken();  // skip second
+        String tempString = st.nextToken();
+        String returnString = new StringTokenizer(tempString, "<").nextToken();
+        return returnString;
+    }
+    
+    private static String replaceFirstArg(String payloadString, String newArg) {
+        String firstArg = getFirstArg(payloadString);
+        payloadString = payloadString.replaceFirst(firstArg, newArg);
+        return payloadString;
+    }
+    
+    private static String getStringFromSourcePayload(Source payload) {
+        try {
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer trans = factory.newTransformer();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(baos);
+
+            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.transform(payload, result);
+
+            return new String(baos.toByteArray());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.MessageContext;
+
+import java.io.ByteArrayOutputStream;
+
+/*
+ * You can't actually specify whether a handler is for client or server,
+ * you just have to check in the handleMessage and/or handleFault to make
+ * sure what direction we're going.
+ */
+
+public class AddNumbersClientLogicalHandler3  implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+        // TODO Auto-generated method stub        
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        // let's see if we can do this
+        LogicalMessage lm = messagecontext.getMessage();
+        String s = getStringFromSourcePayload(lm.getPayload());
+        return false;
+    }
+
+    public boolean handleMessage(LogicalMessageContext mc) {
+        return true;
+    }
+    
+    private static String getStringFromSourcePayload(Source payload) {
+        try {
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer trans = factory.newTransformer();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(baos);
+
+            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.transform(payload, result);
+
+            return new String(baos.toByteArray());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler4.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler4.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler4.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler4.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+/*
+ * You can't actually specify whether a handler is for client or server,
+ * you just have to check in the handleMessage and/or handleFault to make
+ * sure what direction we're going.
+ */
+
+public class AddNumbersClientLogicalHandler4  implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+        // TODO Auto-generated method stub        
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        return true;
+    }
+
+    public boolean handleMessage(LogicalMessageContext mc) {
+        return true;
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientProtocolHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientProtocolHandler.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientProtocolHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientProtocolHandler.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.util.Set;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/*
+ * You can't actually specify whether a handler is for client or server,
+ * you just have to check in the handleMessage and/or handleFault to make
+ * sure what direction we're going.
+ */
+
+public class AddNumbersClientProtocolHandler implements javax.xml.ws.handler.soap.SOAPHandler<SOAPMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+    }
+
+    public boolean handleFault(SOAPMessageContext messagecontext) {
+        return true;
+    }
+
+    public Set getHeaders() {
+        return null;
+    }
+
+    public boolean handleMessage(SOAPMessageContext messagecontext) {
+        Boolean outbound = (Boolean) messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (outbound) {
+
+            String appProp1 = "AddNumbersClientProtocolHandlerOutboundAppScopedProperty";
+            messagecontext.put(appProp1, "myVal");
+            messagecontext.setScope(appProp1, Scope.APPLICATION);
+            
+            String appProp2 = "AddNumbersClientProtocolHandlerOutboundHandlerScopedProperty";
+            messagecontext.put(appProp2, "client apps can't see this");
+        }
+        else {  // client inbound response
+            String appProp1 = "AddNumbersClientProtocolHandlerInboundAppScopedProperty";
+            messagecontext.put(appProp1, "myVal");
+            messagecontext.setScope(appProp1, Scope.APPLICATION);
+            
+            String appProp2 = "AddNumbersClientProtocolHandlerInboundHandlerScopedProperty";
+            messagecontext.put(appProp2, "client apps can't see this");
+        }
+        return true;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerFault_Exception.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,74 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import javax.xml.ws.WebFault;
+
+import org.test.addnumbershandler.AddNumbersHandlerFault;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebFault(faultBean="", name = "AddNumbersHandlerFault", targetNamespace = "http://duke/org")
+public class AddNumbersHandlerFault_Exception
+    extends Exception
+{
+
+    /**
+     * Java type that goes as soapenv:Fault detail element.
+     * 
+     */
+    private AddNumbersHandlerFault faultInfo;
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     */
+    public AddNumbersHandlerFault_Exception(String message, AddNumbersHandlerFault faultInfo) {
+        super(message);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @param faultInfo
+     * @param message
+     * @param cause
+     */
+    public AddNumbersHandlerFault_Exception(String message, AddNumbersHandlerFault faultInfo, Throwable cause) {
+        super(message, cause);
+        this.faultInfo = faultInfo;
+    }
+
+    /**
+     * 
+     * @return
+     *     returns fault bean: duke.org.AddNumbersHandlerFault
+     */
+    public AddNumbersHandlerFault getFaultInfo() {
+        return faultInfo;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortType.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,98 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.util.concurrent.Future;
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.test.addnumbershandler.AddNumbersHandlerResponse;
+
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebService(name = "AddNumbersHandlerPortType", targetNamespace = "http://org/test/addnumbershandler")
+//@HandlerChain(file="META-INF/AddNumbersClientHandlers.xml", name="")
+public interface AddNumbersHandlerPortType {
+
+
+    /**
+     * 
+     * @param arg1
+     * @param arg0
+     * @return
+     *     returns int
+     * @throws AddNumbersHandlerFault_Exception
+     */
+    @WebMethod
+    @WebResult(targetNamespace = "http://org/test/addnumbershandler")
+    @RequestWrapper(localName = "addNumbersHandler", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandler")
+    @ResponseWrapper(localName = "addNumbersHandlerResponse", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandlerResponse")
+    public int addNumbersHandler(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbershandler")
+        int arg0,
+        @WebParam(name = "arg1", targetNamespace = "http://org/test/addnumbershandler")
+        int arg1)
+        throws AddNumbersHandlerFault_Exception
+    ;
+
+    /**
+     * 
+     * @param asyncHandler
+     * @param arg0
+     * @return
+     *     returns java.util.concurrent.Future<? extends java.lang.Object>
+     */
+    @WebMethod
+    @RequestWrapper(localName = "addNumbersHandler", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandler")
+    @ResponseWrapper(localName = "addNumbersHandlerResponse", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.AddNumbersHandlerResponse")
+    public Future<?> addNumbersHandlerAsync(
+            @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbershandler")
+            int arg0,
+            @WebParam(name = "arg1", targetNamespace = "http://org/test/addnumbershandler")
+            int arg1,
+        @WebParam(name = "asyncHandler", targetNamespace = "")
+        AsyncHandler<AddNumbersHandlerResponse> asyncHandler);
+
+    
+    /**
+     * 
+     * @param arg0
+     */
+    @WebMethod
+    @Oneway
+    @RequestWrapper(localName = "oneWayInt", targetNamespace = "http://org/test/addnumbershandler", className = "org.test.addnumbershandler.OneWayInt")
+    public void oneWayInt(
+        @WebParam(name = "arg0", targetNamespace = "http://org/test/addnumbershandler")
+        int arg0);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerPortTypeImpl.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.util.concurrent.Future;
+import javax.jws.WebService;
+import javax.annotation.Resource;
+import javax.jws.HandlerChain;
+import javax.xml.ws.AsyncHandler;
+import org.test.addnumbershandler.AddNumbersHandlerResponse;
+import org.apache.axis2.jaxws.TestLogger;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+
+@WebService(serviceName="AddNumbersHandlerService",endpointInterface="org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType")
+@HandlerChain(file = "AddNumbersHandlers.xml", name = "")
+public class AddNumbersHandlerPortTypeImpl implements AddNumbersHandlerPortType {
+
+    private WebServiceContext ctx;
+    
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType#addNumbersHandler(int, int)
+	 */
+	public int addNumbersHandler(int arg0, int arg1) throws AddNumbersHandlerFault_Exception {
+        
+	    HandlerTracker tracker = HandlerTracker.getHandlerTracker(AddNumbersProtocolHandler.class);
+	    if (!tracker.isCalled(HandlerTracker.Methods.HANDLE_MESSAGE)) {
+	        throw new RuntimeException("handleMessage() was not called on the handler");
+	    }
+	    /* FIXME: getHeaders() is currently not called
+	    if (!tracker.isCalled(HandlerTracker.Methods.GET_HEADERS)) {
+	        throw new RuntimeException("getHeaders() was not called on the handler");
+	    }
+	    */
+	    
+        // for these properties tests to always pass, an inbound server-side handler must "put" them
+        MessageContext mc = ctx.getMessageContext();
+        String propKey1 = "AddNumbersLogicalHandlerInboundAppScopedProperty";
+        String propKey2 = "AddNumbersLogicalHandlerInboundHandlerScopedProperty";
+        String value = (String)mc.get(propKey1);
+        if (value == null)
+            throw new RuntimeException("Property value for key \"" + propKey1 + "\" was null, but is APPLICATION scoped and should be accessible by the endpoint");
+        if (mc.containsKey(propKey2))  // instead of "get", use "containsKey" to be a little more robust in testing
+            throw new RuntimeException("MessageContext.containsKey reported true for key \"" + propKey2 + "\" was not null.  This property is HANDLER scoped and should not be accessible by the endpoint");
+        TestLogger.logger
+                .debug(">> Received addNumbersHandler request for " + arg0 + " and " + arg1);
+        if (arg0 == 101)
+            throw new RuntimeException("Got value 101.  AddNumbersHandlerPortTypeImpl.addNumbersHandler method is correctly throwing this exception as part of testing");
+        return arg0+arg1;
+	}
+
+	public Future<?> addNumbersHandlerAsync(int arg0, int arg1, AsyncHandler<AddNumbersHandlerResponse> asyncHandler) {
+        return null;
+    }
+
+
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerPortType#oneWayInt(int)
+	 */
+	public void oneWayInt(int arg0) {
+        TestLogger.logger.debug(">> Received one-way request.");
+        return;
+	}
+    
+    @Resource
+    public void setCtx(WebServiceContext ctx) {
+        this.ctx = ctx;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlerService.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,79 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebServiceClient(name = "AddNumbersHandlerService", targetNamespace = "http://org/test/addnumbershandler", wsdlLocation = "AddNumbersHandler1.wsdl")
+public class AddNumbersHandlerService
+    extends Service
+{
+
+    private final static URL ADDNUMBERSSERVICE_WSDL_LOCATION;
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/sample/addnumbershandler/META-INF/AddNumbersHandler.wsdl";
+    static {
+        URL url = null;
+        try {
+        	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        	}
+        	File file = new File(wsdlLocation);
+        	url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        ADDNUMBERSSERVICE_WSDL_LOCATION = url;
+    }
+
+    public AddNumbersHandlerService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public AddNumbersHandlerService() {
+        super(ADDNUMBERSSERVICE_WSDL_LOCATION, new QName("http://org/test/addnumbershandler", "AddNumbersHandlerService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns AddNumbersHandlerPortType
+     */
+    @WebEndpoint(name = "AddNumbersHandlerPort")
+    public AddNumbersHandlerPortType getAddNumbersHandlerPort() {
+        return (AddNumbersHandlerPortType)super.getPort(new QName("http://org/test/addnumbershandler", "AddNumbersHandlerPort"), AddNumbersHandlerPortType.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlers.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlers.xml?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlers.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersHandlers.xml Mon Mar  3 10:47:38 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+
+	<jws:handler-chain name="LoggingHandlerChain">
+		<jws:protocol-bindings>##SOAP11_HTTP ##something blarg</jws:protocol-bindings>
+		<jws:port-name-pattern 
+              xmlns:ns1="http://addnumbershandler.sample.jaxws.axis2.apache.org/">ns1:AddNumbersHandlerP*</jws:port-name-pattern>
+        <jws:service-name-pattern 
+              xmlns:ns1="http://addnumbershandler.sample.jaxws.axis2.apache.org/">ns1:*</jws:service-name-pattern>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler2</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler2</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler</jws:handler-class>
+		</jws:handler>
+	</jws:handler-chain>
+	
+</jws:handler-chains>
+

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringBufferInputStream;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.annotation.PostConstruct;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+public class AddNumbersLogicalHandler 
+implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    private int deduction = 1;
+    
+    public void close(MessageContext messagecontext) {
+        
+    }
+    
+    @PostConstruct
+    public void postConstruct() {
+        deduction = 2;
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        return true;
+    }
+
+    /*
+     * this test handleMessage method is obviously not what a customer might write, but it does
+     * the trick for kicking the tires in the handler framework.  The AddNumbers service takes two
+     * ints as incoming params, adds them, and returns the sum.  This method subtracts 1 from the 
+     * first int on the inbound request, and subtracts "deduction" from the int on the outbound
+     * response.  So the client app should expect a sum 3 less than a sum with this handler 
+     * manipulating the SOAP message.
+     */
+    public boolean handleMessage(LogicalMessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (!outbound) {  // inbound request if we're on the server
+            LogicalMessage msg = messagecontext.getMessage();
+            String st = getStringFromSourcePayload(msg.getPayload());
+            if (st.contains("<arg0>99</arg0>")) {
+                throw new ProtocolException("I don't like the value 99");
+            }
+            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
+            st = replaceFirstArg(st, txt);
+            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
+            
+            messagecontext.put("AddNumbersLogicalHandlerInboundAppScopedProperty", "blargval");
+            messagecontext.setScope("AddNumbersLogicalHandlerInboundAppScopedProperty", 
+                                    Scope.APPLICATION);
+            messagecontext.put("AddNumbersLogicalHandlerInboundHandlerScopedProperty", 
+                               "blargval");
+            
+            // Check for the presences of the attachment property
+            String propKey = MessageContext.INBOUND_MESSAGE_ATTACHMENTS;
+            Map map = (Map) messagecontext.get(propKey);
+            if (map == null) {
+                throw new RuntimeException("Property " + propKey + " was null");
+            }
+            if (!(map instanceof AttachmentsAdapter)) {
+                throw new RuntimeException("Expected AttachmentAddapter for Property " + 
+                                           propKey);
+            }
+
+        } else { // outbound response if we're on the server
+            LogicalMessage msg = messagecontext.getMessage();
+            String st = getStringFromSourcePayload(msg.getPayload());
+            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - deduction);
+            st = replaceFirstArg(st, txt);
+            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
+            
+            // Check for the presences of the attachment property
+            String propKey = MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS;
+            Map map = (Map) messagecontext.get(propKey);
+            if (map == null) {
+                throw new RuntimeException("Property " + propKey + " was null");
+            }
+            if (!(map instanceof AttachmentsAdapter)) {
+                throw new RuntimeException("Expected AttachmentAddapter for Property " + 
+                                           propKey);
+            }
+        }
+        return true;
+    }
+    
+    private static String getFirstArg(String payloadString) {
+        StringTokenizer st = new StringTokenizer(payloadString, ">");
+        st.nextToken();  // skip first token.
+        st.nextToken();  // skip second
+        String tempString = st.nextToken();
+        String returnString = new StringTokenizer(tempString, "<").nextToken();
+        return returnString;
+    }
+    
+    private static String replaceFirstArg(String payloadString, String newArg) {
+        String firstArg = getFirstArg(payloadString);
+        payloadString = payloadString.replaceFirst(firstArg, newArg);
+        return payloadString;
+    }
+    
+    private static String getStringFromSourcePayload(Source payload) {
+        try {
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer trans = factory.newTransformer();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(baos);
+
+            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.transform(payload, result);
+
+            return new String(baos.toByteArray());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersLogicalHandler2.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.handler.LogicalMessageContext;
+
+public class AddNumbersLogicalHandler2 implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+        
+    }
+
+    public boolean handleFault(LogicalMessageContext messagecontext) {
+        Boolean outbound = (Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+        if (outbound) {  // outbound response if we're on the server
+            LogicalMessage msg = messagecontext.getMessage();
+            String st = getStringFromSourcePayload(msg.getPayload());
+            st = st.replaceFirst("blarg", "AddNumbersLogicalHandler2 was here");
+            st = st.replaceFirst("I don't like the value 99", "AddNumbersLogicalHandler2 was here");
+            msg.setPayload(new StreamSource(new ByteArrayInputStream(st.getBytes())));
+        }
+        return true;
+    }
+
+    public boolean handleMessage(LogicalMessageContext messagecontext) {
+    	return true;
+    }
+    
+    private static String getStringFromSourcePayload(Source payload) {
+        try {
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer trans = factory.newTransformer();
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(baos);
+
+            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            trans.transform(payload, result);
+
+            return new String(baos.toByteArray());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+public class AddNumbersProtocolHandler implements javax.xml.ws.handler.soap.SOAPHandler<SOAPMessageContext> {
+
+    HandlerTracker tracker = HandlerTracker.getHandlerTracker(AddNumbersProtocolHandler.class);
+    
+    public void close(MessageContext messagecontext) {
+        tracker.close(messagecontext);
+    }
+
+    public Set<QName> getHeaders() {
+        tracker.getHeaders();
+        return null;
+    }
+    
+    public boolean handleFault(SOAPMessageContext messagecontext) {
+        tracker.handleFault(messagecontext);
+        return true;
+    }
+
+    public boolean handleMessage(SOAPMessageContext messagecontext) {
+        // Ensure that the expected headers are present
+        JAXBContext context;
+        try {
+            context = JAXBContext.newInstance("org.test.addnumbershandler");
+        } catch (Exception e) {
+            throw new WebServiceException(e);
+        }
+        QName qName= new QName("http://org/test/addnumbershandler","myHeader");
+
+        try {
+            Object[] values = messagecontext.getHeaders(qName, context, true);
+
+            if (values.length > 0) {
+                if (values.length !=3 ||
+                        !((JAXBElement)values[0]).getValue().equals("Good1") ||
+                        !((JAXBElement)values[1]).getValue().equals("Good2") ||
+                        !((JAXBElement)values[2]).getValue().equals("Bad")) {
+                    throw new WebServiceException("Failed getting all of the headers:" + values);
+                }
+
+                values = messagecontext.getHeaders(qName, context, false);
+                if (values.length !=2 ||
+                        !((JAXBElement)values[0]).getValue().equals("Good1") ||
+                        !((JAXBElement)values[1]).getValue().equals("Good2")) {
+                    throw new WebServiceException("Failed getting the expected headers:" + values);
+                }
+            }
+        } catch(Exception e) {
+            e.printStackTrace();
+            throw new WebServiceException(e);
+        }
+
+
+        tracker.handleMessage(messagecontext);
+        return true;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler2.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler2.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersProtocolHandler2.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.sample.addnumbershandler;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+public class AddNumbersProtocolHandler2 implements javax.xml.ws.handler.soap.SOAPHandler<SOAPMessageContext> {
+
+    public void close(MessageContext messagecontext) {
+    }
+
+    public Set<QName> getHeaders() {
+        return null;
+    }
+    
+    public boolean handleFault(SOAPMessageContext messagecontext) {
+        return true;
+    }
+
+    public boolean handleMessage(SOAPMessageContext messagecontext) {
+        return true;
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org