axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r425727 [3/3] - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/ src/org/apache/axis2/jaxws/client/ src/org/apache/axis2/jaxws/client/proxy/ src/org/apache/axis2/jaxws/core/ src/org/apache/axis2/jaxws/core/control...
Date Wed, 26 Jul 2006 13:07:25 GMT
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/SAXSourceDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/SAXSourceDispatch.java?rev=425727&r1=425726&r2=425727&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/SAXSourceDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/SAXSourceDispatch.java Wed Jul 26 06:07:23 2006
@@ -1,225 +1,206 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed 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;
-
-import java.io.ByteArrayInputStream;
-import java.util.Map;
-import java.util.concurrent.Future;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.jaxws.CallbackHandler;
-import org.xml.sax.InputSource;
-
-public class SAXSourceDispatch extends TestCase{
-	private String urlHost = "localhost";
-    private String urlPort = "8080";
-    private String urlSuffix = "/axis2/services/EchoService";
-    private String endpointUrl = "http://" + urlHost + ":" + urlPort + urlSuffix;
-	private String soapMessage ="<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><ns1:echoString xmlns:ns1=\"http://test\"><ns1:input xmlns=\"http://test\">HELLO THERE!!!</ns1:input></ns1:echoString></soap:Body></soap:Envelope>";
-	private String xmlString = "<ns1:echoString xmlns:ns1=\"http://test\"><ns1:input xmlns=\"http://test\">HELLO THERE!!!</ns1:input></ns1:echoString>";
-	private QName serviceQname = new QName("http://ws.apache.org/axis2", "EchoService");
-	private QName portQname = new QName("http://ws.apache.org/axis2", "EchoServiceSOAP11port0");
-
-	public void testSync() {
-		try {
-			System.out.println("---------------------------------------");
-			Service svc = Service.create(serviceQname);
-			svc.addPort(portQname, null, endpointUrl);
-			Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-					null);
-			ByteArrayInputStream stream = new ByteArrayInputStream(xmlString
-					.getBytes());
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			InputSource input = new InputSource(stream);
-			Source srcStream = new SAXSource(input);
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					endpointUrl);
-			System.out.println(">> Invoking sync Dispatch");
-			SAXSource retVal = (SAXSource) dispatch.invoke(srcStream);
-			assertNotNull("dispatch invoke returned null",retVal);
-			byte b;
-			StringBuffer buffer = new StringBuffer();
-			while ((b = (byte) retVal.getInputSource().getByteStream().read()) != -1) {
-				char c = (char) b;
-				buffer.append(c);
-
-			}
-			System.out.println(">> Response [" + buffer + "]");
-		} catch (Exception e) {
-			e.printStackTrace();
-            fail("[ERROR] - Dispatch invocation failed.");
-		}
-	}
-
-	public void testSyncWithMessageMode(){
-		try {
-			System.out.println("---------------------------------------");
-			Service svc = Service.create(serviceQname);
-			svc.addPort(portQname, null, endpointUrl);
-			Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-					Mode.MESSAGE);
-			ByteArrayInputStream stream = new ByteArrayInputStream(soapMessage.getBytes());
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			InputSource input = new InputSource(stream);
-			Source srcStream = new SAXSource(input);
-			
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					endpointUrl);
-			System.out.println(">> Invoking sync Dispatch with Message Mode");
-			SAXSource retVal = (SAXSource) dispatch.invoke(srcStream);
-
-			byte b;
-			StringBuffer buffer = new StringBuffer();
-			while ((b = (byte) retVal.getInputSource().getByteStream().read()) != -1) {
-				char c = (char) b;
-				buffer.append(c);
-
-			}
-			System.out.println(">> Response [" + buffer + "]");
-		} catch (Exception e) {
-			e.printStackTrace();
-            fail("[ERROR] - Dispatch invocation failed.");
-		}
-	}
-
-	public void testAsyncCallbackWithMessageMode() {
-		
-			System.out.println("---------------------------------------");
-	        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
-	        Service svc = Service.create(serviceQname);
-			svc.addPort(portQname, null, endpointUrl);
-			Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-					Mode.MESSAGE);
-			ByteArrayInputStream stream = new ByteArrayInputStream(soapMessage
-					.getBytes());
-			InputSource input = new InputSource(stream);
-			Source srcStream = new SAXSource(input);
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-	                endpointUrl);
-			
-	        System.out.println(">> Invoking async (callback) Dispatch");
-	        Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
-	        try {
-	            while (!monitor.isDone()) {
-	                System.out.println(">> Async invocation still not complete");
-	                Thread.sleep(1000);
-	            }
-	            
-	            //monitor.get();
-	        
-	        } catch (InterruptedException e) {
-	            e.printStackTrace();
-                fail("[ERROR] - Dispatch invocation failed.");
-	        }
-	}
-	/*
-	public void testSyncWithWSDL() {
-		try {
-			System.out.println("---------------------------------------");
-			 URL wsdlUrl = new URL(endpointUrl + "?wsdl");
-			Service svc = Service.create(wsdlUrl,serviceQname);
-			svc.addPort(portQname, null, endpointUrl);
-			Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-					Mode.PAYLOAD);
-			ByteArrayInputStream stream = new ByteArrayInputStream(xmlString
-					.getBytes());
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			
-			String url = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-            assertNotNull("ERROR: the URL should not be null", url);
-            
-            InputSource input = new InputSource(stream);
-			Source srcStream = new SAXSource(input);
-			System.out.println(">> URL from WSDL [" + url + "]");
-			System.out.println(">> Invoking sync Dispatch with WSDL, Service and Port");
-			SAXSource retVal = (SAXSource) dispatch.invoke(srcStream);
-			byte b;
-			StringBuffer buffer = new StringBuffer();
-			while ((b = (byte) retVal.getInputSource().getByteStream().read()) != -1) {
-				char c = (char) b;
-				buffer.append(c);
-
-			}
-			System.out.println(">> Response [" + buffer + "]");
-		} catch (Exception e) {
-			e.printStackTrace();
-            fail("[ERROR] - Dispatch invocation failed.");
-		}
-		 
-	}
-	*/
-  
-	public void testAsyncCallback() {
-		System.out.println("---------------------------------------");
-        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
-        Service svc = Service.create(serviceQname);
-		svc.addPort(portQname, null, endpointUrl);
-		Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-				null);
-		ByteArrayInputStream stream = new ByteArrayInputStream(xmlString
-				.getBytes());
-		InputSource input = new InputSource(stream);
-		Source srcStream = new SAXSource(input);
-		Map<String, Object> requestContext = dispatch.getRequestContext();
-		requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-                endpointUrl);
-		
-        System.out.println(">> Invoking async (callback) Dispatch");
-        Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
-        try {
-            while (!monitor.isDone()) {
-                System.out.println(">> Async invocation still not complete");
-                Thread.sleep(1000);
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail("[ERROR] - Dispatch invocation failed.");
-        }
-	}
-
-	public void testOneWay() {
-		try {
-			System.out.println("---------------------------------------");
-			Service svc = Service.create(serviceQname);
-			svc.addPort(portQname, null, endpointUrl);
-			Dispatch<Source> dispatch = svc.createDispatch(portQname, Source.class,
-					null);
-			ByteArrayInputStream stream = new ByteArrayInputStream(xmlString
-					.getBytes());
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			InputSource input = new InputSource(stream);
-			Source srcStream = new SAXSource(input);
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					endpointUrl);
-			System.out.println(">> Invoking One Way Dispatch");
-			dispatch.invokeOneWay(srcStream);
-		} catch (Exception e) {
-			e.printStackTrace();
-            fail("[ERROR] - Dispatch invocation failed.");
-		}
-	}
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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;
+
+import java.io.ByteArrayInputStream;
+import java.util.concurrent.Future;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.message.util.Reader2Writer;
+import org.xml.sax.InputSource;
+
+/**
+ * This class tests the JAX-WS Dispatch<Source> with content in various 
+ * forms of a javax.xml.transform.sax.SAXSource.
+ */
+public class SAXSourceDispatch extends TestCase{
+
+    private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+    
+	public void testSyncPayloadMode() throws Exception {
+		System.out.println("---------------------------------------");
+		System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+		svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+		Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.PAYLOAD);
+        
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+		ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+		Source request = new SAXSource(input);
+		
+        System.out.println(">> Invoking sync Dispatch");
+		Source response = dispatch.invoke(request);
+        
+		assertNotNull("dispatch invoke returned null", response);
+        
+        // Prepare the response content for checking
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
+        Reader2Writer r2w = new Reader2Writer(reader);
+        String responseText = r2w.getAsString();
+        System.out.println(responseText);
+        
+        // Check to make sure the content is correct
+        assertTrue(!responseText.contains("soap"));
+        assertTrue(!responseText.contains("Envelope"));
+        assertTrue(!responseText.contains("Body"));
+        assertTrue(responseText.contains("echoStringResponse"));
+	}
+
+	public void testSyncMessageMode() throws Exception {
+		System.out.println("---------------------------------------");
+		System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.MESSAGE);
+		
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+        Source request = new SAXSource(input);
+		
+		System.out.println(">> Invoking sync Dispatch with Message Mode");
+		Source response = dispatch.invoke(request);
+
+        assertNotNull("dispatch invoke returned null", response);
+        
+        // Prepare the response content for checking
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
+        Reader2Writer r2w = new Reader2Writer(reader);
+        String responseText = r2w.getAsString();
+        System.out.println(responseText);
+        
+        // Check to make sure the content is correct
+        assertTrue(responseText.contains("soap"));
+        assertTrue(responseText.contains("Envelope"));
+        assertTrue(responseText.contains("Body"));
+        assertTrue(responseText.contains("echoStringResponse"));
+	}
+
+    public void testAsyncCallbackPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.PAYLOAD);
+        
+        // Setup the callback for async responses
+        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
+        
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+        Source request = new SAXSource(input);
+        
+        System.out.println(">> Invoking async (callback) Dispatch");
+        Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
+
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+    }
+    
+    public void testAsyncCallbackMessageMode() throws Exception {
+		System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.MESSAGE);
+		
+        // Setup the callback for async responses
+        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
+        
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+        Source request = new SAXSource(input);
+        
+        System.out.println(">> Invoking async (callback) Dispatch");
+        Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
+
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+	}
+    
+    public void testOneWayPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.PAYLOAD);
+        
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+        Source request = new SAXSource(input);
+        
+        System.out.println(">> Invoking One Way Dispatch");
+        dispatch.invokeOneWay(request);
+    }
+    
+    public void testOneWayMessageMode() throws Exception {
+		System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                Source.class, Service.Mode.MESSAGE);
+        
+        // Create a SAXSource out of the string content
+        byte[] bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        InputSource input = new InputSource(stream);
+        Source request = new SAXSource(input);
+        
+		System.out.println(">> Invoking One Way Dispatch");
+		dispatch.invokeOneWay(request);
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StreamSourceDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StreamSourceDispatch.java?rev=425727&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StreamSourceDispatch.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StreamSourceDispatch.java Wed Jul 26 06:07:23 2006
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.concurrent.Future;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.message.util.Reader2Writer;
+
+/**
+ * This class tests the JAX-WS Dispatch<Source> functionality with various
+ * forms of a StreamSource object. 
+ *
+ */
+public class StreamSourceDispatch extends TestCase {
+
+    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+    
+	/**
+     * Invoke a Dispatch<Source> synchronously with the content in PAYLOAD mode.
+	 */
+    public void testSyncPayloadMode() throws Exception {
+		System.out.println("---------------------------------------");
+		System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+		svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+		Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class, 
+                Service.Mode.PAYLOAD);
+		
+        // Create a StreamSource with the desired content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        Source srcStream = new StreamSource((InputStream) stream);
+        
+        // Invoke the Dispatch<Source>
+		System.out.println(">> Invoking sync Dispatch with PAYLOAD mode");
+		Source response = dispatch.invoke(srcStream);
+
+        // Prepare the response content for checking
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
+        Reader2Writer r2w = new Reader2Writer(reader);
+        String responseText = r2w.getAsString();
+        System.out.println(responseText);
+        
+        // Check to make sure the content is correct
+        assertTrue(!responseText.contains("soap"));
+        assertTrue(!responseText.contains("Envelope"));
+        assertTrue(!responseText.contains("Body"));
+        assertTrue(responseText.contains("echoStringResponse"));            
+	}
+
+    /**
+     * Invoke a Dispatch<Source> synchronously with the content in MESSAGE mode.
+     */
+    public void testSyncMessageMode() throws Exception {
+		System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+		Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+		svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+		Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
+				Mode.MESSAGE);
+		
+		// Create a StreamSource with the desired content
+        byte[] bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        Source srcStream = new StreamSource((InputStream) stream);
+        
+        System.out.println(">> Invoking sync Dispatch with MESSAGE Mode");
+		StreamSource response = (StreamSource) dispatch.invoke(srcStream);
+
+        // Prepare the response content for checking
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
+        Reader2Writer r2w = new Reader2Writer(reader);
+        String responseText = r2w.getAsString();
+        System.out.println(responseText);
+        
+        // Check to make sure the content is correct
+        assertTrue(responseText.contains("soap"));
+        assertTrue(responseText.contains("Envelope"));
+        assertTrue(responseText.contains("Body"));
+        assertTrue(responseText.contains("echoStringResponse"));            
+	}
+
+    /**
+     * Invoke a Dispatch<Source> asynchronously with the content in PAYLOAD mode.
+     */
+    public void testAsyncCallbackPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
+                Service.Mode.PAYLOAD);
+        
+        // We'll need a callback instance to handle the async responses
+        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
+        
+        // Create a StreamSource with the desired content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+        Source srcStream = new StreamSource((InputStream) stream);
+
+        System.out.println(">> Invoking async (callback) Dispatch with PAYLOAD mode");
+        Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
+
+        // Wait for the async response to be returned
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+    }
+    
+    /**
+     * Invoke a Dispatch<Source> asynchronously with the content in MESSAGE mode.
+     */
+	public void testAsyncCallbackMessageMode() throws Exception {
+		System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts 
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+		svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
+                Mode.MESSAGE);
+        
+        // We'll need a callback instance to handle the async responses
+        CallbackHandler<Source> callbackHandler = new CallbackHandler<Source>();
+
+        // Create a StreamSource with the desired content
+        byte[] bytes = DispatchTestConstants.sampleSoapMessage.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+		Source srcStream = new StreamSource((InputStream) stream);
+		
+        System.out.println(">> Invoking async (callback) Dispatch with MESSAGE mode");
+        Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
+
+        // Wait for the async response to be returned
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+    }
+
+    /**
+     * Invoke a Dispatch<Source> one-way operation
+     */
+	public void testOneWayPayloadMode() throws Exception {
+		System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+		Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+		svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+		Dispatch<Source> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
+				Service.Mode.PAYLOAD);
+        
+		// Create a StreamSource with the desired content
+        byte[] bytes = DispatchTestConstants.sampleBodyContent.getBytes();
+        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
+		Source srcStream = new StreamSource((InputStream) stream);
+		
+		System.out.println(">> Invoking One Way Dispatch");
+		dispatch.invokeOneWay(srcStream);
+	}
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StringDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StringDispatch.java?rev=425727&r1=425726&r2=425727&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StringDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/StringDispatch.java Wed Jul 26 06:07:23 2006
@@ -1,229 +1,165 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed 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;
-
-import java.util.Map;
-import java.util.concurrent.Future;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.Service.Mode;
-
-import org.apache.axis2.jaxws.CallbackHandler;
-
-import junit.framework.TestCase;
-
-public class StringDispatch extends TestCase {
-
-	private String urlHost = "localhost";
-    private String urlPort = "8080";
-    private String urlSuffix = "/axis2/services/EchoService";
-    private String endpointUrl = "http://" + urlHost + ":" + urlPort + urlSuffix;
-    private String soapMessage ="<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ><soap:Body><ns1:echoString xmlns:ns1=\"http://test\"><ns1:input xmlns=\"http://test\">HELLO THERE!!!</ns1:input></ns1:echoString></soap:Body></soap:Envelope>";
-    private String xmlString = "<ns1:echoString xmlns:ns1=\"http://test\"><ns1:input xmlns=\"http://test\">HELLO THERE!!!</ns1:input></ns1:echoString>";
-    private QName serviceQname = new QName("http://ws.apache.org/axis2", "EchoService");
-    private QName portQname = new QName("http://ws.apache.org/axis2", "EchoServiceSOAP11port0");
-    
-    /*
-     * Invoke a sync Dispatch with no WSDL configuration
-     */
-    public void testSync() {
-        System.out.println("---------------------------------------");
-        Service svc = Service.create(serviceQname);
-        svc.addPort(portQname,null,endpointUrl);
-        try{
-			Dispatch<String> dispatch = svc
-					.createDispatch(portQname, String.class, null);
-	        
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-			 		endpointUrl);
-			System.out.println(">> Invoking sync Dispatch");
-	        String retVal = dispatch.invoke(xmlString);
-	        System.out.println(">> Response [" + retVal + "]");
-        }catch(WebServiceException e){
-        	e.printStackTrace();
-          fail(e.toString());
-        }
-	}
-    
-    
-    
-    /*
-     * Invoke a sync Dispatch using the remote WSDL document to provide
-     * configuration
-     */
-    /*
-    public void testSyncWithWSDL() {
-        System.out.println("---------------------------------------");
-        try {
-            URL wsdlUrl = new URL(endpointUrl + "?wsdl");
-            // TODO (NLG): Also add a failing test if the service qname is null
-            Service svc = Service.create(wsdlUrl, serviceQname);
-            Dispatch<String> dispatch = svc.createDispatch(portQname, String.class, Service.Mode.PAYLOAD);
-            
-            Map<String, Object> requestContext = dispatch.getRequestContext();
-            String url = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-            assertNotNull("ERROR: the URL should not be null", url);
-            
-            assertTrue("ERROR: incorrect WSDL URL", url.endsWith(urlSuffix));
-            
-            System.out.println(">> URL from WSDL [" + url + "]");
-            System.out.println(">> Invoking sync Dispatch");
-            String retVal = dispatch.invoke(xmlString);
-            System.out.println(">> Response [" + retVal + "]");
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        }catch(WebServiceException e){
-        	e.printStackTrace();
-        }
-    }
-    */
-    /*
-     * Invoke a sync Dispatch with Message Mode configuration
-     */
-    public void testSyncWithMessageMode() {
-    	System.out.println("---------------------------------------");
-    	try{
-        Service svc = Service.create(serviceQname);
-        svc.addPort(portQname, null, endpointUrl);
-		Dispatch<String> dispatch = svc
-				.createDispatch(portQname, String.class, Mode.MESSAGE);
-		Map<String, Object> requestContext = dispatch.getRequestContext();
-		//requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-		// 		endpointUrl);
-		System.out.println(">> Invoking sync Dispatch with message mode");
-        String retVal = dispatch.invoke(soapMessage);
-        System.out.println(">> Response [" + retVal + "]");
-    	}catch(WebServiceException e){
-    		e.printStackTrace();
-    		fail(e.toString());
-    	}
-	}
-    
-    /*
-    //Not for Alpha Use
-	public void testAsyncPooling() {
-		Service svc = Service.create(null);
-		String xmlString = "<test:getBookPrice xmlns:test=\"http://BookPrice/\"><test:ISBN>10</test:ISBN></test:getBookPrice>";
-		Dispatch<String> dispatch = svc
-				.createDispatch(null, String.class, null);
-		Map<String, Object> requestContext = dispatch.getRequestContext();
-		requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-				"http://localhost:8080/axis2/services/BookPrice");
-		Response res = dispatch.invokeAsync(xmlString);
-		try {
-			while (!res.isDone()) {
-				Thread.sleep(10);
-			}
-			String retVal = (String) res.get();
-			System.out.println(retVal);
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail();
-		}
-	}
-    */
-
-	/*
-     * Invoke a Dispatch using the async callback API and use the 
-     * same thread to wait for the response.
-	 */
-    public void testAsyncCallback() {
-    
-        System.out.println("---------------------------------------");
-        try{
-	        CallbackHandler<String> callbackHandler = new CallbackHandler<String>();
-			    Service svc = Service.create(serviceQname);
-			    svc.addPort(portQname, null, endpointUrl);
-			    Dispatch<String> dispatch = svc
-					  .createDispatch(portQname, String.class, null);
-			    Map<String, Object> requestContext = dispatch.getRequestContext();
-			    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-			        endpointUrl);
-			
-	        System.out.println(">> Invoking async (callback) Dispatch");
-	        Future<?> monitor = dispatch.invokeAsync(xmlString, callbackHandler);
-	        
-	        while (!monitor.isDone()) {
-	             System.out.println(">> Async invocation still not complete");
-	             Thread.sleep(1000);
-	        }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            fail();
-        }catch(WebServiceException e){
-        	e.printStackTrace();
-        	fail(e.toString());
-        }
-	}
-    
-    /*
-     * Invoke a Async Dispatch with Message Mode configuration
-     */
-    public void testAsyncCallbackWithMessageMode() {
-    	 System.out.println("---------------------------------------");
-    	 try{
-	        CallbackHandler<String> callbackHandler = new CallbackHandler<String>();
-	 		Service svc = Service.create(serviceQname);
-	 		svc.addPort(portQname, null, endpointUrl);
-	 		Dispatch<String> dispatch = svc
-	 				.createDispatch(portQname, String.class, Mode.MESSAGE);
-	 		Map<String, Object> requestContext = dispatch.getRequestContext();
-	 		requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-	                 endpointUrl);
-	 		
-	        System.out.println(">> Invoking async (callback) Dispatch with Message Mode");
-	        Future<?> monitor = dispatch.invokeAsync(soapMessage, callbackHandler);
-	    
-            while (!monitor.isDone()) {
-                System.out.println(">> Async invocation still not complete");
-                Thread.sleep(1000);
-            }
-         } catch (InterruptedException e) {
-             e.printStackTrace();
-             fail();
-         }catch(WebServiceException e){
-        	 e.printStackTrace();
-        	 fail();
-         }
-	}
-	
-	/*
-     * Invoke a Dispatch one-way 
-	 */
-    public void testOneWay(){
-        System.out.println("---------------------------------------");
-        try{
-	        Service svc = Service.create(serviceQname);
-	        svc.addPort(portQname, null, endpointUrl);
-	        Dispatch<String> dispatch = svc
-					.createDispatch(portQname, String.class, null);
-			Map<String, Object> requestContext = dispatch.getRequestContext();
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					endpointUrl);
-			System.out.println(">> Invoking one-way Dispatch");
-	        dispatch.invokeOneWay(xmlString);
-        }catch(WebServiceException e){
-        	e.printStackTrace();
-        	fail();
-        }
-	}
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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;
+
+import java.util.concurrent.Future;
+
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import junit.framework.TestCase;
+
+public class StringDispatch extends TestCase {
+
+    /**
+     * Invoke a sync Dispatch<String> in PAYLOAD mode
+     */
+    public void testSyncPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.PAYLOAD);
+        
+        // Invoke the Dispatch
+        System.out.println(">> Invoking sync Dispatch");
+        String response = dispatch.invoke(DispatchTestConstants.sampleBodyContent);
+
+        assertNotNull("dispatch invoke returned null", response);
+        System.out.println(response);
+        
+        // Check to make sure the content is correct
+        assertTrue(!response.contains("soap"));
+        assertTrue(!response.contains("Envelope"));
+        assertTrue(!response.contains("Body"));
+        assertTrue(response.contains("echoStringResponse"));
+	}
+    
+    /**
+     * Invoke a sync Dispatch<String> in MESSAGE mode
+     */
+    public void testSyncWithMessageMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.MESSAGE);
+        
+        // Invoke the Dispatch
+        System.out.println(">> Invoking sync Dispatch");
+        String response = dispatch.invoke(DispatchTestConstants.sampleSoapMessage);
+
+        assertNotNull("dispatch invoke returned null", response);
+        System.out.println(response);
+        
+        // Check to make sure the content is correct
+        assertTrue(response.contains("soap"));
+        assertTrue(response.contains("Envelope"));
+        assertTrue(response.contains("Body"));
+        assertTrue(response.contains("echoStringResponse"));
+	}
+    
+	/**
+     * Invoke a Dispatch<String> using the async callback API in PAYLOAD mode
+	 */
+    public void testAsyncCallbackPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.PAYLOAD);
+
+        // Create the callback for async responses
+        CallbackHandler<String> callbackHandler = new CallbackHandler<String>();
+        
+        System.out.println(">> Invoking async (callback) Dispatch");
+        Future<?> monitor = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent, callbackHandler);
+	        
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+	}
+    
+    /**
+     * Invoke a Dispatch<String> using the async callback API in MESSAGE mode
+     */
+    public void testAsyncCallbackMessageMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.MESSAGE);
+
+        // Create the callback for async responses
+        CallbackHandler<String> callbackHandler = new CallbackHandler<String>();
+        
+        System.out.println(">> Invoking async (callback) Dispatch with Message Mode");
+        Future<?> monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callbackHandler);
+    
+        while (!monitor.isDone()) {
+            System.out.println(">> Async invocation still not complete");
+            Thread.sleep(1000);
+        }
+	}
+	
+    /**
+     * Invoke a Dispatch<String> one-way in PAYLOAD mode 
+     */
+    public void testOneWayPayloadMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.PAYLOAD);
+
+        System.out.println(">> Invoking one-way Dispatch");
+        dispatch.invokeOneWay(DispatchTestConstants.sampleBodyContent);
+    }
+    
+    /**
+     * Invoke a Dispatch<String> one-way in MESSAGE mode 
+	 */
+    public void testOneWayMessageMode() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // Initialize the JAX-WS client artifacts
+        Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
+        svc.addPort(DispatchTestConstants.QNAME_PORT, null, DispatchTestConstants.URL);
+        Dispatch<String> dispatch = svc.createDispatch(DispatchTestConstants.QNAME_PORT, 
+                String.class, Service.Mode.MESSAGE);
+
+        System.out.println(">> Invoking one-way Dispatch");
+        dispatch.invokeOneWay(DispatchTestConstants.sampleSoapMessage);
+	}
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java?rev=425727&r1=425726&r2=425727&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/SourceProviderTests.java Wed Jul 26 06:07:23 2006
@@ -57,10 +57,8 @@
         	StreamSource xmlStreamSource = new StreamSource(inputStream);
         	
         	Service svc = Service.create(serviceName);
