[jbosstools-commits] JBoss Tools SVN: r23263 - in trunk/ws/plugins/org.jboss.tools.ws.ui: src/org/jboss/tools/ws/ui/messages and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jul 6 18:10:49 EDT 2010


Author: bfitzpat
Date: 2010-07-06 18:10:48 -0400 (Tue, 06 Jul 2010)
New Revision: 23263

Added:
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
Modified:
   trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
   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/TesterWSDLUtils.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
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSDLBrowseDialog.java
Log:


Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF	2010-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF	2010-07-06 22:10:48 UTC (rev 23263)
@@ -29,7 +29,8 @@
  org.eclipse.wst.internet.monitor.core,
  org.eclipse.wst.internet.monitor.ui,
  javax.wsdl;bundle-version="1.6.2",
- org.jdom
+ org.jdom,
+ javax.xml.ws
 Bundle-ActivationPolicy: lazy
 Export-Package: org.jboss.tools.ws.ui,
  org.jboss.tools.ws.ui.messages,

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-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-07-06 22:10:48 UTC (rev 23263)
@@ -2,8 +2,6 @@
 Command=wsconsume.sh
 Bin=bin
 Client=client
-DelimitedStringList_NO_COMMAS_WARNING=There are no commas delimiting the name and value for this key/value pair.
-DelimitedStringList_NO_EQUALS_DELIMITER_WARNING=Parameters should be in 'name=value' format.
 Lib=lib
 Endorsed=endorsed
 # END NON-TRANSLATABLE
@@ -124,3 +122,11 @@
 WSDLBrowseDialog_WSDL_URI_Field=WSDL URI:
 WSDLBrowseDialog_WSDL_URL_Dialog_Title=WSDL URL
 WSDLBrowseDialog_WSDL_URL_Prompt=Type the URL for the WSDL:
+DelimitedStringList_Msg_No_Btn=No
+DelimitedStringList_Msg_Text_ParseByAmpersand=Should we parse the string to be added by ampersands '&&' and add each individual string?
+DelimitedStringList_Msg_Text_ParseByComma=Should we parse the string to be added by commas ',' and add each individual string?
+DelimitedStringList_Msg_Title_ParseByAmpersand=Parse String by '&'?
+DelimitedStringList_Msg_Title_ParseByComma=Parse String by ','?
+DelimitedStringList_Msg_Yes_Btn=Yes
+DelimitedStringList_NO_COMMAS_WARNING=There are no commas delimiting the name and value for this key/value pair.
+DelimitedStringList_NO_EQUALS_DELIMITER_WARNING=Parameters should be in 'name=value' format.

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-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -27,6 +27,12 @@
 	public static String Bin;
 	public static String Command;
 	public static String Client;
