You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by nt...@apache.org on 2006/11/14 23:49:52 UTC

svn commit: r475033 - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/org/apache/axis2/jaxws/client/proxy/ test-resources/wsdl/ test/org/apache/axis2/jaxws/anytype/ test/org/apache/axis2/jaxws/anytype/META-INF/ test/org/apache/axis2/jaxws/anytyp...

Author: nthaker
Date: Tue Nov 14 14:49:51 2006
New Revision: 475033

URL: http://svn.apache.org/viewvc?view=rev&rev=475033
Log:
AXIS2-1707

Adding support for AnyTypes in WSDL schema.

Added:
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AnyType.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/AnyTypeMessagePortTypeImpl.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessagePortType.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessageService.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/maven.xml
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java

Modified: webservices/axis2/trunk/java/modules/jaxws/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/maven.xml?view=diff&rev=475033&r1=475032&r2=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Tue Nov 14 14:49:51 2006
@@ -143,7 +143,14 @@
     	    <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/resourceinjection.wsdl"/>
     	 </java>
     	
-    	 
+    	<ant:echo>Generating java from AnyType.wsdl for javabean endpoint AnyType support</ant:echo>
+    	<java classname="com.sun.tools.xjc.Driver" fork="true"> 
+    	    <jvmarg line="${maven.junit.jvmargs}"/>
+    	    <classpath refid="maven.dependency.classpath"/>
+    	    <classpath location="${compiled.classes.dir}"/>
+    	    <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AnyType.wsdl"/>
+    	 </java>
+    	 	
     	<!-- Compile the generated classes -->
     	<ant:echo>Compiling generated schema</ant:echo>
         <javac destdir="${schema.generated.classes.dir}" srcdir="${schema.generated.src.dir}">
@@ -388,6 +395,17 @@
 			   <ant:include name="org/apache/axis2/jaxws/resourceinjection/**"/>
 			</ant:fileset>
 			<ant:fileset dir="test/org/apache/axis2/jaxws/resourceinjection">
+			   <ant:include name="META-INF/**"/>
+			</ant:fileset>
+			<ant:fileset dir="target/classes">
+			   <ant:include name="org/apache/axis2/jaxws/server/**"/>
+			</ant:fileset>
+		</ant:copy>
+		<ant:copy toDir="target/test-classes/services/AnyTypeMessageService/">
+			<ant:fileset dir="target/test-classes">
+			   <ant:include name="org/apache/axis2/jaxws/anytype/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/anytype">
 			   <ant:include name="META-INF/**"/>
 			</ant:fileset>
 			<ant:fileset dir="target/classes">

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?view=diff&rev=475033&r1=475032&r2=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Tue Nov 14 14:49:51 2006
@@ -197,7 +197,8 @@
             }
 		}
 		
