You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/06/29 05:26:03 UTC

svn commit: r202311 - in /webservices/axis/trunk/java/modules/wsdl: test-resources/InteropTestDocLit2.wsdl test/org/apache/wsdl/SOAPActionTest.java

Author: chathura
Date: Tue Jun 28 20:26:01 2005
New Revision: 202311

URL: http://svn.apache.org/viewcvs?rev=202311&view=rev
Log:
A test case added to test the SOAPAction properly handled in the WOM.

Added:
    webservices/axis/trunk/java/modules/wsdl/test-resources/InteropTestDocLit2.wsdl
    webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java

Added: webservices/axis/trunk/java/modules/wsdl/test-resources/InteropTestDocLit2.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test-resources/InteropTestDocLit2.wsdl?rev=202311&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test-resources/InteropTestDocLit2.wsdl (added)
+++ webservices/axis/trunk/java/modules/wsdl/test-resources/InteropTestDocLit2.wsdl Tue Jun 28 20:26:01 2005
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="WSDLInteropTestDocLitService" 
+    targetNamespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://soapinterop.org/WSDLInteropTestDocLit" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:xsd1="http://soapinterop.org/xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <types>
+        <schema targetNamespace="http://soapinterop.org/xsd"
+            xmlns="http://www.w3.org/2001/XMLSchema" 
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+            elementFormDefault="qualified">
+            <complexType name="ArrayOfstring_literal">
+                <sequence>
+                    <element maxOccurs="unbounded" minOccurs="1" name="string" type="xsd:string"/>
+                </sequence>
+            </complexType>
+	    <complexType name="SOAPStruct">
+                <all>
+                    <element name="varFloat" type="xsd:float"/>
+                    <element name="varInt" type="xsd:int"/>
+                    <element name="varString" type="xsd:string"/>
+                </all>
+            </complexType>
+  
+            <element name="echoStringParam" type="xsd:string"/>
+         
+            <element name="echoStringReturn" type="xsd:string"/>
+            <element name="echoStringArrayParam" type="xsd1:ArrayOfstring_literal"/>
+                
+            <element name="echoStringArrayReturn" type="xsd1:ArrayOfstring_literal"/>
+               
+            <element name="echoStructParam" type="xsd1:SOAPStruct"/>
+                   
+            <element name="echoStructReturn" type="xsd1:SOAPStruct"/>
+        </schema>
+    </types>
+    <message name="echoString">
+        <part element="xsd1:echoStringParam" name="a"/>
+    </message>
+    <message name="echoStringResponse">
+        <part element="xsd1:echoStringReturn" name="result"/>
+    </message>
+    <message name="echoStringArray">
+        <part element="xsd1:echoStringArrayParam" name="a"/>
+    </message>
+    <message name="echoStringArrayResponse">
+        <part element="xsd1:echoStringArrayReturn" name="result"/>
+    </message>
+    <message name="echoStruct">
+        <part element="xsd1:echoStructParam" name="a"/>
+    </message>
+    <message name="echoStructResponse">
+        <part element="xsd1:echoStructReturn" name="result"/>
+    </message>
+    <message name="echoVoid"/>
+    <message name="echoVoidResponse"/>
+
+    <portType name="WSDLInteropTestDocLitPortType">
+        <operation name="echoString">
+            <input message="tns:echoString" name="echoString"/>
+            <output message="tns:echoStringResponse" name="echoStringResponse"/>
+        </operation>
+        <operation name="echoStringArray">
+            <input message="tns:echoStringArray" name="echoStringArray"/>
+            <output message="tns:echoStringArrayResponse" name="echoStringArrayResponse"/>
+        </operation>
+        <operation name="echoStruct">
+            <input message="tns:echoStruct" name="echoStruct"/>
+            <output message="tns:echoStructResponse" name="echoStructResponse"/>
+        </operation>
+        <operation name="echoVoid">
+            <input message="tns:echoVoid" name="echoVoid"/>
+            <output message="tns:echoVoidResponse" name="echoVoidResponse"/>
+        </operation>
+    </portType>
+    <binding name="WSDLInteropTestDocLitPortBinding" 
+        type="tns:WSDLInteropTestDocLitPortType">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="echoString">
+            <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+            <input name="echoString">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </input>
+            <output name="echoStringResponse">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </output>
+        </operation>
+        <operation name="echoStringArray">
+            <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+            <input name="echoStringArray">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </input>
+            <output name="echoStringArrayResponse">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </output>
+        </operation>
+        <operation name="echoStruct">
+            <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+            <input name="echoStruct">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </input>
+            <output name="echoStructResponse">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </output>
+        </operation>
+        <operation name="echoVoid">
+            <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+            <input name="echoVoid">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </input>
+            <output name="echoVoidResponse">
+                <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit" 
+                    use="literal"/>
+            </output>
+        </operation>
+    </binding>
+    <service name="WSDLInteropTestDocLitService">
+        <port binding="tns:WSDLInteropTestDocLitPortBinding" 
+            name="WSDLInteropTestDocLitPort">
+            <soap:address 
+                location="http://mssoapinterop.org/stkv3/wsdl/interopTestDocLit.wsdl"/>
+        </port>
+    </service>
+</definitions>

Added: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java?rev=202311&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/SOAPActionTest.java Tue Jun 28 20:26:01 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.wsdl.WSDLVersionWrapper;
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+import org.apache.wsdl.extensions.ExtensionConstants;
+import org.apache.wsdl.extensions.SOAPOperation;
+
+/**
+ * @author chathura@opensource.lk
+ *  
+ */
+public class SOAPActionTest extends AbstractTestCase {
+
+	private WSDLDescription womDescription = null;
+
+	private Definition wsdl4jDefinition = null;
+
+	public SOAPActionTest(String args) {
+		super(args);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		WSDLVersionWrapper wsdlVersionWrapper = null;
+		if (null == this.womDescription) {
+			InputStream in = new FileInputStream(
+					getTestResourceFile("InteropTestDocLit2.wsdl"));
+			wsdlVersionWrapper = WOMBuilderFactory.getBuilder(
+					WOMBuilderFactory.WSDL11).build(in);
+			this.womDescription = wsdlVersionWrapper.getDescription();
+
+		}
+		if (null == wsdl4jDefinition) {
+			this.wsdl4jDefinition = wsdlVersionWrapper.getDefinition();
+		}
+	}
+
+	public void testSOAPActionPopulation() {
+		WSDLBindingOperation bindingOperation = womDescription
+				.getFirstBinding().getBindingOperation(
+						new QName(
+								"http://soapinterop.org/WSDLInteropTestDocLit",
+								"echoVoid"));
+		Iterator iterator = bindingOperation.getExtensibilityElements()
+				.iterator();
+		while (iterator.hasNext()) {
+			WSDLExtensibilityElement element = (WSDLExtensibilityElement) iterator
+					.next();
+			SOAPOperation soapOperation = null;
+			if (ExtensionConstants.SOAP_OPERATION.equals(element.getType())) {
+				soapOperation = (SOAPOperation) element;
+			}
+			if (soapOperation == null) {
+				fail();
+			} else {
+				assertEquals(soapOperation.getSoapAction(),
+						"http://soapinterop.org/");
+			}
+		}
+	}
+
+}
\ No newline at end of file