[jbosstools-commits] JBoss Tools SVN: r22002 - in trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui: utils and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon May 10 18:06:32 EDT 2010


Author: bfitzpat
Date: 2010-05-10 18:06:32 -0400 (Mon, 10 May 2010)
New Revision: 22002

Added:
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXRSTester.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSTestStatus.java
Modified:
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/WSTestUtils.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/DelimitedStringList.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
Log:
OPEN - issue JBIDE-6253: Need a web service tester (JAX-WS and JAX-RS) in the tooling 
https://jira.jboss.org/jira/browse/JBIDE-6253

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-05-10 22:05:03 UTC (rev 22001)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-05-10 22:06:32 UTC (rev 22002)
@@ -69,8 +69,12 @@
 
 JAXRSWSTestView_Action_URL_Label=Action URL:
 JAXRSWSTestView_Configure_Monitor_Button=Configure Monitor
+JAXRSWSTestView_Exception_Status=Exception: 
 JAXRSWSTestView_HTTP_Method_Label=HTTP Method:
 JAXRSWSTestView_Invoke_Label=Invoke
+JAXRSWSTestView_Invoking_WS_Status=Invoking web service...
+JAXRSWSTestView_JAXRS_Success_Status=Successful JAX-RS Web Service Execution
+JAXRSWSTestView_JAXWS_Success_Status=Successful JAX-WS Web Service Execution
 JAXRSWSTestView_Open_Monitor_Button=Open Monitor
 JAXRSWSTestView_Request_Body_Label=Request Body
 JAXRSWSTestView_Request_Header_Label=Request Header

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-05-10 22:05:03 UTC (rev 22001)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -92,8 +92,12 @@
 	public static String JBossWS_DelimitedStringList_EditValue_Dialog_Message;
 	public static String JAXRSWSTestView_Action_URL_Label;
 	public static String JAXRSWSTestView_Configure_Monitor_Button;
+	public static String JAXRSWSTestView_Exception_Status;
 	public static String JAXRSWSTestView_HTTP_Method_Label;
 	public static String JAXRSWSTestView_Invoke_Label;