-        	svc.addPort(portName,null, null);
+        	svc.addPort(portName,null, endpointUrl);
         	Dispatch<Source> dispatch = svc.createDispatch(portName, Source.class, null);
-        	Map<String, Object> requestContext = dispatch.getRequestContext();
-        	requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
         	System.out.println(">> Invoking Source Provider Dispatch");
         	Source response = dispatch.invoke(xmlStreamSource);
 

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java?rev=425727&r1=425726&r2=425727&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java Wed Jul 26 06:07:23 2006
@@ -1,57 +1,58 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed 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.provider;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-
-public class StringProviderTests extends ProviderTestCase {
-
-    String endpointUrl = "http://localhost:8080/axis2/services/StringProviderService";
-    String xmlString = "<invoke>test input</invoke>";
-    private QName serviceName = new QName("http://ws.apache.org/axis2", "StringProviderService");
-
-    protected void setUp() throws Exception {
-            super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-            super.tearDown();
-    }
-
-    public StringProviderTests(String name) {
-        super(name);
-    }
-    
-    public void testProviderString() {
-        System.out.println("---------------------------------------");
-        Service svc = Service.create(serviceName);
-        svc.addPort(portName,null, endpointUrl);
-        Dispatch<String> dispatch = svc
-                .createDispatch(portName, String.class, null);
-        Map<String, Object> requestContext = dispatch.getRequestContext();
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-                endpointUrl);
-        System.out.println(">> Invoking SimpleProvider");
-        String retVal = dispatch.invoke(xmlString);
-        System.out.println(">> Response [" + retVal + "]");
-    }
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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.provider;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+public class StringProviderTests extends ProviderTestCase {
+
+    String endpointUrl = "http://localhost:8080/axis2/services/StringProviderService";
+    String xmlString = "<invoke>test input</invoke>";
+    private QName serviceName = new QName("http://ws.apache.org/axis2", "StringProviderService");
+
+    protected void setUp() throws Exception {
+            super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+            super.tearDown();
+    }
+
+    public StringProviderTests(String name) {
+        super(name);
+    }
+    
+    public void testProviderString() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        Service svc = Service.create(serviceName);
+        svc.addPort(portName, null, endpointUrl);
+        
+        Dispatch<String> dispatch = svc
+                .createDispatch(portName, String.class, Service.Mode.PAYLOAD);
+        
+        System.out.println(">> Invoking Dispatch<String> StringProviderService");
+        String retVal = dispatch.invoke(xmlString);
+        System.out.println(">> Response [" + retVal + "]");
+    }
 }



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


Mime
View raw message