-		if(method.getReturnType().isAssignableFrom(Future.class)){
+		//if(method.getReturnType().isAssignableFrom(Future.class))
+		if(method.getReturnType() == Future.class){
 			if(log.isDebugEnabled()){
 				log.debug("Async Callback");
 			}
@@ -227,7 +228,8 @@
 	        return future;
 		}
 		
-		if(method.getReturnType().isAssignableFrom(Response.class)){
+		//if(method.getReturnType().isAssignableFrom(Response.class))
+		if(method.getReturnType() == Response.class){
 			if(log.isDebugEnabled()){
 				log.debug("Async Polling");
 			}

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AnyType.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AnyType.wsdl?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AnyType.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/AnyType.wsdl Tue Nov 14 14:49:51 2006
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions targetNamespace="http://anytype.test.org" 
+      xmlns:tns="http://anytype.test.org"
+      xmlns="http://schemas.xmlsoap.org/wsdl/" 
+      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+   <types>
+      <xsd:schema targetNamespace="http://anytype.test.org"
+         xmlns:ts="http://anytype.test.org/xsd"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoMessage">
+            <sequence>
+               <element name="request" type="xsd:anyType"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoMessageResponse">
+            <sequence>
+               <element name="response" type="xsd:anyType"/>
+            </sequence>
+         </complexType>
+
+         <element name="echoMessage" type="tns:echoMessage"/>
+         <element name="echoMessageResponse" type="tns:echoMessageResponse"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echoMessage">
+      <part name="message" element="tns:echoMessage"/>
+   </message>
+
+   <message name="echoMessageResponse">
+      <part name="result" element="tns:echoMessageResponse"/>
+   </message>
+
+   <portType name="AnyTypeMessagePortType">
+      <operation name="echoMessage">
+         <input message="tns:echoMessage" />
+         <output message="tns:echoMessageResponse" />
+      </operation>
+   </portType>
+
+   <binding name="AnyTypeMessageBinding" type="tns:AnyTypeMessagePortType">
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+      <operation name="echoMessage">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="AnyTypeMessageService">
+      <port binding="tns:AnyTypeMessageBinding" name="AnyTypePort">
+         <soap:address location="http://localhost:8080/axis2/Services/AnyTypeMessageService"/>
+      </port>
+
+   </service>
+
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/AnyTypeMessagePortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/AnyTypeMessagePortTypeImpl.java?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/AnyTypeMessagePortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/AnyTypeMessagePortTypeImpl.java Tue Nov 14 14:49:51 2006
@@ -0,0 +1,37 @@
+/*
+ * 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.axis2.jaxws.anytype;
+
+import javax.jws.WebService;
+
+import org.apache.axis2.jaxws.anytype.sei.AnyTypeMessagePortType;
+
+@WebService(targetNamespace="http://anytype.test.org",
+        endpointInterface="org.apache.axis2.jaxws.anytype.sei.AnyTypeMessagePortType")
+public class AnyTypeMessagePortTypeImpl implements AnyTypeMessagePortType {
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.anytype.sei.AnyTypeMessagePortType#echoMessage(java.lang.Object)
+	 */
+	public Object echoMessage(Object request) {
+		Object response = new String("Request Received, This is Response from Server");
+		return response;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl Tue Nov 14 14:49:51 2006
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions targetNamespace="http://anytype.test.org" 
+      xmlns:tns="http://anytype.test.org"
+      xmlns="http://schemas.xmlsoap.org/wsdl/" 
+      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+   <types>
+      <xsd:schema targetNamespace="http://anytype.test.org"
+         xmlns:ts="http://anytype.test.org/xsd"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoMessage">
+            <sequence>
+               <element name="request" type="xsd:anyType"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoMessageResponse">
+            <sequence>
+               <element name="response" type="xsd:anyType"/>
+            </sequence>
+         </complexType>
+
+         <element name="echoMessage" type="tns:echoMessage"/>
+         <element name="echoMessageResponse" type="tns:echoMessageResponse"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echoMessage">
+      <part name="message" element="tns:echoMessage"/>
+   </message>
+
+   <message name="echoMessageResponse">
+      <part name="result" element="tns:echoMessageResponse"/>
+   </message>
+
+   <portType name="AnyTypeMessagePortType">
+      <operation name="echoMessage">
+         <input message="tns:echoMessage" />
+         <output message="tns:echoMessageResponse" />
+      </operation>
+   </portType>
+
+   <binding name="AnyTypeMessageBinding" type="tns:AnyTypeMessagePortType">
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+      <operation name="echoMessage">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="AnyTypeMessageService">
+      <port binding="tns:AnyTypeMessageBinding" name="AnyTypePort">
+         <soap:address location="http://localhost:8080/axis2/services/AnyTypeMessageService"/>
+      </port>
+
+   </service>
+
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/services.xml?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/META-INF/services.xml Tue Nov 14 14:49:51 2006
@@ -0,0 +1,8 @@
+<serviceGroup>
+ <service name="AnyTypeMessageService">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.anytype.AnyTypeMessagePortTypeImpl</parameter>
+ </service>
+</serviceGroup>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessagePortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessagePortType.java?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessagePortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessagePortType.java Tue Nov 14 14:49:51 2006
@@ -0,0 +1,36 @@
+
+package org.apache.axis2.jaxws.anytype.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebService(name = "AnyTypeMessagePortType", targetNamespace = "http://anytype.test.org")
+public interface AnyTypeMessagePortType {
+
+
+    /**
+     * 
+     * @param request
+     * @return
+     *     returns java.lang.Object
+     */
+    @WebMethod
+    @WebResult(name = "response", targetNamespace = "http://anytype.test.org")
+    @RequestWrapper(localName = "echoMessage", targetNamespace = "http://anytype.test.org", className = "org.test.anytype.EchoMessage")
+    @ResponseWrapper(localName = "echoMessageResponse", targetNamespace = "http://anytype.test.org", className = "org.test.anytype.EchoMessageResponse")
+    public Object echoMessage(
+        @WebParam(name = "request", targetNamespace = "http://anytype.test.org")
+        Object request);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessageService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessageService.java?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessageService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/sei/AnyTypeMessageService.java Tue Nov 14 14:49:51 2006
@@ -0,0 +1,62 @@
+
+package org.apache.axis2.jaxws.anytype.sei;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ * 
+ */
+@WebServiceClient(name = "AnyTypeMessageService", targetNamespace = "http://anytype.test.org", wsdlLocation = "AnyType.wsdl")
+public class AnyTypeMessageService
+    extends Service
+{
+
+    private final static URL ANYTYPEMESSAGESERVICE_WSDL_LOCATION;
+
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/anytype/META-INF/AnyType.wsdl";
+    static {
+        URL url = null;
+        try {
+        	try{
+	        	String baseDir = new File(".").getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        	}
+        	File file = new File(wsdlLocation);
+        	url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        ANYTYPEMESSAGESERVICE_WSDL_LOCATION = url;
+    }
+
+    public AnyTypeMessageService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public AnyTypeMessageService() {
+        super(ANYTYPEMESSAGESERVICE_WSDL_LOCATION, new QName("http://anytype.test.org", "AnyTypeMessageService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns AnyTypeMessagePortType
+     */
+    @WebEndpoint(name = "AnyTypePort")
+    public AnyTypeMessagePortType getAnyTypePort() {
+        return (AnyTypeMessagePortType)super.getPort(new QName("http://anytype.test.org", "AnyTypePort"), AnyTypeMessagePortType.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java?view=auto&rev=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java Tue Nov 14 14:49:51 2006
@@ -0,0 +1,46 @@
+/*
+ * 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.axis2.jaxws.anytype.tests;
+
+import org.apache.axis2.jaxws.anytype.sei.AnyTypeMessagePortType;
+import org.apache.axis2.jaxws.anytype.sei.AnyTypeMessageService;
+
+import junit.framework.TestCase;
+
+
+public class AnyTypeTests extends TestCase {
+	
+	public void testAnyTypeElementinWrappedWSDL(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			AnyTypeMessageService service = new AnyTypeMessageService();
+			AnyTypeMessagePortType portType = service.getAnyTypePort();
+			String req = new String("Request as String");
+			Object response = portType.echoMessage(req);
+			assertTrue(response instanceof String);
+			System.out.println("Response =" + response);
+			System.out.print("---------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+		
+	}
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=475033&r1=475032&r2=475033
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Tue Nov 14 14:49:51 2006
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
 import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
 import org.apache.axis2.jaxws.description.AnnotationDescriptionTests;
 import org.apache.axis2.jaxws.description.AnnotationProviderImplDescriptionTests;
@@ -132,6 +133,7 @@
 
         suite.addTestSuite(EndpointLifecycleTests.class);
         suite.addTestSuite(ResourceInjectionTests.class);
+        suite.addTestSuite(AnyTypeTests.class);
 
         // Start (and stop) the server only once for all the tests
         TestSetup testSetup = new TestSetup(suite) {



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