You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/19 14:43:35 UTC

[07/35] incubator-taverna-common-activities git commit: package names changed to org.apache.taverna.*

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSDLParserTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSDLParserTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSDLParserTest.java
new file mode 100644
index 0000000..c2f91ee
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSDLParserTest.java
@@ -0,0 +1,292 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+
+import org.junit.Test;
+
+public class WSDLParserTest {
+	
+	@Test
+	public void testGetOperations() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+                List<String> operations = parser.getOperations("eUtilsServiceSoap");
+
+		assertEquals(
+				"wrong number of operations found (wsdl may have changed)", 12,
+				operations.size());
+		assertEquals("wrong name for first operation", "run_eGquery", operations.get(0));
+		assertEquals("wrong style", "document", parser.getStyle());
+	}
+
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+
+	@Test
+	public void testGetActionURI() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+		String actionURI = parser.getSOAPActionURI("run_eInfo");
+		assertEquals("action uri is wrong", "einfo", actionURI);
+	}
+
+	@Test
+	public void testComplexTypeFromImport() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+
+		List<TypeDescriptor> inputs = parser
+				.getOperationInputParameters("run_eInfo");
+		List<TypeDescriptor> outputs = parser
+				.getOperationOutputParameters("run_eInfo");
+		assertEquals("wrong number of inputs", 1, inputs.size());
+		assertEquals("wrong number of outputs", 1, outputs.size());
+		assertTrue("input should be complex",
+				inputs.get(0) instanceof ComplexTypeDescriptor);
+		ComplexTypeDescriptor complexTypeDesc = (ComplexTypeDescriptor) inputs
+				.get(0);
+		assertEquals("wrong name", "parameters", complexTypeDesc.getName());
+		assertEquals("wrong number of elements", 3, complexTypeDesc
+				.getElements().size());
+
+		TypeDescriptor typeDesc = complexTypeDesc
+				.getElements().get(0);
+
+		assertEquals("wrong name", "db", typeDesc.getName());
+		assertEquals("wrong type", "string", typeDesc.getType());
+		assertTrue("db should be optional", typeDesc.isOptional());
+		assertFalse("db should not be unbounded", typeDesc.isUnbounded());
+
+		typeDesc = complexTypeDesc.getElements().get(1);
+		assertEquals("wrong name", "tool", typeDesc.getName());
+		assertEquals("wrong type", "string", typeDesc.getType());
+		assertTrue("tool should be optional", typeDesc.isOptional());
+		assertFalse("tool should not be unbounded", typeDesc.isUnbounded());
+
+		typeDesc = complexTypeDesc.getElements().get(2);
+		assertEquals("wrong name", "email", typeDesc.getName());
+		assertEquals("wrong type", "string", typeDesc.getType());
+		assertTrue("email should be optional", typeDesc.isOptional());
+		assertFalse("email should not be unbounded", typeDesc.isUnbounded());
+	}
+
+	@Test
+	public void testNestedComplexTypes() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl"));
+
+		List<TypeDescriptor> inputs = parser
+				.getOperationInputParameters("BIVGetComplexRecord");
+		List<TypeDescriptor> outputs = parser
+				.getOperationOutputParameters("BIVGetComplexRecord");
+
+		assertEquals("wrong number of inputs", 1, inputs.size());
+		assertEquals("wrong number of outputs", 1, outputs.size());
+
+		assertEquals("wrong name for input", "bid", (inputs
+				.get(0)).getName());
+		assertEquals("wrong type for input", "int", (inputs
+				.get(0)).getType());
+
+		assertEquals("wrong name for output", "BIVComplex",
+				(outputs.get(0)).getName());
+		assertEquals("wrong type for output", "BIVComplex",
+				(outputs.get(0)).getType());
+		assertTrue("wrong descriptor class for output",
+				outputs.get(0) instanceof ComplexTypeDescriptor);
+
+		ComplexTypeDescriptor typeDesc = (ComplexTypeDescriptor) outputs.get(0);
+		assertEquals("wrong number of inner elements", 3, typeDesc
+				.getElements().size());
+		assertEquals("wrong name for first element", "bid",
+				(typeDesc.getElements().get(0)).getName());
+		assertEquals("wrong name for 2nd element", "spokeModel",
+				(typeDesc.getElements().get(1)).getName());
+		assertEquals("wrong name for 3rd element", "subunit",
+				(typeDesc.getElements().get(2)).getName());
+
+		assertTrue("3rd element should be instance of ArrayTypeDescriptor",
+				typeDesc.getElements().get(2) instanceof ArrayTypeDescriptor);
+		ArrayTypeDescriptor arrayTypeDesc = (ArrayTypeDescriptor) typeDesc
+				.getElements().get(2);
+
+		assertEquals("wrong type for 3rd element", "BIVMolecule", arrayTypeDesc
+				.getType());
+
+		typeDesc = (ComplexTypeDescriptor) arrayTypeDesc.getElementType();
+
+		assertEquals("wrong type for 3rd element", "BIVMolecule", typeDesc
+				.getType());
+
+		assertEquals("wrong number of elements in nested complex type", 7,
+				typeDesc.getElements().size());
+		assertEquals("wrong name for first element", "id",
+				(typeDesc.getElements().get(0)).getName());
+		assertEquals("wrong type for first element", "int",
+				(typeDesc.getElements().get(0)).getType());
+
+		assertEquals("wrong name for last element", "smid-hits",
+				(typeDesc.getElements().get(6)).getName());
+		assertEquals("wrong type for last element", "int",
+				(typeDesc.getElements().get(6)).getType());
+	}
+	
+	@Test
+	public void testMissingStyleInBinding() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("SBWReader.wsdl"));
+		assertEquals("Style should default to document if missing", "document",
+				parser.getStyle());
+	}
+
+	@Test
+	public void testBaseTypes() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl"));
+
+		List<TypeDescriptor> inputs = parser
+				.getOperationInputParameters("BIVGetRecord");
+		assertEquals("wrong number of inputs", 1, inputs.size());
+		assertTrue("should not be base type",
+				inputs.get(0) instanceof BaseTypeDescriptor);
+		assertEquals("wrong name", "bid", (inputs.get(0))
+				.getName());
+		assertEquals("wrong type", "int", (inputs.get(0))
+				.getType());
+	}
+
+	@Test
+	public void testArrayType() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl"));
+
+		List<TypeDescriptor> inputs = parser
+				.getOperationInputParameters("BIVGetRecords");
+		List<TypeDescriptor> outputs = parser
+				.getOperationOutputParameters("BIVGetRecords");
+		assertEquals("wrong number of inputs", 1, inputs.size());
+		assertTrue("input should be of AArrayTypeDescriptor",
+				inputs.get(0) instanceof ArrayTypeDescriptor);
+
+		ArrayTypeDescriptor arrayTypeDesc = (ArrayTypeDescriptor) inputs.get(0);
+
+		assertEquals("wrong name", "ids", arrayTypeDesc.getName());
+		assertEquals("wrong type", "ArrayOf_xsd_int", arrayTypeDesc.getType());
+
+		TypeDescriptor typeDesc = arrayTypeDesc.getElementType();
+
+		assertTrue("element should be of type BaseTypeDescriptor",
+				typeDesc instanceof BaseTypeDescriptor);
+		assertEquals("wrong type", "int", typeDesc.getType());
+
+		assertEquals("wrong number of outputs", 1, outputs.size());
+
+		assertTrue("output should be of ArrayTypeDescriptor",
+				outputs.get(0) instanceof ArrayTypeDescriptor);
+
+		arrayTypeDesc = (ArrayTypeDescriptor) outputs.get(0);
+		assertEquals("wrong name", "BIVRecords", arrayTypeDesc.getName());
+		assertEquals("wrong type", "ArrayOfBIVRecord", arrayTypeDesc.getType());
+
+		typeDesc = arrayTypeDesc.getElementType();
+
+		assertEquals("wrong type", "BIVRecord", typeDesc.getType());
+	}
+
+	@Test
+	public void testGoVizNoOutputs() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("GoViz.wsdl"));
+
+		List<TypeDescriptor> inputs = parser
+				.getOperationInputParameters("destroySession");
+		List<TypeDescriptor> outputs = parser
+				.getOperationOutputParameters("destroySession");
+
+		assertEquals("wrong number of inputs", 1, inputs.size());
+		assertEquals("wrong number of outputs", 0, outputs.size());
+
+		TypeDescriptor typeDesc = inputs.get(0);
+		assertTrue("input should be BaseType",
+				typeDesc instanceof BaseTypeDescriptor);
+		assertEquals("wrong name", "sessionID", typeDesc.getName());
+		assertEquals("wrong type", "string", typeDesc.getType());
+	}
+
+	@Test
+	public void testGetUseEncoded() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl"));
+		String use = parser.getUse("BIVGetRecords");
+		assertEquals("use should be encoded", "encoded", use);
+	}
+
+	@Test
+	public void testGetUseLiteral() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+		String use = parser.getUse("run_eInfo");
+		assertEquals("use should be literal", "literal", use);
+	}
+
+	@Test
+	public void testGetOperationNamespace() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("CurrencyExchangeService.wsdl"));
+		String operationNamespace = parser.getOperationNamespaceURI("getRate");
+		assertEquals("operation namespace is wrong",
+				"urn:xmethods-CurrencyExchange", operationNamespace);
+	}
+	
+	@Test
+	public void testGetOperationNamespace2() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+		String operationNamespace = parser
+				.getOperationNamespaceURI("run_eInfo");
+		assertEquals("operation namespace is wrong",
+				"http://www.ncbi.nlm.nih.gov/soap/eutils/einfo",
+				operationNamespace);
+	}
+
+	@Test
+	public void testGetOperationElementQName() throws Exception {
+		WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));
+		QName operationQName = parser.getOperationQname("run_eInfo");
+		assertEquals("element name is wrong", "eInfoRequest", operationQName
+				.getLocalPart());
+		assertEquals("operation namespace is wrong",
+				"http://www.ncbi.nlm.nih.gov/soap/eutils/einfo", operationQName
+						.getNamespaceURI());
+	}
+
+	@Test
+	public void testGetOperationElementQName2() throws Exception {
+		URL tav744Url = getClass().getResource(
+				"/org/apache/taverna/wsdl/parser/TAV-744/InstrumentService__.wsdl");
+		WSDLParser parser = new WSDLParser(tav744Url.toExternalForm());
+		QName operationQName = parser.getOperationQname("getList");
+		assertEquals("operation element name is wrong", "GetListRequest",
+				operationQName.getLocalPart());
+		assertEquals("operation namespace is wrong",
+				"http://InstrumentService.uniparthenope.it/InstrumentService",
+				operationQName.getNamespaceURI());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSRFParserTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSRFParserTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSRFParserTest.java
new file mode 100644
index 0000000..382ae11
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/parser/WSRFParserTest.java
@@ -0,0 +1,56 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.parser;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Check that WSDLParser can detect WSRF.
+ * Tests {@link WSDLParser#checkWSRF()}
+ * 
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class WSRFParserTest {
+	
+	private URL counterServiceWSDL;
+	private WSDLParser wsdlParser;
+
+	@Before
+	public void findWSDL() {
+		String path = "wsrf/counterService/CounterService_.wsdl";
+		counterServiceWSDL = getClass().getResource(path);	
+		assertNotNull("Coult not find test WSDL " + path, counterServiceWSDL);
+	}
+	
+	@Test
+	public void isWSRF() throws Exception {
+		wsdlParser = new WSDLParser(counterServiceWSDL.toExternalForm());
+		assertTrue("Not recognized as WSRF service", wsdlParser.isWsrfService());
+	}
+
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/EncodedBodyBuilderTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/EncodedBodyBuilderTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/EncodedBodyBuilderTest.java
new file mode 100644
index 0000000..5235626
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/EncodedBodyBuilderTest.java
@@ -0,0 +1,154 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.w3c.dom.Element;
+
+public class EncodedBodyBuilderTest implements LocationConstants {
+	
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+
+	@Test
+	public void testSimpleCase() throws Exception {
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-rpcencoded.wsdl"), "countString");
+		
+		assertTrue("Wrong type of builder created",builder instanceof EncodedBodyBuilder);
+		
+		inputMap.put("str", "Roger Ramjet");
+		SOAPElement body = builder.build(inputMap);
+                
+                Iterator<SOAPElement> children = body.getChildElements();
+                
+                assertTrue("empty body content", children.hasNext());
+                
+                SOAPElement child = children.next();
+                
+                assertTrue("wrong body content (must be '{}str')", "str".equals(child.getLocalName()) && child.getNamespaceURI() == null);
+                
+                String type = child.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+                assertNotNull("missing xsi:type", type);
+                assertTrue("wrong xsi:type", "xsd:string".equals(type));
+                assertTrue("wrong text value", "Roger Ramjet".equals(child.getTextContent()));
+	}
+	
+	@Test
+	public void testStringArray() throws Exception {
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-rpcencoded.wsdl"), "countStringArray");
+		
+		assertTrue("Wrong type of builder created",builder instanceof EncodedBodyBuilder);
+		List<String> array = new ArrayList<String>();
+		array.add("one");
+		array.add("two");
+		array.add("three");
+		inputMap.put("array", array);
+		SOAPElement body = builder.build(inputMap);
+                
+                Iterator<SOAPElement> children = body.getChildElements();
+                assertTrue("missing body element", children.hasNext());
+                SOAPElement child = children.next();
+                assertTrue("wrong body element (must be '{}array')", "array".equals(child.getLocalName()) && child.getNamespaceURI() == null);
+                String type = child.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+                assertNotNull("missing xsi:type", type);
+                assertTrue("wrong xsi:type", "soapenc:Array".equals(type));
+
+                Iterator<Element> elements = child.getChildElements();
+                for (int i = 0, n = array.size(); i < n; i++) {
+                    assertTrue("missing array element", elements.hasNext());
+                    Element element = elements.next();
+                    assertTrue("wrong array element (must be '{}string')", "string".equals(element.getLocalName()) && element.getNamespaceURI() == null);
+                    assertTrue("wrong array text content", array.get(i).equals(element.getTextContent()));
+                }
+	}
+	
+	@Test
+	public void testComplexType() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-rpcencoded.wsdl"), "personToString");
+		
+		assertTrue("Wrong type of builder created",builder instanceof EncodedBodyBuilder);
+		
+		String p = "<Person xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><name xsi:type=\"xsd:string\">bob</name><age xsi:type=\"xsd:int\">12</age></Person>";
+		
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		
+		inputMap.put("p",p);
+		SOAPElement body = builder.build(inputMap);
+		
+                Iterator<SOAPElement> persons = body.getChildElements(new QName("", "p"));
+                
+                assertTrue("'Person' tag is missing", persons.hasNext());
+                SOAPElement person = persons.next();
+                assertFalse("more than one 'Person' tag found", persons.hasNext());
+                
+                String personType = person.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+                assertNotNull("type definition of Person is missing", personType);
+                assertTrue("wrong xsi:type for the 'Person' tag", "ns1:Person".equals(personType));
+
+                assertTrue("wrong type definition for Person", "ns1:Person".equals(personType));
+
+                Iterator<SOAPElement> names = person.getChildElements(new QName("", "name"));
+                
+                assertTrue("'name' tag is missing", names.hasNext());
+                SOAPElement name = names.next();
+                assertFalse("More than one 'name' tag found", names.hasNext());
+
+                String nameType = name.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+                assertNotNull("type definition of name is missing", nameType);
+                assertTrue("wrong name's xsi:type", "xsd:string".equals(nameType));
+                assertTrue("wrong 'name' tag value (must be 'bob')", "bob".equals(name.getTextContent()));
+
+                Iterator<SOAPElement> ages = person.getChildElements(new QName("", "age"));
+                
+                assertTrue("'age' tag is missing", ages.hasNext());
+                SOAPElement age = ages.next();
+                assertFalse("more than one 'age' tag found", ages.hasNext());
+
+                String ageType = age.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+                assertNotNull("missing type definition for the 'age' tag", ageType);
+                assertTrue("wrong xsi:type for 'age' tag", "xsd:int".equals(ageType));
+                assertTrue("wrong 'age' tag value (must be 12)", "12".equals(age.getTextContent()));
+	}
+	
+	protected BodyBuilder createBuilder(String wsdl, String operation) throws Exception {
+		WSDLParser parser = new WSDLParser(wsdl);
+		
+		return BodyBuilderFactory.instance().create(parser, operation, parser.getOperationInputParameters(operation));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/LiteralBodyBuilderTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/LiteralBodyBuilderTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/LiteralBodyBuilderTest.java
new file mode 100644
index 0000000..b3d16ae
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/LiteralBodyBuilderTest.java
@@ -0,0 +1,181 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+
+import org.junit.Test;
+import org.w3c.dom.Node;
+
+public class LiteralBodyBuilderTest implements LocationConstants{
+	
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+
+	@Test
+	public void testUnqualifiedNamespaces() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("whatizit.wsdl"), "queryPmid");
+		
+		assertTrue("Is is the wrong type, it should be LiteralBodyBuilder",builder instanceof LiteralBodyBuilder);
+		
+		String parameters = "<parameters xmlns=\"http://www.ebi.ac.uk/webservices/whatizit/ws\"><pipelineName xmlns=\"\">swissProt</pipelineName><pmid xmlns=\"\">1234</pmid></parameters>";
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("parameters", parameters);
+		
+		SOAPElement body = builder.build(inputMap);
+	
+                assertTrue("Wrong wrapping element name", "queryPmid".equals(body.getLocalName()) && "http://www.ebi.ac.uk/webservices/whatizit/ws".equals(body.getNamespaceURI()));
+
+                Iterator<Node> pipelineNames = body.getChildElements(new QName("","pipelineName"));
+                
+                assertTrue("No pipelineName defined", pipelineNames.hasNext());
+                assertTrue("Wrong pipelineName value (must be 'swissProt')", "swissProt".equals(pipelineNames.next().getTextContent()));
+                
+                Iterator<Node> pmids = body.getChildElements(new QName("","pmid"));
+
+                assertTrue("No pmid defined", pmids.hasNext());
+                assertTrue("Wrong pmid value (must be '1234')", "1234".equals(pmids.next().getTextContent()));
+	}
+	
+	@Test
+	public void testQualifiedUnwrapped() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-unwrapped.wsdl"), "countString");
+		
+		assertTrue("Is is the wrong type, it should be LiteralBodyBuilder",builder instanceof LiteralBodyBuilder);
+		Map<String,Object>inputMap = new HashMap<String, Object>();
+		inputMap.put("str", "bob");
+		
+                SOAPElement body = builder.build(inputMap);
+		
+                assertEquals("Wrong localName","str", body.getLocalName());
+                assertEquals("XML should containe qualifed namespace for str","http://testing.org", body.getNamespaceURI());
+	}
+	
+	@Test
+	public void testUnwrappedSimple() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-unwrapped.wsdl"), "countString");
+		
+		assertTrue("Wrong type of builder, it should be Literal based",builder instanceof LiteralBodyBuilder);
+		
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("str", "12345");
+		
+		SOAPElement body = builder.build(inputMap);
+		
+                assertTrue("Input element should be named {http://testing.org}str ", "str".equals(body.getLocalName()) && "http://testing.org".equals(body.getNamespaceURI()));
+
+		assertEquals("Value should be 12345:","12345",body.getFirstChild().getNodeValue());
+	}
+	
+	@Test
+	public void testUnwrappedArray() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-unwrapped.wsdl"), "countStringArray");
+		
+		assertTrue("Wrong type of builder, it should be Literal based",builder instanceof LiteralBodyBuilder);
+		
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("array", "<array><item>1</item><item>2</item><item>3</item></array>");
+		
+		SOAPElement body = builder.build(inputMap);
+		
+                assertTrue("Outer element should be named {http://testing.org}array ", "array".equals(body.getLocalName()) && "http://testing.org".equals(body.getNamespaceURI()));
+                
+                assertTrue("There must be three child nodes in array", body.getChildNodes().getLength() == 3);
+
+                Iterator<Node> items = body.getChildElements(new QName("", "item"));
+                assertTrue("Array element should be named item", items.hasNext());
+                
+                assertTrue("First Array element should have the value '1'", "1".equals(items.next().getTextContent()));
+	}
+	
+	@Test 
+	public void testOperationElementNameEUtils() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("eutils/eutils_lite.wsdl"), "run_eInfo");
+
+		assertTrue("Wrong type of builder, it should be Literal based",builder instanceof LiteralBodyBuilder);
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("parameters",
+		// Note: Don't use xmlns="" as it would also affect <parameters>
+				// - which should not affect the namespace of the soap body
+				// element. The element qname of the SOAPBodyElement should be
+				// determined by the schema only
+				"<parameters xmlns:e='http://www.ncbi.nlm.nih.gov/soap/eutils/einfo'>"
+						+ "<e:db>database</e:db>" + "<e:tool>myTool</e:tool>"
+						+ "<e:email>nobody@nowhere.net</e:email>"
+						+ "</parameters>");
+		SOAPElement body = builder.build(inputMap);
+		assertEquals("QName of SOAP body's element did not match expected qname ", 
+				new QName("http://www.ncbi.nlm.nih.gov/soap/eutils/einfo", "eInfoRequest"), 
+				body.getElementQName());
+	}
+	
+	@Test 
+	public void testOperationElementNameTAV744() throws Exception {
+		URL tav744Url = getClass().getResource(
+				"/org/apache/taverna/wsdl/parser/TAV-744/InstrumentService__.wsdl");
+		
+		BodyBuilder builder = createBuilder(tav744Url.toExternalForm(), "getList");
+
+		assertTrue("Wrong type of builder, it should be Literal based",builder instanceof LiteralBodyBuilder);
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		// No inputs
+		SOAPElement body = builder.build(inputMap);
+		assertEquals("QName of SOAP body's element did not match expected qname ", 
+				new QName("http://InstrumentService.uniparthenope.it/InstrumentService", "GetListRequest"), 
+				body.getElementQName());
+	}
+	
+	@Test
+	public void testRPCLiteral() throws Exception {
+		BodyBuilder builder = createBuilder(wsdlResourcePath("MyService-rpc-literal.wsdl"), "countString");
+		
+		assertTrue("Wrong type of builder, it should be Literal based",builder instanceof LiteralBodyBuilder);
+		
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("str", "abcdef");
+		
+		SOAPElement body = builder.build(inputMap);
+		
+		assertTrue("Outer element should be named {http://testing.org}countString","countString".equals(body.getLocalName()) && "http://testing.org".equals(body.getNamespaceURI()));
+                
+		Node strNode = body.getFirstChild();
+		assertEquals("Inner element should be called 'str'","str",strNode.getNodeName());
+		assertEquals("str content should be abcdef","abcdef",strNode.getFirstChild().getNodeValue());
+	}
+	
+	protected BodyBuilder createBuilder(String wsdl, String operation) throws Exception {
+		WSDLParser parser = new WSDLParser(wsdl);
+		return BodyBuilderFactory.instance().create(parser, operation, parser.getOperationInputParameters(operation));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseEncodedTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseEncodedTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseEncodedTest.java
new file mode 100644
index 0000000..d7ddd93
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseEncodedTest.java
@@ -0,0 +1,82 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFactory;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+public class SOAPResponseEncodedTest  implements LocationConstants {
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+	
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testSimpleRPC() throws Exception {
+		
+		WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("ma.wsdl"));
+
+		String xml1 = "<ns1:whatGeneInStageResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"urn:hgu.webservice.services\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><whatGeneInStageReturn soapenc:arrayType=\"ns2:GeneExpressedQueryShortDetails[0]\" xsi:type=\"soapenc:Array\" xmlns:ns2=\"http://SubmissionQuery.WSDLGenerated.hgu\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><agene xsi:type=\"string\">a gene</agene></whatGeneInStageReturn></ns1:whatGeneInStageResponse>";
+
+		List<SOAPElement> response = new ArrayList<SOAPElement>();
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml1)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		SOAPResponseEncodedParser parser = new SOAPResponseEncodedParser(wsdlParser.getOperationOutputParameters("whatGeneInStage"));
+		parser.setStripAttributes(true);
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object result = outputMap.get("whatGeneInStageReturn");
+
+		assertNotNull(
+				"output map should have contained entry for 'whatGeneInStageReturn'",
+				result);
+
+		assertEquals("output data should be a string", String.class, result.getClass());
+
+		assertEquals(
+				"incorrect xml content in output",
+				"<whatGeneInStageReturn><agene>a gene</agene></whatGeneInStageReturn>",
+				result.toString());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseLiteralTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseLiteralTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseLiteralTest.java
new file mode 100644
index 0000000..2e714ce
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseLiteralTest.java
@@ -0,0 +1,160 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.SOAPFactory;
+import org.apache.taverna.wsdl.parser.BaseTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+public class SOAPResponseLiteralTest{
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testLiteralParserResultInTextBlock() throws Exception {
+		List response = new ArrayList();
+		String xml = "<testResponse><out>&lt;data name=&quot;a&quot;&gt;some data&lt;/data&gt;&lt;data name=&quot;b&quot;&gt;some more data&lt;/data&gt;</out></testResponse>";
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml)));
+
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		TypeDescriptor descriptor = new ComplexTypeDescriptor();
+		descriptor.setName("testResponse");
+
+		SOAPResponseLiteralParser parser = new SOAPResponseLiteralParser(
+				Collections.singletonList(descriptor));
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object testResponse = outputMap.get("testResponse");
+
+		assertNotNull("there should be an output named 'testReponse'",
+				testResponse);
+		assertEquals("output data should be a string", String.class,
+				testResponse.getClass());
+
+		assertEquals(
+				"xml is wrong",
+				"<testResponse><out>&lt;data name=\"a\"&gt;some data&lt;/data&gt;&lt;data name=\"b\"&gt;some more data&lt;/data&gt;</out></testResponse>",
+				testResponse.toString());
+	}
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testLiteralParser() throws Exception {
+		List response = new ArrayList();
+		String xml = "<testResponse><out><data name=\"a\">some data</data><data name=\"b\">some more data</data></out></testResponse>";
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml)));
+                response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		TypeDescriptor descriptor = new ComplexTypeDescriptor();
+		descriptor.setName("testResponse");
+
+		SOAPResponseLiteralParser parser = new SOAPResponseLiteralParser(
+				Collections.singletonList(descriptor));
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object testResponse = outputMap.get("testResponse");
+
+		assertNotNull("there should be an output named 'testReponse'",
+				testResponse);
+		assertEquals("output data should be a string", String.class,
+				testResponse.getClass());
+
+		assertEquals(
+				"xml is wrong",
+				"<testResponse><out><data name=\"a\">some data</data><data name=\"b\">some more data</data></out></testResponse>",
+				testResponse.toString());
+	}
+	
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testUnwrappedLiteralResponseParsing() throws Exception {
+		List response = new ArrayList();
+		
+		String xml = "<getStringReturn xmlns=\"http://testing.org\">a string</getStringReturn>";
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml)));
+
+                response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		TypeDescriptor descriptor = new BaseTypeDescriptor();
+		descriptor.setName("getStringReturn");
+		
+		SOAPResponseLiteralParser parser = new SOAPResponsePrimitiveLiteralParser(
+				Collections.singletonList(descriptor));
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object stringReturn = outputMap.get("getStringReturn");
+		
+		assertEquals("value of data returned is wrong","a string",stringReturn.toString());
+	}
+	
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testEmptyResponse() throws Exception {
+		List response = new ArrayList();
+		
+		TypeDescriptor descriptor = new BaseTypeDescriptor();
+		descriptor.setName("getStringReturn");
+		
+		SOAPResponseLiteralParser parser = new SOAPResponseLiteralParser(
+				Collections.singletonList(descriptor));
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+		assertEquals("map should contain 1 element", 0, outputMap.size());
+	}
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseMultiRefTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseMultiRefTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseMultiRefTest.java
new file mode 100644
index 0000000..dde12c4
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseMultiRefTest.java
@@ -0,0 +1,238 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.SOAPFactory;
+
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+public class SOAPResponseMultiRefTest  implements LocationConstants {
+	
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testMultiRef() throws Exception {
+		WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("TestServices-rpcencoded.wsdl"));
+
+		List response = new ArrayList();
+
+		String xml1 = "<ns1:getPersonResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"urn:testing\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><getPersonReturn href=\"#id0\"/></ns1:getPersonResponse>";
+		String xml2 = "<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><age xsi:type=\"soapenc:string\">5</age><name xsi:type=\"soapenc:string\">bob</name></multiRef>";
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml1)));
+
+                response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+                doc = builder.parse(new InputSource(new StringReader(xml2)));
+                response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		SOAPResponseEncodedMultiRefParser parser = new SOAPResponseEncodedMultiRefParser(
+				wsdlParser.getOperationOutputParameters("getPerson"));
+		parser.setStripAttributes(true);
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object getPersonReturn =  outputMap
+				.get("getPersonReturn");
+
+		assertNotNull(
+				"output map should have contained entry for 'getPersonReturn'",
+				getPersonReturn);
+
+		assertEquals("output data should be a string", String.class,
+				getPersonReturn.getClass());
+
+		assertEquals(
+				"unexpected xml content in output",
+				"<getPersonReturn><age>5</age><name>bob</name></getPersonReturn>",
+				getPersonReturn.toString());
+
+	}
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testMultiRefReturnNamespaced() throws Exception {
+		WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("TestServices-rpcencoded.wsdl"));
+
+		List response = new ArrayList();
+
+		String xml1 = "<ns1:getPersonResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"urn:testing\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><ns1:getPersonReturn xmlns:ns1=\"urn:testing\" href=\"#id0\"/></ns1:getPersonResponse>";
+		String xml2 = "<multiRef id=\"id0\" soapenc:root=\"0\" soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><age xsi:type=\"soapenc:string\">5</age><name xsi:type=\"soapenc:string\">bob</name></multiRef>";
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml1)));
+
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+                doc = builder.parse(new InputSource(new StringReader(xml2)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		SOAPResponseEncodedMultiRefParser parser = new SOAPResponseEncodedMultiRefParser(
+				wsdlParser.getOperationOutputParameters("getPerson"));
+		parser.setStripAttributes(true);
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object getPersonReturn = outputMap
+				.get("getPersonReturn");
+
+		assertNotNull(
+				"output map should have contained entry for 'getPersonReturn'",
+				getPersonReturn);
+
+		assertEquals("output data should be a string", String.class,
+				getPersonReturn.getClass());
+
+		assertEquals(
+				"unexpected xml content in output",
+				"<getPersonReturn><age>5</age><name>bob</name></getPersonReturn>",
+				getPersonReturn.toString());
+	}
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testNestedReferences() throws Exception {
+	
+		//only the name is important.
+		TypeDescriptor descriptor = new ComplexTypeDescriptor();
+		descriptor.setName("result");
+		SOAPResponseEncodedMultiRefParser parser = new SOAPResponseEncodedMultiRefParser(
+				Collections.singletonList(descriptor));
+	
+
+		String xml1 = "<response><result><creatures href=\"#id0\"/></result></response>";
+		String xml2 = "<multiref id=\"id0\"><item href=\"#id1\"/><item href=\"#id2\"/></multiref>";
+		String xml3 = "<multiref id=\"id1\"><creature>monkey</creature></multiref>";
+		String xml4 = "<multiref id=\"id2\"><creature>frog</creature></multiref>";
+
+		List response = new ArrayList();
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml1)));
+
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+                doc = builder.parse(new InputSource(new StringReader(xml2)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+                doc = builder.parse(new InputSource(new StringReader(xml3)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+                doc = builder.parse(new InputSource(new StringReader(xml4)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		
+		parser.setStripAttributes(true);
+
+		Map outputMap = parser.parse(response);
+
+		assertNotNull("no output map returned", outputMap);
+
+		assertEquals("map should contain 1 element", 1, outputMap.size());
+
+		Object result = outputMap.get("result");
+
+		assertNotNull("output map should have contained entry for 'result'",
+				result);
+
+		assertEquals("output data should be a string", String.class, result
+				.getClass());
+
+		assertEquals(
+				"incorrect xml content in output",
+				"<result><creatures><item><creature>monkey</creature></item><item><creature>frog</creature></item></creatures></result>",
+				result.toString());
+
+	}
+
+	@SuppressWarnings("unchecked")
+	@Test
+	public void testFailOnCyclic() throws Exception {
+		List outputNames = new ArrayList();
+		outputNames.add("attachmentList");
+		outputNames.add("result");
+
+		String xml1 = "<response><result><item href=\"#id0\"/></result></response>";
+		String xml2 = "<multiref id=\"id0\"><item href=\"#id1\"/></multiref>";
+		String xml3 = "<multiref id=\"id1\"><item href=\"#id0\"/></multiref>";
+
+		List response = new ArrayList();
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		Document doc = builder.parse(new InputSource(new StringReader(xml1)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		doc = builder.parse(new InputSource(new StringReader(xml2)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		doc = builder.parse(new InputSource(new StringReader(xml3)));
+		response.add(SOAPFactory.newInstance().createElement(doc.getDocumentElement()));
+
+		SOAPResponseEncodedMultiRefParser parser = new SOAPResponseEncodedMultiRefParser(
+				outputNames);
+		parser.setStripAttributes(true);
+
+		try {
+			parser.parse(response);
+			fail("CyclicReferenceException should have been thrown");
+		} catch (CyclicReferenceException e) {
+
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseParserFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseParserFactoryTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseParserFactoryTest.java
new file mode 100644
index 0000000..c3794c6
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/soap/SOAPResponseParserFactoryTest.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.soap;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+
+import org.junit.Test;
+
+public class SOAPResponseParserFactoryTest  implements LocationConstants {
+	
+	private String wsdlResourcePath(String wsdlName) throws Exception {
+		return WSDLTestHelper.wsdlResourcePath(wsdlName);
+	}
+
+	//tests that the factory always returns a SOAPResponseLiteralParser regardless of the 
+	//output mime type, if the use is set to 'literal' (unwrapped/literal)
+	@Test
+	public void testLiteralUnwrappedParserForNonXMLOutput() throws Exception {
+		SOAPResponseParserFactory factory = SOAPResponseParserFactory.instance();
+		List<String> response = new ArrayList<String>();
+		WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("TestServices-unwrapped.wsdl"));
+		
+		SOAPResponseParser parser = factory.create(response, "literal", "document", wsdlParser.getOperationOutputParameters("getString"));
+		
+		assertTrue("The parser is the wrong type, it was:"+parser.getClass().getSimpleName(),parser instanceof SOAPResponsePrimitiveLiteralParser);
+	}
+	
+	//an additional test using another unwrapped/literal wsdl that returns a primative type
+	@Test
+	public void testLiteralUnwrappedAlternativeWSDL() throws Exception {
+		SOAPResponseParserFactory factory = SOAPResponseParserFactory.instance();
+		List<String> response = new ArrayList<String>();
+		WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("prodoric.wsdl"));
+		
+		SOAPResponseParser parser = factory.create(response, "literal", "document", wsdlParser.getOperationOutputParameters("hello"));
+		
+		assertTrue("The parser is the wrong type, it was:"+parser.getClass().getSimpleName(),parser instanceof SOAPResponsePrimitiveLiteralParser);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/LocationConstants.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/LocationConstants.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/LocationConstants.java
new file mode 100644
index 0000000..4d3f191
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/LocationConstants.java
@@ -0,0 +1,31 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.testutils;
+
+/**
+ * A definition of constants for base locations of external resources used for testing.
+ * 
+ * @author Stuart Owen
+ *
+ */
+public interface LocationConstants {
+	
+	public static final String WSDL_RESOURCE_BASE="/testwsdls/";
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/WSDLTestHelper.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/WSDLTestHelper.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/WSDLTestHelper.java
new file mode 100644
index 0000000..58c039e
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/testutils/WSDLTestHelper.java
@@ -0,0 +1,50 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.testutils;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import org.apache.taverna.wsdl.parser.WSDLParserTest;
+
+public class WSDLTestHelper implements LocationConstants {
+	
+	public static String wsdlResourcePath(String resourceName) throws Exception {
+		return WSDLParserTest.class.getResource(WSDL_RESOURCE_BASE+resourceName).toExternalForm();
+	}
+
+    public String getResourceContentsString(String resourceName) throws Exception {
+		InputStream stream = WSDLTestHelper.class.getResourceAsStream("/"+resourceName);
+		BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+		String content="";
+		String line="";
+		while( (line = reader.readLine()) != null) {
+			content+=line;
+		}
+
+		reader.close();
+
+		return content;
+
+	}
+
+    
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLInputSplitterTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLInputSplitterTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLInputSplitterTest.java
new file mode 100644
index 0000000..4d856eb
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLInputSplitterTest.java
@@ -0,0 +1,93 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.LocationConstants;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+
+import org.junit.Test;
+
+public class XMLInputSplitterTest implements LocationConstants {
+
+	@Test
+	public void testExecute() throws Exception {
+		WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("eutils/eutils_lite.wsdl"));
+		TypeDescriptor descriptor = parser.getOperationInputParameters("run_eInfo").get(0);
+		XMLInputSplitter splitter = new XMLInputSplitter(descriptor,new String[]{"db","tool","email"},new String[]{"text/plain","text/plain","text/plain"},new String[]{"output"});
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		inputMap.put("db", "pubmed");
+		inputMap.put("email", "bob.monkhouse@itv.com");
+		Map<String,String> outputMap = splitter.execute(inputMap);
+		assertNotNull("there should be an output named 'output'",outputMap.containsKey("output"));
+		String xml = outputMap.get("output");
+		assertTrue(xml.startsWith("<parameters xmlns=\"http://www.ncbi.nlm.nih.gov/soap/eutils/einfo\">"));
+		assertTrue(xml.contains("<db>pubmed</db>"));
+		assertTrue(! xml.contains("<tool"));
+		assertTrue(xml.contains("<email>bob.monkhouse@itv.com</email>"));
+	} 
+	
+	
+	@Test
+	public void testOptional() throws Exception {
+		WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("VSOi.wsdl"));
+		TypeDescriptor descriptor = parser.getOperationInputParameters("Query").get(0);
+		XMLInputSplitter splitter = new XMLInputSplitter(descriptor,new String[]{"version","block"},new String[]{"text/plain","text/plain"},new String[]{"output"});
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		// connect none of the inputs
+		Map<String,String> outputMap = splitter.execute(inputMap);
+		assertNotNull("there should be an output named 'output'",outputMap.containsKey("output"));
+		String xml = outputMap.get("output");
+		// empty string as <block> as it is not nillable
+		assertTrue(xml.contains("<block xmlns=\"\"></block>"));
+		// minOccurs=0 - so it should not be there
+		assertTrue(! xml.contains("<version>"));
+	} 
+	
+	
+	@Test
+	public void testNillable() throws Exception {
+		WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("VSOi.wsdl"));
+		TypeDescriptor descriptor = parser.getOperationInputParameters("Query").get(0);
+		XMLInputSplitter splitter = new XMLInputSplitter(descriptor,new String[]{"version","block"},new String[]{"text/plain","text/plain"},new String[]{"output"});
+		Map<String,Object> inputMap = new HashMap<String, Object>();
+		// Magic string meaning insert xsi:nil=true
+		inputMap.put("version", "xsi:nil");
+		Map<String,String> outputMap = splitter.execute(inputMap);
+		assertNotNull("there should be an output named 'output'",outputMap.containsKey("output"));
+		String xml = outputMap.get("output");
+		System.out.println(xml);
+		// empty string as <block> as it is not nillable
+		assertTrue(xml.contains("<block xmlns=\"\"></block>"));
+		// FIXME: Should not really allow nil=true here, as version is not nillable! 
+		assertTrue(xml.contains("<version xmlns=\"\" " +
+				"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
+				"xsi:nil=\"true\" />"));
+	} 
+	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitterTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitterTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitterTest.java
new file mode 100644
index 0000000..9c3c483
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitterTest.java
@@ -0,0 +1,93 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.xmlsplitter;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.testutils.WSDLTestHelper;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author sowen
+ */
+public class XMLOutputSplitterTest extends WSDLTestHelper {
+
+    @Test
+	public void testRPCComplexWithInternalList() throws Exception {
+            
+        WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("menagerie-complex-rpc.wsdl"));
+		TypeDescriptor descriptor = parser.getOperationOutputParameters("getComplexWithInternalList").get(0);
+        XMLOutputSplitter splitter = new XMLOutputSplitter(descriptor, new String [] {"length","innerArray","innerList"}, new String [] {"text/plain","l('text/plain')","l('text/plain')"}, new String[] {"input"});
+        String inputXML=getResourceContentsString("getComplexWithInternalListResponse.xml");
+        Map<String,String> inputMap = new HashMap<String,String>();
+        inputMap.put("input", inputXML);
+        Map<String,Object> outputMap = splitter.execute(inputMap);
+        assertNotNull(outputMap.get("length"));
+        assertNotNull(outputMap.get("innerList"));
+        assertNotNull(outputMap.get("innerArray"));
+
+        assertEquals("4",outputMap.get("length"));
+
+        List<String> array = ( List<String> )outputMap.get("innerArray");
+		assertEquals(4,array.size());
+		assertEquals("String A",array.get(0));
+		assertEquals("String B",array.get(1));
+		assertEquals("String C",array.get(2));
+		assertEquals("String D",array.get(3));
+
+        array = ( List<String> )outputMap.get("innerList");
+		assertEquals(4,array.size());
+		assertEquals("String A",array.get(0));
+		assertEquals("String B",array.get(1));
+		assertEquals("String C",array.get(2));
+		assertEquals("String D",array.get(3));
+    }
+
+    @Test
+    public void testWrappedArrayDefinedWithRestriction() throws Exception {
+        WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("jws-online.wsdl"));
+		TypeDescriptor descriptor = parser.getOperationOutputParameters("getSteadyStateTable").get(0);
+        XMLOutputSplitter splitter = new XMLOutputSplitter(descriptor, new String [] {"model","fluxNames","fluxVals"}, new String [] {"text/plain","l('text/plain')","l('text/plain')"}, new String[] {"input"});
+        String inputXML=getResourceContentsString("jws-splitter-input.xml");
+
+        Map<String,String> inputMap = new HashMap<String,String>();
+        inputMap.put("input", inputXML);
+        Map<String,Object> outputMap = splitter.execute(inputMap);
+
+        assertNotNull(outputMap.get("model"));
+        assertNotNull(outputMap.get("fluxNames"));
+        assertNotNull(outputMap.get("fluxVals"));
+
+        assertEquals("teusink",outputMap.get("model"));
+        List<String> array = ( List<String> )outputMap.get("fluxNames");
+        assertEquals(17,array.size());
+        assert(array.contains("v[G3PDH]"));
+
+        array = ( List<String> )outputMap.get("fluxVals");
+        assertEquals(17,array.size());
+        assert(array.contains("88.15049285974906"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLSplitterSerialisationHelperTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLSplitterSerialisationHelperTest.java b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLSplitterSerialisationHelperTest.java
new file mode 100644
index 0000000..7c63297
--- /dev/null
+++ b/taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLSplitterSerialisationHelperTest.java
@@ -0,0 +1,141 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringReader;
+import java.util.List;
+
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+
+//import org.embl.ebi.escience.scufl.XScufl;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.jdom.output.XMLOutputter;
+import org.junit.Test;
+
+public class XMLSplitterSerialisationHelperTest {
+
+//	@Test
+//	public void testScuflNS() throws Exception {
+//		assertEquals("namespace should be equal",XScufl.XScuflNS,XMLSplitterSerialisationHelper.XScuflNS);
+//	}
+
+    @Test
+	public void testCyclicToElement() throws Exception {
+		ComplexTypeDescriptor a = new ComplexTypeDescriptor();
+		a.setName("a");
+		a.setType("typename");
+		a.setQnameFromString("{namespace}typename");
+
+		ComplexTypeDescriptor b = new ComplexTypeDescriptor();
+		b.setName("b");
+		b.setType("typename2");
+		b.setQnameFromString("{namespace}typename2");
+
+		a.getElements().add(b);
+
+		b.getElements().add(a);
+
+		Element el = XMLSplitterSerialisationHelper
+				.typeDescriptorToExtensionXML(a);
+
+		String xml = new XMLOutputter().outputString(el);
+
+		assertEquals(
+				"unexpected xml",
+				"<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" qname=\"{namespace}typename\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename2\" name=\"b\" qname=\"{namespace}typename2\"><s:elements><s:complextype id=\"{namespace}typename\" optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>",
+				xml);
+
+	}
+
+    @Test
+	public void testCyclicToElement2() throws Exception {
+		ComplexTypeDescriptor a = new ComplexTypeDescriptor();
+		a.setName("a");
+		a.setType("typename");
+		a.setQnameFromString("{namespace}typename");
+
+		a.getElements().add(a);
+
+		Element el = XMLSplitterSerialisationHelper
+				.typeDescriptorToExtensionXML(a);
+
+		String xml = new XMLOutputter().outputString(el);
+
+		assertEquals(
+				"unexpected xml",
+				"<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" qname=\"{namespace}typename\"><s:elements><s:complextype id=\"{namespace}typename\" optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" /></s:elements></s:complextype></s:extensions>",
+				xml);
+	}
+
+    @Test
+	public void testCyclicFromElement() throws Exception {
+		String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"typename\" name=\"a\" qname=\"{namespace}typename\"><s:elements><s:complextype id=\"{namespace}typename\" /></s:elements></s:complextype></s:extensions>";
+		Element el = new SAXBuilder().build(new StringReader(xml))
+				.getRootElement();
+
+		TypeDescriptor a = XMLSplitterSerialisationHelper
+				.extensionXMLToTypeDescriptor(el);
+
+		assertTrue("wrong type", a instanceof ComplexTypeDescriptor);
+		assertEquals("wrong name", "a", a.getName());
+
+		List<TypeDescriptor> a_elements = ((ComplexTypeDescriptor) a).getElements();
+
+		assertEquals("should be only 1 element", 1, a_elements.size());
+
+		TypeDescriptor b = a_elements.get(0);
+
+		assertTrue("wrong type", b instanceof ComplexTypeDescriptor);
+
+		List<TypeDescriptor> b_elements = ((ComplexTypeDescriptor) b).getElements();
+
+		assertEquals("should be only 1 element", 1, b_elements.size());
+
+		assertEquals("b should contain a reference to a", a.toString(),
+				b_elements.get(0).toString());
+	}
+
+	/**
+	 * Tests the QName is constructed with the correct URI and LocalPart
+	 * 
+	 * @throws Exception
+	 */
+    @Test
+	public void testCorrectQName() throws Exception {
+		TypeDescriptor desc = XMLSplitterSerialisationHelper
+				.extensionXMLToTypeDescriptor(new SAXBuilder().build(
+						new StringReader(eInfoXML())).getRootElement());
+		assertEquals("NamespaceURI is incorrect",
+				"http://www.ncbi.nlm.nih.gov/soap/eutils/espell", desc
+						.getQname().getNamespaceURI());
+		assertEquals("Localpart is incorrect", "eSpellRequest", desc.getQname()
+				.getLocalPart());
+	}
+
+	private String eInfoXML() {
+		return "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"eSpellRequest\" name=\"parameters\" qname=\"{http://www.ncbi.nlm.nih.gov/soap/eutils/espell}eSpellRequest\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"db\" qname=\"{http://www.w3.org/2001/XMLSchema}string\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"term\" qname=\"{http://www.w3.org/2001/XMLSchema}string\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"tool\" qname=\"{http://www.w3.org/2001/XMLSchema}string\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"email\" qname=\"{http://www.w3.org/2001/XMLSchema}string\" /></s:elements></s:complextype></s:extensions>";
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceContextTypes.xsd
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceContextTypes.xsd b/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceContextTypes.xsd
deleted file mode 100644
index bca9ad9..0000000
--- a/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceContextTypes.xsd
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://InstrumentService.uniparthenope.it/InstrumentService/Context/types" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:tns="http://InstrumentService.uniparthenope.it/InstrumentService/Context/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsrbf="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd">
-  <import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="WS-Addressing.xsd"/>
-  <import namespace="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd" schemaLocation="WS-BaseFaults.xsd"/>
-  <element name="InstrumentServiceContextReference">
-    <complexType>
-      <sequence>
-        <element ref="wsa:EndpointReference"/>
-      </sequence>
-    </complexType>
-  </element>
-</schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceTypes.xsd
----------------------------------------------------------------------
diff --git a/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceTypes.xsd b/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceTypes.xsd
deleted file mode 100644
index 3118190..0000000
--- a/taverna-wsdl-generic/src/test/resources/net/sf/taverna/wsdl/parser/TAV-744/InstrumentServiceTypes.xsd
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://InstrumentService.uniparthenope.it/InstrumentService/types" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:tns="http://InstrumentService.uniparthenope.it/InstrumentService/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsrbf="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd">
-  <import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="WS-Addressing.xsd"/>
-  <import namespace="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd" schemaLocation="WS-BaseFaults.xsd"/>
-  <element name="InstrumentServiceReference">
-    <complexType>
-      <sequence>
-        <element ref="wsa:EndpointReference"/>
-      </sequence>
-    </complexType>
-  </element>
-</schema>
\ No newline at end of file