+	public static String DelimitedStringList_Msg_No_Btn;
+	public static String DelimitedStringList_Msg_Text_ParseByAmpersand;
+	public static String DelimitedStringList_Msg_Text_ParseByComma;
+	public static String DelimitedStringList_Msg_Title_ParseByAmpersand;
+	public static String DelimitedStringList_Msg_Title_ParseByComma;
+	public static String DelimitedStringList_Msg_Yes_Btn;
 	public static String DelimitedStringList_NO_COMMAS_WARNING;
 	public static String DelimitedStringList_NO_EQUALS_DELIMITER_WARNING;
 	public static String Lib;

Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -0,0 +1,113 @@
+/******************************************************************************* 
+ * 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.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis.message.SOAPEnvelope;
+
+/**
+ * Test a JAX-WS web service using the JAX-WS API
+ * @author bfitzpat
+ *
+ */
+public class JAXWSTester2 {
+
+	// the response message to pass back
+	private String resultBody;
+	
+	private SOAPEnvelope resultSOAP;
+	
+	private SOAPBody resultSOAPBody;
+	
+	// the result HTTP headers to pass back
+	private Map<String, String> resultHeaders;
+	
+	// utility constant
+	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+	/**
+	 * Return the response message
+	 * @return 
+	 */
+	public String getResultBody() {
+		return this.resultBody;
+	}
+	
+	public SOAPBody getResultSOAPBody() {
+		return this.resultSOAPBody;
+	}
+	
+	/**
+	 * Return a map of HTTP headers from the response
+	 * @return
+	 */
+	public Map<String, String> getResultHeaders() {
+		return this.resultHeaders;
+	}
+	
+	public SOAPEnvelope getResultSOAP(){
+		return this.resultSOAP;
+	}
+	
+	/**
+	 * Invoke the JAX-WS service
+	 * @param endpointurl
+	 * @param actionurl
+	 * @param body
+	 * @throws Exception
+	 */
+	@SuppressWarnings("unchecked")
+	public void doTest( String endpointurl, String actionurl, String ns, 
+			String serviceName, String messageName, String body ) throws Exception {
+		
+		this.resultBody = EMPTY_STRING;
+
+		URL serviceURL = new URL (endpointurl); //"http://www.ecubicle.net/gsearch_rss.asmx"
+		QName serviceQName = new QName (ns, serviceName); // "http://www.ecubicle.net/webservices", "gsearch_rss"
+		Service s = Service.create(serviceURL, serviceQName);
+		
+		QName messageQName = new QName(ns, messageName); //"http://www.ecubicle.net/webservices", "gsearch_rssSoap"
+		Dispatch<SOAPMessage> d = s.createDispatch(messageQName, SOAPMessage.class, Mode.MESSAGE);
+		d.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, actionurl); //"http://www.ecubicle.net/webservices/GetSearchResults");
+		
+		MessageFactory mf = MessageFactory.newInstance();
+		SOAPMessage m = mf.createMessage( null, new ByteArrayInputStream(body.getBytes()));
+		m.saveChanges();
+		
+		SOAPMessage o = d.invoke(m);
+		
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		o.writeTo(baos);
+		this.resultBody = baos.toString();
+		this.resultSOAPBody = o.getSOAPBody();
+		
+		if (d.getResponseContext() != null) {
+			Object responseHeaders = d.getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
+			if ( responseHeaders != null && responseHeaders instanceof Map) {
+				this.resultHeaders = (Map<String, String>) responseHeaders;
+			}
+		}
+	}
+}


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

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/TesterWSDLUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/TesterWSDLUtils.java	2010-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/TesterWSDLUtils.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -141,6 +141,12 @@
 							if (opName != null && operation.getName().contentEquals(opName)) {
 								Message inputMsg = operation.getInput().getMessage();
 								Collection<?> parts = inputMsg.getParts().values();
+								StringBuffer buf = new StringBuffer();
+								if (parts.size() > 1) {
+									buf.append('<' + operation.getName());
+									buf.append(" xmlns = \"" + ns + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+									buf.append(">\n"); //$NON-NLS-1$
+								}
 								for( Iterator<?> it4 = parts.iterator(); it4.hasNext(); ) {
 									Part part = (Part) it4.next();
 									String schemaName = null;
@@ -149,9 +155,24 @@
 									} else {
 										schemaName = part.getName();
 									}
-									String out = createMessageForSchemaElement(wsdlDefinition, schemaName, ns);
-									return out;
+									if (parts.size() > 1) {
+										if (part != null && part.getTypeName() != null && !part.getTypeName().getNamespaceURI().
+												equalsIgnoreCase("http://www.w3.org/2001/XMLSchema")) { //$NON-NLS-1$
+											buf.append(createMessageForSchemaElement(wsdlDefinition, part.getName(), part.getTypeName().getLocalPart(), ns));
+										} else {
+											buf.append('<' + part.getName());
+	//										buf.append(" xmlns = \"" + ns + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+											buf.append(">?"); //$NON-NLS-1$
+											buf.append("</" + part.getName() + ">\n");//$NON-NLS-1$//$NON-NLS-2$
+										}
+									} else {
+										String partName = part.getName();
+										if (parts.size() == 1) partName = null;
+										String out = createMessageForSchemaElement(wsdlDefinition, partName, schemaName, ns);
+										return out;
+									}
 								}
+								return buf.toString();
 							}
 						}
 					}
@@ -161,6 +182,36 @@
 		return null;
 	}
 	