+	public static String JAXRSWSTestView_Invoking_WS_Status;
+	public static String JAXRSWSTestView_JAXRS_Success_Status;
+	public static String JAXRSWSTestView_JAXWS_Success_Status;
 	public static String JAXRSWSTestView_Open_Monitor_Button;
 	public static String JAXRSWSTestView_Request_Body_Label;
 	public static String JAXRSWSTestView_Request_Header_Label;

Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXRSTester.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXRSTester.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXRSTester.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -0,0 +1,227 @@
+/******************************************************************************* 
+ * Copyright (c) 2010 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.utils;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Tester class for JAX-RS services
+ * @author bfitzpat
+ *
+ */
+public class JAXRSTester {
+	
+	// Result message to pass back
+	private String resultBody;
+	
+	// HTTP headers going in and out
+	private Map<?, ?> requestHeaders = null;
+	private Map<?, ?> resultHeaders = null;
+	
+	// utility constant
+	private String EMPTY_STRING = ""; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 */
+	public JAXRSTester() {
+		// empty
+	}
+
+	/**
+	 * Return the result message 
+	 * @return String
+	 */
+	public String getResultBody() {
+		return this.resultBody;
+	}
+
+	/**
+	 * Return the result HTTP headers
+	 * @return Map
+	 */
+	public Map<?, ?> getResultHeaders() {
+		return resultHeaders;
+	}
+	
+	/**
+	 * Return the request HTTP headers
+	 * @return Map
+	 */
+	public Map<?, ?> getRequestHeaders() {
+		return requestHeaders;
+	}
+
+	/*
+	 * Start building the web query. Append parameters to URL
+	 */
+	private String buildWebQuery(Map<String, String> parameters) throws Exception {
+		if (!parameters.isEmpty()) {
+	        StringBuilder sb = new StringBuilder();
+	        for (Map.Entry<String, String> entry : parameters.entrySet()) {
+	            String key = URLEncoder.encode(entry.getKey(), "UTF-8"); //$NON-NLS-1$
+	            String value = URLEncoder.encode(entry.getValue(), "UTF-8"); //$NON-NLS-1$
+	            sb.append(key).append("=").append(value).append("&"); //$NON-NLS-1$ //$NON-NLS-2$
+	        }
+	        return sb.toString().substring(0, sb.length() - 1);
+		}
+		return EMPTY_STRING;
+    }
+
+    /**
+     * Simplest call for JAX-RS
+     * @param address
+     * @param parameters
+     * @param headers
+     * @throws Exception
+     */
+    public void doTest (String address, Map<String, String> parameters, Map<String, String> headers) throws Exception {
+        doTest(address, parameters, headers, "GET", null, null, 0); //$NON-NLS-1$
+    }
+
+    /**
+     * Call a JAX-RS service
+     * @param address
+     * @param parameters
+     * @param headers
+     * @param methodType
+     * @param requestBody
+     * @throws Exception
+     */
+    public void doTest (String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody) throws Exception {
+    	doTest (address, parameters, headers, methodType, requestBody, null, 0);
+    }
+
+    /**
+     * Call a JAX-RS service
+     * @param address
+     * @param parameters
+     * @param headers
+     * @param methodType
+     * @param requestBody
+     * @param proxy
+     * @param port
+     * @throws Exception
+     */
+    public void doTest(String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody, String proxy, String port) throws Exception {
+        doTest(address, parameters, headers, methodType, requestBody, proxy, Integer.parseInt(port));
+    }
+
+    /**
+     * Call a JAX-RS service
+     * @param address
+     * @param parameters
+     * @param headers
+     * @param methodType
+     * @param requestBody
+     * @param proxy
+     * @param port
+     * @throws Exception
+     */
+    public void doTest(String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody, String proxy, int port) throws Exception {
+
+    	// handle the proxy
+        Proxy proxyObject = null;
+        if (proxy != null && proxy.length() > 0 && port > 0) {
+            InetSocketAddress proxyAddress = new InetSocketAddress(proxy, port);
+            proxyObject = new Proxy(Proxy.Type.HTTP, proxyAddress);
+        }
+
+        // clear the returned results
+        resultBody = EMPTY_STRING;
+        
+        // get the parms string
+        String query = buildWebQuery(parameters);
+
+        // build the complete URL
+        URL url = null;
+        if (query != null) {
+        	// add the ? if there are parameters
+            if (!address.endsWith("?") && methodType.equalsIgnoreCase("GET") ) {  //$NON-NLS-1$//$NON-NLS-2$
+            	address = address + "?"; //$NON-NLS-1$
+            }
+        	// add parms to the url if we have some
+        	url = new URL(address + query);
+        } else {
+        	url = new URL(address);
+        }
+
+        // make connection
+        HttpURLConnection httpurlc = null;
+        if (proxyObject == null) {
+            httpurlc = (HttpURLConnection) url.openConnection();
+        } else {
+        	// if have proxy, pass it along
+            httpurlc = (HttpURLConnection) url.openConnection(proxyObject);
+        }
+        
+        // since we are expecting output back, set to true
+       	httpurlc.setDoOutput(true);
+        
+        // not sure what this does - may be used for authentication?
+        httpurlc.setAllowUserInteraction(false);
+        
+        // set whether this is a GET or POST
+        httpurlc.setRequestMethod(methodType);
+        
+        // if we have headers to add
+        if (headers != null && !headers.isEmpty()) {
+        	Iterator<?> iter = headers.entrySet().iterator();
+        	while (iter.hasNext()) {
+        		Entry<?, ?> entry = (Entry<?, ?>)iter.next();
+        		if (entry.getKey() != null && entry.getKey() instanceof String)
+        			httpurlc.addRequestProperty((String) entry.getKey(), (String) entry.getValue());
+        	}
+        }
+        
+        requestHeaders = httpurlc.getRequestProperties();
+        
+        // CONNECT!
+        httpurlc.connect();
+
+        // If we are doing a POST and we have some request body to pass along, do it
+        if (requestBody != null && ( methodType.equalsIgnoreCase("POST")  //$NON-NLS-1$
+        		|| methodType.equalsIgnoreCase("PUT"))) { //$NON-NLS-1$
+        	requestBody = WSTestUtils.stripNLsFromXML(requestBody);
+        	OutputStreamWriter out = new OutputStreamWriter(httpurlc.getOutputStream());
+        	out.write(requestBody);
+        	out.close();
+        }
+
+        // retrieve result and put string results into the response
+        InputStream is = (InputStream) httpurlc.getInputStream();
+        BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));//$NON-NLS-1$
+        StringBuilder sb = new StringBuilder();
+        String line;
+        while ((line = br.readLine()) != null) {
+            sb.append(line);
+            sb.append("\n");//$NON-NLS-1$
+        }
+        br.close();
+        resultBody = sb.toString();
+        
+        resultHeaders = httpurlc.getHeaderFields();
+        
+        // disconnect explicitly (may not be necessary)
+        httpurlc.disconnect();
+    }	
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXRSTester.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -0,0 +1,114 @@
+/******************************************************************************* 
+ * Copyright (c) 2010 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.utils;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+import org.apache.axis.message.SOAPEnvelope;
+
+/**
+ * Tester class for JAX-WS services
+ * @author bfitzpat
+ *
+ */
+public class JAXWSTester {
+	
+	// the response message to pass back
+	private String resultBody;
+	
+	// the result HTTP headers to pass back
+	private HashMap<String, String> resultHeaders;
+	
+	// utility constant
+	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+	
+	/**
+	 * Constructor 
+	 */
+	public JAXWSTester() {
+		// empty
+	}
+	
+	/**
+	 * Return the response message
+	 * @return 
+	 */
+	public String getResultBody() {
+		return this.resultBody;
+	}
+	
+	/**
+	 * Return a map of HTTP headers from the response
+	 * @return
+	 */
+	public Map<String, String> getResultHeaders() {
+		return this.resultHeaders;
+	}
+	
+	/**
+	 * Invoke the JAX-WS service
+	 * @param endpointurl
+	 * @param actionurl
+	 * @param body
+	 * @throws Exception
+	 */
+	public void doTest( String endpointurl, String actionurl, String body ) throws Exception {
+		/* 
+		 * the endpoint & action urls + the soap in are what we
+		 * need to invoke the WS
+		 */
+		String endpoint = endpointurl;
+		String action = actionurl;
+		String soapIn = body;	
+
+    	/* Use AXIS to call the WS */
+		String document = WSTestUtils.stripNLsFromXML(soapIn);
+		Service service = new Service();
+		Call call= (Call) service.createCall();
+		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
+		call.setOperationStyle( org.apache.axis.constants.Style.MESSAGE );
+		if ( action != null ) {
+		    call.setProperty(Call.SOAPACTION_USE_PROPERTY,Boolean.TRUE);
+		    call.setProperty(Call.SOAPACTION_URI_PROPERTY,action);
+		}
+		Message message = new Message(document);
+		SOAPEnvelope envelope = call.invoke( message );
+		
+		// Get back the response message
+		this.resultBody = EMPTY_STRING;
+		if (envelope != null && envelope.getBody() != null) {		
+			this.resultBody = envelope.getBody().toString();
+		}
+		
+		// Get back the response HTTP headers and pass back as a Map
+		if (call != null && call.getMessageContext() != null) {
+			MessageContext mc = call.getMessageContext();
+			if (mc.getMessage() != null && mc.getMessage().getMimeHeaders() != null) {
+				MimeHeaders mh = mc.getMessage().getMimeHeaders();
+				Iterator<?> iter = mh.getAllHeaders();
+				resultHeaders = new HashMap<String, String>();
+				while (iter.hasNext()) {
+					MimeHeader next = (MimeHeader)iter.next();
+					resultHeaders.put(next.getName(), next.getValue());
+				}
+			}
+		}
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/WSTestUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/WSTestUtils.java	2010-05-10 22:05:03 UTC (rev 22001)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/WSTestUtils.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -10,24 +10,6 @@
  ******************************************************************************/
 package org.jboss.tools.ws.ui.utils;
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.axis.Message;
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
-import org.apache.axis.message.SOAPEnvelope;
-
 /**
  * Static utility methods for testing JAX-RS and JAX-WS web services
  * @author bfitzpat
@@ -35,171 +17,6 @@
  */
 public class WSTestUtils {
 	
-	private static Map<?, ?> requestHeaders = null;
-	private static Map<?, ?> resultHeaders = null;
-	private static String EMPTY_STRING = ""; //$NON-NLS-1$
-
-	public static Map<?, ?> getResultHeaders() {
-		return WSTestUtils.resultHeaders;
-	}
-	
-	public static Map<?, ?> getRequestHeaders() {
-		return WSTestUtils.requestHeaders;
-	}
-	
-	/*
-	 * Start building the web query. Append parameters to URL
-	 */
-	private static String buildWebQuery(Map<String, String> parameters) throws Exception {
-		if (!parameters.isEmpty()) {
-	        StringBuilder sb = new StringBuilder();
-	        for (Map.Entry<String, String> entry : parameters.entrySet()) {
-	            String key = URLEncoder.encode(entry.getKey(), "UTF-8"); //$NON-NLS-1$
-	            String value = URLEncoder.encode(entry.getValue(), "UTF-8"); //$NON-NLS-1$
-	            sb.append(key).append("=").append(value).append("&"); //$NON-NLS-1$ //$NON-NLS-2$
-	        }
-	        return sb.toString().substring(0, sb.length() - 1);
-		}
-		return EMPTY_STRING;
-    }
-
-	// static simple call, pass in url, parms, and headers
-    public static String callRestfulWebService(String address, Map<String, String> parameters, Map<String, String> headers) throws Exception {
-        return callRestfulWebService(address, parameters, headers, "GET", null, null, 0); //$NON-NLS-1$
-    }
-
-    // static call - provide url, parms, headers, the method type, and request body
-    public static String callRestfulWebService(String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody) throws Exception {
-        return callRestfulWebService(address, parameters, headers, methodType, requestBody, null, 0);
-    }
-
-    // static call - provide url, parms, headers, the method type, request body, proxy string, and port # as string
-    public static String callRestfulWebService(String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody, String proxy, String port) throws Exception {
-        return callRestfulWebService(address, parameters, headers, methodType, requestBody, proxy, Integer.parseInt(port));
-    }
-
-    // static call - provide url, parms, headers, the method type, request body, proxy string, port #
-    public static String callRestfulWebService(String address, Map<String, String> parameters, Map<String, String> headers, String methodType, String requestBody, String proxy, int port) throws Exception {
-
-    	// handle the proxy
-        Proxy proxyObject = null;
-        if (proxy != null && proxy.length() > 0 && port > 0) {
-            InetSocketAddress proxyAddress = new InetSocketAddress(proxy, port);
-            proxyObject = new Proxy(Proxy.Type.HTTP, proxyAddress);
-        }
-
-        // clear the returned results
-        String response = EMPTY_STRING;
-        
-        // get the parms string
-        String query = buildWebQuery(parameters);
-
-        // build the complete URL
-        URL url = null;
-        if (query != null) {
-        	// add the ? if there are parameters
-            if (!address.endsWith("?") && methodType.equalsIgnoreCase("GET") ) {  //$NON-NLS-1$//$NON-NLS-2$
-            	address = address + "?"; //$NON-NLS-1$
-            }
-        	// add parms to the url if we have some
-        	url = new URL(address + query);
-        } else {
-        	url = new URL(address);
-        }
-
-        // make connection
-        HttpURLConnection httpurlc = null;
-        if (proxyObject == null) {
-            httpurlc = (HttpURLConnection) url.openConnection();
-        } else {
-        	// if have proxy, pass it along
-            httpurlc = (HttpURLConnection) url.openConnection(proxyObject);
-        }
-        
-        // since we are expecting output back, set to true
-       	httpurlc.setDoOutput(true);
-        
-        // not sure what this does - may be used for authentication?
-        httpurlc.setAllowUserInteraction(false);
-        
-        // set whether this is a GET or POST
-        httpurlc.setRequestMethod(methodType);
-        
-        // if we have headers to add
-        if (headers != null && !headers.isEmpty()) {
-        	Iterator<?> iter = headers.entrySet().iterator();
-        	while (iter.hasNext()) {
-        		Entry<?, ?> entry = (Entry<?, ?>)iter.next();
-        		if (entry.getKey() != null && entry.getKey() instanceof String)
-        			httpurlc.addRequestProperty((String) entry.getKey(), (String) entry.getValue());
-        	}
-        }
-        
-        requestHeaders = httpurlc.getRequestProperties();
-        
-        // CONNECT!
-        httpurlc.connect();
-
-        // If we are doing a POST and we have some request body to pass along, do it
-        if (requestBody != null && ( methodType.equalsIgnoreCase("POST")  //$NON-NLS-1$
-        		|| methodType.equalsIgnoreCase("PUT"))) { //$NON-NLS-1$
-        	requestBody = stripNLsFromXML(requestBody);
-        	OutputStreamWriter out = new OutputStreamWriter(httpurlc.getOutputStream());
-        	out.write(requestBody);
-        	out.close();
-        }
-
-        // retrieve result and put string results into the response
-        InputStream is = (InputStream) httpurlc.getInputStream();
-        BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));//$NON-NLS-1$
-        StringBuilder sb = new StringBuilder();
-        String line;
-        while ((line = br.readLine()) != null) {
-            sb.append(line);
-            sb.append("\n");//$NON-NLS-1$
-        }
-        br.close();
-        response = sb.toString();
-        
-        resultHeaders = httpurlc.getHeaderFields();
-        
-        // disconnect explicitly (may not be necessary)
-        httpurlc.disconnect();
-
-        return response;
-    }	
-
-	/*
-	 * Invokes the WS and returns a result
-	 */
-	public static String invokeWS( String endpointurl, String actionurl, String body )  throws Exception {
-		
-		/* 
-		 * the endpoint & action urls + the soap in are what we
-		 * need to invoke the WS
-		 */
-		String endpoint = endpointurl;
-		String action = actionurl;
-		String soapIn = body;	
-
-    	/* Use AXIS to call the WS */
-		String document = stripNLsFromXML(soapIn);
-		Service service = new Service();
-		Call call= (Call) service.createCall();
-		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
-		call.setOperationStyle( org.apache.axis.constants.Style.MESSAGE );
-		if ( action != null ) {
-		    call.setProperty(Call.SOAPACTION_USE_PROPERTY,Boolean.TRUE);
-		    call.setProperty(Call.SOAPACTION_URI_PROPERTY,action);
-		}
-		Message message = new Message(document);
-		SOAPEnvelope envelope = call.invoke( message );
-		System.out.println(envelope.getHeaders().toString());
-		
-		String cleanedUp = stripNLsFromXML(envelope.getBody().toString());
-		return cleanedUp;
-	}
-	
 	public static String addNLsToXML( String incoming ) {
 		String outgoing = null;
 		if (incoming != null) {

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/DelimitedStringList.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/DelimitedStringList.java	2010-05-10 22:05:03 UTC (rev 22001)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/DelimitedStringList.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -446,21 +446,27 @@
 	 * @return
 	 */
 	private String[] parseString(String str_list) {
-		StringTokenizer tk = new StringTokenizer(str_list, this.mDelimiter);
-		String[] pieces = new String[tk.countTokens()];
-		int index = 0;
-		while (tk.hasMoreTokens())
-			pieces[index++] = tk.nextToken();
-		return pieces;
+		if (str_list != null) {
+			StringTokenizer tk = new StringTokenizer(str_list, this.mDelimiter);
+			String[] pieces = new String[tk.countTokens()];
+			int index = 0;
+			while (tk.hasMoreTokens())
+				pieces[index++] = tk.nextToken();
+			return pieces;
+		} 
+		return new String[0];
 	}
 
 	public static String[] parseString(String str_list, String delimiter) {
-		StringTokenizer tk = new StringTokenizer(str_list, delimiter);
-		String[] pieces = new String[tk.countTokens()];
-		int index = 0;
-		while (tk.hasMoreTokens())
-			pieces[index++] = tk.nextToken();
-		return pieces;
+		if (str_list != null) {
+			StringTokenizer tk = new StringTokenizer(str_list, delimiter);
+			String[] pieces = new String[tk.countTokens()];
+			int index = 0;
+			while (tk.hasMoreTokens())
+				pieces[index++] = tk.nextToken();
+			return pieces;
+		}
+		return new String[0];
 	}
 
 	/**

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java	2010-05-10 22:05:03 UTC (rev 22001)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -18,6 +18,12 @@
 import java.util.Map.Entry;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
@@ -42,9 +48,17 @@
 import org.eclipse.ui.part.ViewPart;
 import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
 import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;
+import org.jboss.tools.ws.ui.JBossWSUIPlugin;
 import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JAXRSTester;
+import org.jboss.tools.ws.ui.utils.JAXWSTester;
 import org.jboss.tools.ws.ui.utils.WSTestUtils;
 
+/**
+ * View for testing web services (JAX-WS & JAX-RS)
+ * @author bfitzpat
+ *
+ */
 @SuppressWarnings("restriction")
 public class JAXRSWSTestView extends ViewPart {
 
@@ -56,6 +70,7 @@
 	private static final String JAX_WS = "JAX-WS"; //$NON-NLS-1$
 	private static final String JAX_RS = "JAX-RS"; //$NON-NLS-1$
 	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+	private static final String RESULT_HEADER_DELIMITER = "%";//$NON-NLS-1$
 
 	/**
 	 * The ID of the view as specified by the extension.
@@ -84,7 +99,7 @@
 	private DelimitedStringList parmsList;
 	private Button openTCPIPMonitorButton;
 	private Button addTCPIPMonitorButton;
-	
+
 	/**
 	 * The constructor.
 	 */
@@ -99,17 +114,17 @@
 
 		Composite innerComposite = new Composite (parent, SWT.NONE);
 		innerComposite.setLayout(new FillLayout());
-		
+
 		SashForm sashForm = new SashForm(innerComposite, SWT.BORDER);
 		sashForm.setOrientation(SWT.HORIZONTAL);
-		
-	    Composite topHalf = new Composite (sashForm, SWT.NONE);
+
+		Composite topHalf = new Composite (sashForm, SWT.NONE);
 		topHalf.setLayout(new GridLayout(2, false));
-		
+
 		Label typeLabel = new Label(topHalf, SWT.NONE);
 		typeLabel.setText(JBossWSUIMessages.JAXRSWSTestView_Web_Service_Type_Label);
 		typeLabel.setLayoutData(new GridData());
-		
+
 		wsTypeCombo = new Combo(topHalf, SWT.DROP_DOWN | SWT.READ_ONLY);
 		wsTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
 		wsTypeCombo.add(JAX_WS);
@@ -124,11 +139,11 @@
 				setControlsForSelectedURL();
 			}
 		});
-		
+
 		Label methodLabel = new Label(topHalf, SWT.NONE);
 		methodLabel.setText(JBossWSUIMessages.JAXRSWSTestView_HTTP_Method_Label);
 		methodLabel.setLayoutData(new GridData());
-		
+
 		methodCombo = new Combo(topHalf, SWT.DROP_DOWN | SWT.READ_ONLY);
 		methodCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
 		methodCombo.add(GET);
@@ -144,11 +159,11 @@
 				setControlsForMethodType(methodCombo.getText());
 			}
 		});
-		
+
 		Label urlLabel = new Label(topHalf, SWT.NONE);
 		urlLabel.setText(JBossWSUIMessages.JAXRSWSTestView_Service_URL_Label);
 		urlLabel.setLayoutData(new GridData());
-		
+
 		urlCombo = new Combo(topHalf, SWT.BORDER | SWT.DROP_DOWN);
 		urlCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
 		urlCombo.addSelectionListener(new SelectionListener() {
@@ -166,15 +181,15 @@
 			public void keyReleased(KeyEvent e) {
 				setControlsForSelectedURL();
 				if (e.keyCode == SWT.CR) {
-					handleTest();
+					handleTest(wsTypeCombo.getText());
 				}
 			}
 		});
-		
+
 		Label actionLabel = new Label(topHalf, SWT.NONE);
 		actionLabel.setText(JBossWSUIMessages.JAXRSWSTestView_Action_URL_Label);
 		actionLabel.setLayoutData(new GridData());
-		
+
 		actionText = new Text(topHalf, SWT.BORDER);
 		actionText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
 
@@ -191,18 +206,18 @@
 		GridData parmsListGD = new GridData(SWT.FILL, SWT.FILL, true, true);
 		parmsListGD.horizontalSpan = 2;
 		parmsList.setLayoutData(parmsListGD);