+	public static String[] getNSServiceNameAndMessageNameArray (Definition wsdlDefinition, String serviceName, String portName, String bindingName, String opName ) {
+		Map<?, ?> services = wsdlDefinition.getServices();
+		Set<?> serviceKeys = services.keySet();
+		for( Iterator<?> it = serviceKeys.iterator(); it.hasNext(); ) {
+			QName serviceKey = (QName) it.next();
+			if (serviceName != null && serviceKey.getLocalPart().contentEquals(serviceName)) {
+				Service service = (Service) services.get( serviceKey );
+				Map<?, ?> ports = service.getPorts();
+				Set<?> portKeys = ports.keySet();
+				for( Iterator<?> it2 = portKeys.iterator(); it2.hasNext(); ) {
+					String portKey = (String) it2.next();
+					if (portName != null && portKey.contentEquals(portName)) {
+						Port port = (Port) ports.get( portKey );
+						Binding wsdlBinding = port.getBinding();
+						PortType portType = wsdlBinding.getPortType();
+						String ns = portType.getQName().getNamespaceURI();
+						List<?> operations = portType.getOperations();
+						for (Iterator<?> it3 = operations.iterator(); it3.hasNext();){
+							Operation operation = (Operation) it3.next();
+							if (opName != null && operation.getName().contentEquals(opName)) {
+								return new String[] {ns, serviceName, portName};
+							}
+						}
+					}
+				}
+			}
+		}
+		return null;
+	}
+	
 	public static String getEndpointURL ( Definition wsdlDefinition, String serviceName, String portName, String bindingName, String opName ) {
 		Map<?, ?> services = wsdlDefinition.getServices();
 		Set<?> serviceKeys = services.keySet();
@@ -317,7 +368,7 @@
 		return null;
 	}
 	
-	private static String createMessageForSchemaElementFromTypes ( Definition wsdlDefinition, Types types, String messageName, String namespace ) {
+	private static String createMessageForSchemaElementFromTypes ( Definition wsdlDefinition, Types types, String partName, String messageName, String namespace ) {
 		if (types != null &&types.getExtensibilityElements().size() > 0) {
 			Schema schema = (Schema) types.getExtensibilityElements().get(0);
 			DOMBuilder domBuilder = new DOMBuilder();
@@ -377,10 +428,27 @@
 						
 						if (rootName.equalsIgnoreCase(messageName)) {
 							StringBuffer buf = new StringBuffer();
-							buf.append('<' + rootName);
-							buf.append(" xmlns = \"" + namespace + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+							buf.append('<');
+							if (partName != null) {
+								buf.append(partName);
+							}
+							else {
+								buf.append(rootName);
+								buf.append(" xmlns = \"" + namespace + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+							}
 							buf.append(">\n"); //$NON-NLS-1$
-							if (!temp.getChildren().isEmpty()){
+							if (temp.getChildren().isEmpty()) {
+								String nstemp = namespace;
+								String typeName = temp.getAttributeValue(TYPE_ATTR);
+								String prefix = null;
+								if (typeName.indexOf(':') > 0) {
+									prefix = typeName.substring(0, typeName.indexOf(':'));
+									nstemp = temp.getNamespace(prefix).getURI();
+									typeName = typeName.substring(typeName.indexOf(':') + 1, typeName.length());
+								}
+								temp = getNodeFromSchema(temp.getParentElement(), typeName, nstemp, prefix);
+							}
+							if (temp != null && !temp.getChildren().isEmpty()){
 								org.jdom.Element temp2 = (org.jdom.Element)temp.getChildren().get(0);
 								if (temp2.getName().contains(COMPLEX_TYPE_NAME)) {
 									String elementStr = processComplexType(wsdlDefinition, temp2);
@@ -390,8 +458,32 @@
 									buf.append(elementStr);
 								}
 							}
-							buf.append("</" + rootName + ">\n");//$NON-NLS-1$//$NON-NLS-2$
+							buf.append("</");//$NON-NLS-1$
+							if (partName != null)
+								buf.append(partName);
+							else
+								buf.append(rootName);
+							buf.append(">\n");//$NON-NLS-1$
 							return buf.toString();
+						} else {
+							Message msg = wsdlDefinition.getMessage(new QName(namespace, messageName));
+							if (msg != null) {
+								StringBuffer buf = new StringBuffer();
+								buf.append('<');
+								if (partName != null)
+									buf.append(partName);
+								else
+									buf.append(rootName);
+								buf.append(" xmlns = \"" + namespace + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+								buf.append(">?"); //$NON-NLS-1$
+								buf.append("</");//$NON-NLS-1$
+								if (partName != null)
+									buf.append(partName);
+								else
+									buf.append(rootName);
+								buf.append(">\n");//$NON-NLS-1$
+								return buf.toString();
+							}
 						}
 					}
 				}
@@ -400,6 +492,25 @@
 		return null;
 	}
 	
+	private static org.jdom.Element getNodeFromSchema ( org.jdom.Element root, String name, String ns, String prefix) {
+		if (root != null) {
+			List<?> childList = root.getChildren();
+			Iterator<?> iter1 = childList.iterator();
+			while (iter1.hasNext()) {
+				Object test = iter1.next();
+				if (test instanceof org.jdom.Element) {
+					org.jdom.Element childEl = (org.jdom.Element) test;
+					if (childEl.getAttributeValue(NAME_ATTR, ns).equalsIgnoreCase(name)) {
+						String typeName = childEl.getAttributeValue(TYPE_ATTR);
+						if (typeName == null || !typeName.equalsIgnoreCase(prefix + ':' + name)) 
+							return childEl;
+					}
+				}
+			}
+		}
+		return null;
+	}
+	
 	private static String processComplexType (Definition wsdlDefinition, org.jdom.Element childEl ) {
         StringBuffer buf = new StringBuffer();
 		if (!childEl.getChildren().isEmpty()) {
@@ -426,11 +537,6 @@
 			buf.append("?"); //$NON-NLS-1$
 		} else if (type.contains(SIMPLE_TYPE_NAME)) {
 			buf.append("?"); //$NON-NLS-1$
-//			for (int j = 0; j < childEl.getChildren().size(); j++) {
-//				org.jdom.Element tempEl = (org.jdom.Element) childEl.getChildren().get(j); 
-//				String elementStr = processChild(wsdlDefinition, tempEl);
-//				buf.append(elementStr);
-//			}
 		} else if (type.contains(RESTRICTION_NAME)) {
 			for (int j = 0; j < childEl.getChildren().size(); j++) {
 				org.jdom.Element tempEl = (org.jdom.Element) childEl.getChildren().get(j); 
@@ -510,7 +616,7 @@
 		return buf.toString();
 	}
 
-	public static String createMessageForSchemaElement ( Definition wsdlDefinition, String messageName, String namespace ) {
+	public static String createMessageForSchemaElement ( Definition wsdlDefinition, String partName, String messageName, String namespace ) {
 		Types types = wsdlDefinition.getTypes();
 		if (types == null) {
 			Map<?, ?> imports = wsdlDefinition.getImports();
@@ -523,18 +629,18 @@
 					Import importInstance = (Import) iter.next();
 					if (importInstance.getDefinition().getTypes() != null) {
 						types = importInstance.getDefinition().getTypes();
-						String attempt = createMessageForSchemaElementFromTypes(wsdlDefinition, types, messageName, namespace);
+						String attempt = createMessageForSchemaElementFromTypes(wsdlDefinition, types, partName, messageName, namespace);
 						if (attempt != null)
 							return attempt;
 					} else if (importInstance.getDefinition().getImports() != null) {
-						String attempt = createMessageForSchemaElement(importInstance.getDefinition(), messageName, namespace);
+						String attempt = createMessageForSchemaElement(importInstance.getDefinition(), partName, messageName, namespace);
 						if (attempt != null)
 							return attempt;
 					}
 				}
 			}
 		} else {
-			String attempt = createMessageForSchemaElementFromTypes(wsdlDefinition, types, messageName, namespace);
+			String attempt = createMessageForSchemaElementFromTypes(wsdlDefinition, types, partName, messageName, namespace);
 			if (attempt != null)
 				return attempt;
 		}

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-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/DelimitedStringList.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -16,6 +16,7 @@
 
 import org.eclipse.core.runtime.ListenerList;
 import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -245,11 +246,42 @@
 	 */
 	private void addStringToList() {
 		if (this.mAddText.getText().length() > 0) {
-			this.mPropsList.add(this.mAddText.getText().trim());
+			String text = this.mAddText.getText().trim();
+			if (text.indexOf('&') > -1) {
+				MessageDialog dialog = new MessageDialog(
+						null, JBossWSUIMessages.DelimitedStringList_Msg_Title_ParseByAmpersand, null, 
+						JBossWSUIMessages.DelimitedStringList_Msg_Text_ParseByAmpersand,
+						MessageDialog.QUESTION,
+						new String[] {JBossWSUIMessages.DelimitedStringList_Msg_Yes_Btn, JBossWSUIMessages.DelimitedStringList_Msg_No_Btn},
+						0); // yes is the default
+				int result = dialog.open();
+				if (result == 0) {
+					String[] parsed = parseString(text, "&"); //$NON-NLS-1$
+					for (int i = 0; i < parsed.length; i++) {
+						this.mPropsList.add(parsed[i]);
+					}
+				}
+			} else if (text.indexOf(',') > -1) {
+					MessageDialog dialog = new MessageDialog(
+							null, JBossWSUIMessages.DelimitedStringList_Msg_Title_ParseByComma, null, 
+							JBossWSUIMessages.DelimitedStringList_Msg_Text_ParseByComma,
+							MessageDialog.QUESTION,
+							new String[] {JBossWSUIMessages.DelimitedStringList_Msg_Yes_Btn, JBossWSUIMessages.DelimitedStringList_Msg_No_Btn},
+							0); // yes is the default
+					int result = dialog.open();
+					if (result == 0) {
+						String[] parsed = parseString(text, ","); //$NON-NLS-1$
+						for (int i = 0; i < parsed.length; i++) {
+							this.mPropsList.add(parsed[i]);
+						}
+					}
+			} else {
+				this.mPropsList.add(text);
+			}
 			if (!isReadOnly){
 				this.mClearAllButton.setEnabled(true);
 			}
-			this.mAddText.setSelection(0, this.mAddText.getText().length());
+			this.mAddText.setSelection(0, text.length());
 			this.mAddText.setFocus();
 		}
 	}
@@ -431,11 +463,11 @@
 	}
 
 	private boolean validateText(String text) {
-		if (text != null && text.trim().length() > 0 && text.indexOf(",") > -1) { //$NON-NLS-1$
-			this.mWarning = JBossWSUIMessages.DelimitedStringList_NO_COMMAS_WARNING;
-			return false;
-		}
-		else if (text != null && text.trim().length() > 0 && text.indexOf("=") == -1) { //$NON-NLS-1$
+//		if (text != null && text.trim().length() > 0 && text.indexOf(",") > -1) { //$NON-NLS-1$
+//			this.mWarning = JBossWSUIMessages.DelimitedStringList_NO_COMMAS_WARNING;
+//			return false;
+//		}
+		/*else*/ if (text != null && text.trim().length() > 0 && text.indexOf("=") == -1) { //$NON-NLS-1$
 			this.mWarning = JBossWSUIMessages.DelimitedStringList_NO_EQUALS_DELIMITER_WARNING;
 			return false;
 		}

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-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -18,9 +18,11 @@
 import java.util.Map.Entry;
 
 import javax.wsdl.Definition;
+import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 
+import org.apache.axis.utils.XMLUtils;
 import org.eclipse.core.resources.IStorage;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -70,11 +72,12 @@
 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.JAXWSTester2;
 import org.jboss.tools.ws.ui.utils.ResultsXMLStorage;
 import org.jboss.tools.ws.ui.utils.ResultsXMLStorageInput;
 import org.jboss.tools.ws.ui.utils.TesterWSDLUtils;
 import org.jboss.tools.ws.ui.utils.WSTestUtils;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -128,6 +131,7 @@
 	private Button addTCPIPMonitorButton;
 
 	private SOAPEnvelope envelope;
+	private SOAPBody soapbody;
 	private MenuItem openInXMLEditorAction;
 	private MenuItem openResponseTagInXMLEditor;
 	private Menu resultsTextMenu;
@@ -136,6 +140,7 @@
 	private MenuItem copyResultHeaderMenuAction;
 	
 	private boolean showSampleButton = false;
+	private String[] serviceNSMessage = null;
 
 	/**
 	 * The constructor.
@@ -287,6 +292,7 @@
 				WSDLBrowseDialog wbDialog =  new WSDLBrowseDialog(getSite().getShell());
 				int rtnCode = wbDialog.open();
 				if (rtnCode == Window.OK){
+					serviceNSMessage = null;
 					Definition wsdlDef = wbDialog.getWSDLDefinition();
 					String output = TesterWSDLUtils.getSampleSOAPInputMessage(wsdlDef, 
 							wbDialog.getServiceTextValue(), 
@@ -303,6 +309,11 @@
 							wbDialog.getPortTextValue(), 
 							wbDialog.getBindingValue(), 
 							wbDialog.getOperationTextValue());
+					serviceNSMessage = TesterWSDLUtils.getNSServiceNameAndMessageNameArray(wsdlDef, 
+							wbDialog.getServiceTextValue(), 
+							wbDialog.getPortTextValue(), 
+							wbDialog.getBindingValue(), 
+							wbDialog.getOperationTextValue());
 					String soapIn = generateSampleSOAP(output);
 					bodyText.setText(soapIn);
 					urlCombo.setText(endpointURL);
@@ -408,35 +419,41 @@
 
 			public void widgetSelected(SelectionEvent arg0) {
 				String string = null;
-				if (envelope != null){
-					try {
-						NodeList list = envelope.getBody().getChildNodes();
-						for (int i = 0; i< list.getLength(); i++){
-							Node node = list.item(i);
-							if (node.getNodeName().contains("Response")){ //$NON-NLS-1$
-								NodeList list2 = node.getChildNodes();
-								for (int j = 0; j<list2.getLength(); j++){
-									Node node2 = list2.item(j);
-									if (node2.getNodeName().contains("Result")){ //$NON-NLS-1$
-										Node node3 = node2.getChildNodes().item(0);
-										if (node3.getNodeType() == Node.TEXT_NODE) {
-											string = node3.getNodeValue();
-											break;
-										} else if (node3.getNodeType() == Node.ELEMENT_NODE) {
-											string = node2.toString();
-											break;
-										}
+				try {
+					SOAPBody body = null;
+					if (envelope != null){
+						body = envelope.getBody();
+					} else if (soapbody != null) {
+						body = soapbody;
+					}
+
+					NodeList list = body.getChildNodes();
+					for (int i = 0; i< list.getLength(); i++){
+						Node node = list.item(i);
+						if (node.getNodeName().contains("Response")){ //$NON-NLS-1$
+							NodeList list2 = node.getChildNodes();
+							for (int j = 0; j<list2.getLength(); j++){
+								Node node2 = list2.item(j);
+								if (node2.getNodeName().contains("Result")){ //$NON-NLS-1$
+									Node node3 = node2.getChildNodes().item(0);
+									if (node3.getNodeType() == Node.TEXT_NODE) {
+										string = node3.getNodeValue();
+										break;
+									} else if (node3.getNodeType() == Node.ELEMENT_NODE) {
+										Element element = (Element) node3;
+										string = XMLUtils.ElementToString(element);
+										break;
 									}
 								}
-								if (string != null) break;
 							}
+							if (string != null) break;
 						}
-						if (string != null){
-							openXMLEditor(string);
-						}
-					} catch (SOAPException e) {
-						JBossWSUIPlugin.log(e);
 					}
+					if (string != null){
+						openXMLEditor(string);
+					}
+				} catch (SOAPException e) {
+					JBossWSUIPlugin.log(e);
 				}
 			}
 
@@ -833,12 +850,16 @@
 		try {
 
 			envelope = null;
+			soapbody = null;
 			monitor.worked(10);
-			JAXWSTester tester = new JAXWSTester();
-			tester.doTest(url, action, body);
+//			JAXWSTester tester = new JAXWSTester();
+//			tester.doTest(url, action, body);
+			JAXWSTester2 tester = new JAXWSTester2();
+			tester.doTest(url, action, serviceNSMessage[0], serviceNSMessage[1], serviceNSMessage[2], body);
 			monitor.worked(70);
 			String result = tester.getResultBody();
 			envelope = tester.getResultSOAP();
+			soapbody = tester.getResultSOAPBody();
 			String cleanedUp = WSTestUtils.addNLsToXML(result);
 
 			WSTestStatus status = new WSTestStatus(IStatus.OK, 

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSDLBrowseDialog.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSDLBrowseDialog.java	2010-07-06 21:26:46 UTC (rev 23262)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/WSDLBrowseDialog.java	2010-07-06 22:10:48 UTC (rev 23263)
@@ -223,7 +223,7 @@
 							IFile resource = (IFile) objects[0];
 							File tempFile = new File(resource.getRawLocationURI());
 							try {
-								URL testURL = tempFile.toURL();
+								URL testURL = tempFile.toURI().toURL();
 								locationCombo.setText(testURL.toExternalForm());
 								wsdlDefinition =
 									TesterWSDLUtils.readWSDLURL(testURL);
@@ -265,7 +265,7 @@
 				if (fileText != null){
 					File tempFile = new File(fileText);
 					try {
-						URL testURL = tempFile.toURL();
+						URL testURL = tempFile.toURI().toURL();
 						locationCombo.setText(testURL.toExternalForm());
 						wsdlDefinition =
 							TesterWSDLUtils.readWSDLURL(testURL);



More information about the jbosstools-commits mailing list