-		
+
 		headerTab = new TabItem(tabGroup, SWT.NONE, 2);
 		bodyText = new Text(tabGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
 		GridData btGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
 		bodyText.setLayoutData(btGridData);
 		bodyTab.setControl(bodyText);
-		
+
 		headerTab.setText(JBossWSUIMessages.JAXRSWSTestView_Request_Header_Label);
 		GridData hgGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
 		hgGridData.horizontalSpan = 2;
 		tabGroup.setLayoutData(hgGridData);
-		
+
 		dlsList = new DelimitedStringList(tabGroup, SWT.None);
 		headerTab.setControl(dlsList);
 		GridData dlsListGD = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -214,22 +229,22 @@
 		buttonBarGD.horizontalSpan = 2;
 		buttonBar.setLayoutData(buttonBarGD);
 		buttonBar.setLayout(new RowLayout());
-		
+
 		testButton = new Button (buttonBar, SWT.PUSH);
 		testButton.setText(JBossWSUIMessages.JAXRSWSTestView_Invoke_Label);
-		
+
 		testButton.addSelectionListener(new SelectionListener() {
 			public void widgetSelected(SelectionEvent e) {
-				handleTest();
+				handleTest(wsTypeCombo.getText());
 			}
 			public void widgetDefaultSelected(SelectionEvent e) {
 				widgetSelected(e);
 			}
 		});
-		
+
 		addTCPIPMonitorButton = new Button(buttonBar, SWT.PUSH);
 		addTCPIPMonitorButton.setText(JBossWSUIMessages.JAXRSWSTestView_Configure_Monitor_Button);
-		
+
 		addTCPIPMonitorButton.addSelectionListener(new SelectionListener() {
 			public void widgetSelected(SelectionEvent e) {
 				configureMonitor();
@@ -241,7 +256,7 @@
 
 		openTCPIPMonitorButton = new Button(buttonBar, SWT.PUSH);
 		openTCPIPMonitorButton.setText(JBossWSUIMessages.JAXRSWSTestView_Open_Monitor_Button);
-		
+
 		openTCPIPMonitorButton.addSelectionListener(new SelectionListener() {
 			public void widgetSelected(SelectionEvent e) {
 				openMonitor();
@@ -253,8 +268,8 @@
 
 		Button sampleButton = new Button(buttonBar, SWT.PUSH);
 		sampleButton.setText(JBossWSUIMessages.JAXRSWSTestView_Set_Sample_Data_Label);
-		sampleButton.setVisible(false);
-		
+		sampleButton.setVisible(true);
+
 		sampleButton.addSelectionListener(new SelectionListener() {
 			public void widgetSelected(SelectionEvent e) {
 				setupSample();
@@ -277,7 +292,7 @@
 		resultsText = new Text(resultTabGroup, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY );
 		resultsText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 		resultTab.setControl(resultsText);
-		
+
 		resultHeadersTab = new TabItem(resultTabGroup, SWT.NONE, 1);
 		resultHeadersTab.setText(JBossWSUIMessages.JAXRSWSTestView_Results_Header_Label);
 		resultHeadersList = new List(resultTabGroup, SWT.V_SCROLL);
@@ -291,7 +306,7 @@
 		setControlsForMethodType(methodCombo.getText());
 		setControlsForSelectedURL();
 	}
-	
+
 	private void setControlsForSelectedURL() {
 		if (urlCombo.getText().trim().length() > 0) {
 			testButton.setEnabled(true);
@@ -301,19 +316,19 @@
 			addTCPIPMonitorButton.setEnabled(false);
 		}
 	}
-	
+
 	/*
 	 * Open the TCP/IP Monitor View 
 	 */
 	private void openMonitor() {
 		try {
 			PlatformUI.getWorkbench().getActiveWorkbenchWindow().
-				getActivePage().showView(TCPIP_VIEW_ID);
+			getActivePage().showView(TCPIP_VIEW_ID);
 		} catch (PartInitException e) {
 			e.printStackTrace();
 		}
 	}
-	
+
 	private IMonitor findMonitor(String urlToCheck) {
 		IMonitor monitor = null;
 
@@ -328,7 +343,7 @@
 		}
 		return monitor;
 	}
-	
+
 	/*
 	 * Configure a TCP/IP Monitor entry so we can monitor it 
 	 */
@@ -337,7 +352,7 @@
 			String oldUrl = urlCombo.getText();
 			IMonitor monitor = findMonitor(oldUrl);
 			if (monitor == null) {
-				
+
 				URL tempURL = null;
 				try {
 					tempURL = new URL(oldUrl);
@@ -354,7 +369,7 @@
 					return;
 				monitor = dialog.getMonitor();
 			}
-			
+
 			if (monitor != null) {
 				monitor = findMonitor(oldUrl);
 				if (monitor != null) {
@@ -367,7 +382,7 @@
 							e.printStackTrace();
 						}
 					}
-					
+
 					int port = monitor.getLocalPort();
 					int remotePort = monitor.getRemotePort();
 					String host = monitor.getRemoteHost();
@@ -397,7 +412,7 @@
 			bodyText.setEnabled(true);
 		}
 	}
-	
+
 	/*
 	 * Enable/disable controls based on the WS technology type
 	 * @param wsType
@@ -414,13 +429,13 @@
 			methodCombo.setText(POST);
 
 			String emptySOAP = "<?xml version=\"1.0\" standalone=\"yes\" ?>" + //$NON-NLS-1$
-				"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + //$NON-NLS-1$
-				"xmlns:ns=\"INSERT_URL_HERE\">" + //$NON-NLS-1$
-				"<soap:Body>" + //$NON-NLS-1$
-				"</soap:Body>" + //$NON-NLS-1$
-				"</soap:Envelope>";	 //$NON-NLS-1$
+			"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + //$NON-NLS-1$
+			"xmlns:ns=\"INSERT_URL_HERE\">" + //$NON-NLS-1$
+			"<soap:Body>" + //$NON-NLS-1$
+			"</soap:Body>" + //$NON-NLS-1$
+			"</soap:Envelope>";	 //$NON-NLS-1$
 			emptySOAP = WSTestUtils.addNLsToXML(emptySOAP);
-	
+
 			if (bodyText.getText().trim().length() == 0) {
 				bodyText.setText(emptySOAP);
 			}
@@ -436,7 +451,7 @@
 			methodCombo.setText(GET);
 		}
 	}
-	
+
 	/*
 	 * Sets up the controls to call a public sample RESTful WS that does
 	 * a postal code lookup or a JAX-WS service that does a 
@@ -455,16 +470,16 @@
 		}
 		else if (wsTypeCombo.getText().equalsIgnoreCase(JAX_WS)) {
 			String soapIn = "<?xml version=\"1.0\" standalone=\"yes\" ?>" + //$NON-NLS-1$
-				"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + //$NON-NLS-1$
-				"xmlns:ns=\"http://xmlme.com/WebServices\">" + //$NON-NLS-1$
-				"<soap:Body>" + //$NON-NLS-1$
-				"<ns:GetSpeech>" + //$NON-NLS-1$
-				"<ns:Request>slings and arrows</ns:Request>"+ //$NON-NLS-1$
-				"</ns:GetSpeech>"+ //$NON-NLS-1$
-				"</soap:Body>" + //$NON-NLS-1$
-				"</soap:Envelope>";	 //$NON-NLS-1$
+			"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + //$NON-NLS-1$
+			"xmlns:ns=\"http://xmlme.com/WebServices\">" + //$NON-NLS-1$
+			"<soap:Body>" + //$NON-NLS-1$
+			"<ns:GetSpeech>" + //$NON-NLS-1$
+			"<ns:Request>slings and arrows</ns:Request>"+ //$NON-NLS-1$
+			"</ns:GetSpeech>"+ //$NON-NLS-1$
+			"</soap:Body>" + //$NON-NLS-1$
+			"</soap:Envelope>";	 //$NON-NLS-1$
 			soapIn = WSTestUtils.addNLsToXML(soapIn);
-	
+
 			urlCombo.setText("http://www.xmlme.com/WSShakespeare.asmx"); //$NON-NLS-1$
 			actionText.setText("http://xmlme.com/WebServices/GetSpeech"); //$NON-NLS-1$
 			bodyText.setText(soapIn);
@@ -480,7 +495,8 @@
 	/*
 	 * Actually perform the test based on which type of activity it is 
 	 */
-	private void handleTest() {
+	private void handleTest(final String wsTech) {
+
 		if (urlCombo.getItemCount() > 0) {
 			java.util.List<String> aList = Arrays.asList(urlCombo.getItems());
 			if (!aList.contains(urlCombo.getText())) {
@@ -490,26 +506,82 @@
 			urlCombo.add(urlCombo.getText());
 		}
 		
-		if (wsTypeCombo.getText().equalsIgnoreCase(JAX_RS)) {
-			handleRSTest();
-		}
-		else if (wsTypeCombo.getText().equalsIgnoreCase(JAX_WS)) {
-			handleWSTest();
-		}
+		final String url = urlCombo.getText();
+		final String action = actionText.getText();
+		final String body = bodyText.getText();
+		final String method = methodCombo.getText();
+		final String headers = dlsList.getSelection();
+		final String parms = parmsList.getSelection();
+
+		Job aJob = new Job(JBossWSUIMessages.JAXRSWSTestView_Invoking_WS_Status) {
+			protected IStatus run(IProgressMonitor monitor) {
+				IStatus status = Status.OK_STATUS;
+				// execute the task ...
+				if (wsTech.equalsIgnoreCase(JAX_RS)) {
+					status = handleRSTest(monitor, url, method, body, parms, headers);
+				}
+				else if (wsTech.equalsIgnoreCase(JAX_WS)) {
+					status = handleWSTest(monitor, url, action, body);
+				}
+				monitor.done();
+				return status;  
+			}
+		};
+		// true to indicate that this job was initiated by a UI end user
+		aJob.setUser(true);		
+		aJob.schedule();
+		aJob.addJobChangeListener(new IJobChangeListener() {
+			
+			public void sleeping(IJobChangeEvent event) {};
+			public void scheduled(IJobChangeEvent event) {};
+			public void running(IJobChangeEvent event) {};
+			public void done(IJobChangeEvent event) {
+				if (event.getResult() instanceof WSTestStatus) {
+					final WSTestStatus status = (WSTestStatus) event.getResult();
+					PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+						public void run() {
+							resultsText.setText(status.getResultsText());
+							resultHeadersList.removeAll();
+							String[] headers =
+								DelimitedStringList.parseString(status.getHeadersList(), RESULT_HEADER_DELIMITER);
+							if (headers != null && headers.length > 0) {
+								for (int i = 0; i < headers.length; i++) { 
+									resultHeadersList.add(headers[i]);
+								}
+							}
+						}
+					});
+				}
+			}
+		
+			public void awake(IJobChangeEvent event) {};
+			public void aboutToRun(IJobChangeEvent event) {};
+		});
+
 	}
-	
+
 	/*
 	 * Actually call the WS and displays the result 
 	 */
-	private void handleWSTest() {
+	private IStatus handleWSTest(final IProgressMonitor monitor, String url, String action, String body) {
 		try {
-			String result = WSTestUtils.invokeWS(urlCombo.getText(), actionText.getText(), bodyText.getText());
+			
+			monitor.worked(10);
+			JAXWSTester tester = new JAXWSTester();
+			tester.doTest(url, action, body);
+			monitor.worked(70);
+			String result = tester.getResultBody();
 			String cleanedUp = WSTestUtils.addNLsToXML(result);
-			resultsText.setText(cleanedUp);
+			
+			WSTestStatus status = new WSTestStatus(IStatus.OK, 
+					JBossWSUIPlugin.PLUGIN_ID, 
+					JBossWSUIMessages.JAXRSWSTestView_JAXWS_Success_Status);
+			status.setResultsText(cleanedUp);
+			monitor.worked(10);
 
-			resultHeadersList.removeAll();
-			if (WSTestUtils.getResultHeaders() != null) {
-				Iterator<?> iter = WSTestUtils.getResultHeaders().entrySet().iterator();
+			String listText = EMPTY_STRING;
+			if (tester.getResultHeaders() != null) {
+				Iterator<?> iter = tester.getResultHeaders().entrySet().iterator();
 				while (iter.hasNext()) {
 					String text = EMPTY_STRING;
 					Entry<?, ?> entry = (Entry<?, ?>) iter.next();
@@ -517,38 +589,42 @@
 						text = entry.getValue().toString();
 					else
 						text = text + entry.toString();
-					resultHeadersList.add(text);
+					listText = listText + text;
+					if (iter.hasNext()) {
+						listText = listText + RESULT_HEADER_DELIMITER;
+					}
 				}
 			}
+			status.setHeadersList(listText);
+			monitor.worked(10);
+			return status;
 		} catch (Exception e) {
-			resultsText.setText(e.toString());
+			WSTestStatus status = new WSTestStatus(IStatus.ERROR, 
+					JBossWSUIPlugin.PLUGIN_ID, 
+					JBossWSUIMessages.JAXRSWSTestView_Exception_Status + e.getLocalizedMessage());
+			status.setResultsText(e.toString());
 			e.printStackTrace();
+			return status;
 		}
 	}
 
 	/*
 	 * Actually call the RESTful WS to test it
 	 */
-	private void handleRSTest() {
-		
-		// Get the service URL
-		String address = urlCombo.getText();
-		
-		// Is this a GET or POST activity?
-		String method = methodCombo.getText();
-		
-		// If it's a GET, what's the Request body text?
-		String body = EMPTY_STRING;
-		if (method.equalsIgnoreCase(GET))
-			body = bodyText.getText();
-		
+	private IStatus handleRSTest(final IProgressMonitor monitor, String address, String method, String body, String parms, String headersStr) {
+
+		if (!method.equalsIgnoreCase(GET))
+			body = EMPTY_STRING;
+
 		// if no actual text in the request body, set to null
 		if (body.trim().length() == 0) body = null;
-		
+
+		monitor.worked(10);
+
 		// Process parameters for web service call
 		HashMap<String, String> parameters = new HashMap<String, String>();
-		if (!parmsList.isDisposed() && parmsList.getSelection() != null && parmsList.getSelection().length() > 0) {
-			String[] parsedList = DelimitedStringList.parseString(parmsList.getSelection() , ","); //$NON-NLS-1$
+		if (parms != null && parms.length() > 0) {
+			String[] parsedList = DelimitedStringList.parseString(parms , ","); //$NON-NLS-1$
 			if (parsedList != null && parsedList.length > 0) {
 				for (int i = 0; i < parsedList.length; i++) {
 					String nameValuePair = parsedList[i];
@@ -559,11 +635,12 @@
 				}
 			}
 		}
-		
+
+		monitor.worked(10);
 		// Process headers for web service call
 		HashMap<String, String> headers = new HashMap<String, String>();
-		if (!dlsList.isDisposed() && dlsList.getSelection() != null && dlsList.getSelection().length() > 0) {
-			String[] parsedList = DelimitedStringList.parseString(dlsList.getSelection() , ","); //$NON-NLS-1$
+		if (headersStr != null && headersStr.length() > 0) {
+			String[] parsedList = DelimitedStringList.parseString(headersStr , ","); //$NON-NLS-1$
 			if (parsedList != null && parsedList.length > 0) {
 				for (int i = 0; i < parsedList.length; i++) {
 					String nameValuePair = parsedList[i];
@@ -574,40 +651,57 @@
 				}
 			}
 		}
-		
+
 		// now actually call it
 		try {
-			// clear the results text
-			resultsText.setText(EMPTY_STRING);
 			
+			JAXRSTester tester = new JAXRSTester();
+			
 			// call the service
-			String result =
-				WSTestUtils.callRestfulWebService(address, parameters, headers, method, body);
+			tester.doTest(address, parameters, headers, method, body);
 			
+			String result = tester.getResultBody();
+
 			// put the results in the result text field
 			String cleanedUp = WSTestUtils.addNLsToXML(result);
-			resultsText.setText(cleanedUp);
 
-			resultHeadersList.removeAll();
-			Iterator<?> iter = WSTestUtils.getResultHeaders().entrySet().iterator();
-			while (iter.hasNext()) {
-				String text = EMPTY_STRING;
-				Entry<?, ?> entry = (Entry<?, ?>) iter.next();
-				if (entry.getKey() == null) 
-					text = entry.getValue().toString();
-				else
-					text = text + entry.toString();
-				resultHeadersList.add(text);
+			WSTestStatus status = new WSTestStatus(IStatus.OK, 
+					JBossWSUIPlugin.PLUGIN_ID, 
+					JBossWSUIMessages.JAXRSWSTestView_JAXRS_Success_Status);
+			status.setResultsText(cleanedUp);
+
+			String listText = EMPTY_STRING;
+			if (tester.getResultHeaders() != null) {
+				Iterator<?> iter = tester.getResultHeaders().entrySet().iterator();
+				while (iter.hasNext()) {
+					String text = EMPTY_STRING;
+					Entry<?, ?> entry = (Entry<?, ?>) iter.next();
+					if (entry.getKey() == null) 
+						text = entry.getValue().toString();
+					else
+						text = text + entry.toString();
+					listText = listText + text;
+					if (iter.hasNext()) {
+						listText = listText + RESULT_HEADER_DELIMITER;
+					}
+				}
 			}
 
+			System.out.println(listText);
+			status.setHeadersList(listText);
+			monitor.worked(10);
+			return status;
+			
 		} catch (Exception e) {
-			
-			// if we hit an error, put it in the results text
-			resultsText.setText(e.toString());
+			WSTestStatus status = new WSTestStatus(IStatus.ERROR, 
+					JBossWSUIPlugin.PLUGIN_ID, 
+					JBossWSUIMessages.JAXRSWSTestView_Exception_Status + e.getLocalizedMessage());
+			status.setResultsText(e.toString());
 			e.printStackTrace();
+			return status;
 		}
 	}
-	
+
 	/**
 	 * Passing the focus request to the control.
 	 */
@@ -615,4 +709,5 @@
 		// set initial focus to the URL text combo
 		urlCombo.setFocus();
 	}
+	
 }
\ No newline at end of file

Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSTestStatus.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSTestStatus.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSTestStatus.java	2010-05-10 22:06:32 UTC (rev 22002)
@@ -0,0 +1,29 @@
+package org.jboss.tools.ws.ui.views;
+
+import org.eclipse.core.runtime.Status;
+
+public class WSTestStatus extends Status {
+
+	private String resultsText;
+	private String headersList;
+	
+	public WSTestStatus(int severity, String pluginId, String message) {
+		super(severity, pluginId, message);
+	}
+
+	public String getResultsText() {
+		return resultsText;
+	}
+
+	public void setResultsText(String resultsText) {
+		this.resultsText = resultsText;
+	}
+
+	public String getHeadersList() {
+		return headersList;
+	}
+
+	public void setHeadersList(String headersList) {
+		this.headersList = headersList;
+	}
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSTestStatus.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list