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 ng...@apache.org on 2006/12/04 05:52:59 UTC

svn commit: r482070 - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/org/apache/axis2/jaxws/client/proxy/ src/org/apache/axis2/jaxws/description/impl/ src/org/apache/axis2/jaxws/message/ test-resources/wsdl/ test/org/apache/axis2/jaxws/databind...

Author: ngallardo
Date: Sun Dec  3 20:52:56 2006
New Revision: 482070

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

Adding SOAP 1.2 support for dynamic proxy clients.

Added:
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-WSI.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/Echo.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/SOAP12EchoService.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/services.xml
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/SOAP12EchoImpl.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/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.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=482070&r1=482069&r2=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Sun Dec  3 20:52:56 2006
@@ -17,74 +17,83 @@
         </j:if>
     </preGoal>
     
-
-<!-- run the JAXB schema compiler -->
+	<!-- run the JAXB schema compiler -->
     <preGoal name="test:compile">
         <!--<j:if test="context.getVariable('maven.test.skip') != 'true'}">-->
 
         <j:set var="compiled.classes.dir" value="target/test-classes"/>
-        <!-- Theres got to be a better way to do this -->
+        
+    	<!-- Theres got to be a better way to do this -->
         <j:set var="schema.source.dir" value="test-resources/xsd"/>
     	<j:set var="wsdl.source.dir" value="test-resources/wsdl"/>
         <j:set var="schema.output.base.dir" value="target/schema"/>
         <j:set var="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
         <j:set var="schema.generated.classes.dir" value="${schema.output.base.dir}/classes"/>
-        <!-- make the dirs -->
+        
+    	<!-- make the dirs -->
         <mkdir dir="${schema.output.base.dir}"/>
         <mkdir dir="${schema.generated.src.dir}"/>
         <mkdir dir="${schema.generated.classes.dir}"/>
-        <!-- Run JAXB schema compiler with designated schemas -->
-        
+
+    	<!-- Run JAXB schema compiler with designated schemas -->
         <ant:echo>Generating JAX-B classes from XSDs</ant:echo>    
-        <ant:echo>Generating java from echo.xsd</ant:echo>
+        
+    	<ant:echo>Generating java from echo.xsd</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  ${schema.source.dir}/echo.xsd"/>
         </java>
-        <ant:echo>Generating java from stock1.xsd</ant:echo>
+
+    	<ant:echo>Generating java from stock1.xsd</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} -verbose ${schema.source.dir}/stock1.xsd"/>
+            <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/stock1.xsd"/>
         </java>
-        <ant:echo>Generating java from stock2.xsd</ant:echo>
+
+    	<ant:echo>Generating java from stock2.xsd</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 ${schema.source.dir}/stock2.xsd"/>
         </java>
-        <ant:echo>Generating java from samplemtom.xsd</ant:echo>
+
+    	<ant:echo>Generating java from samplemtom.xsd</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 ${schema.source.dir}/samplemtom.xsd"/>
         </java>
+
     	<ant:echo>Generating java from ProxyDocLitWrapped.wsdl</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} -p org.test.proxy.doclitwrapped -quiet -wsdl ${wsdl.source.dir}/ProxyDocLitWrapped.wsdl"/>
+    	    <arg line="-d ${schema.generated.src.dir} -quiet -p org.test.proxy.doclitwrapped -quiet -wsdl ${wsdl.source.dir}/ProxyDocLitWrapped.wsdl"/>
     	</java>
-        <ant:echo>Generating java from ProxyDocLitnonWrapped.wsdl</ant:echo>
+
+    	<ant:echo>Generating java from ProxyDocLitnonWrapped.wsdl</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}/ProxyDocLitnonWrapped.wsdl"/>
 		</java>
-		<ant:echo>Generating java from RPCLit.wsdl</ant:echo>
+
+    	<ant:echo>Generating java from RPCLit.wsdl</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} -p org.test.proxy.rpclit -quiet -wsdl ${wsdl.source.dir}/RPCLit.wsdl"/>
 		</java>
+    	
 		<ant:echo>Generating java from gorilla_dlw.wsdl</ant:echo>
         <java classname="com.sun.tools.xjc.Driver" fork="true"> 
 			<jvmarg line="${maven.junit.jvmargs}"/>
@@ -92,34 +101,47 @@
 			<classpath location="${compiled.classes.dir}"/>
 			<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/gorilla_dlw.wsdl"/>
 		</java>
+
+       	<ant:echo>Generating java from SOAP12Echo.wsdl</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}/SOAP12Echo.wsdl"/>
+   		</java>
+    	
     	<ant:echo>Generating java from AddNumbers.wsdl</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} -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
+    	   	<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
     	</java>
+
     	<ant:echo>Generating java from FaultyWebService.wsdl</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} -wsdl ${wsdl.source.dir}/FaultyWebService.wsdl"/>
+    	    <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/FaultyWebService.wsdl"/>
     	</java>
+
     	<ant:echo>Generating java from FaultsService.wsdl</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} -wsdl ${wsdl.source.dir}/FaultsService.wsdl"/>
+    	    <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/FaultsService.wsdl"/>
     	</java> 
+
     	<ant:echo>Generating java from jaxbsource</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} -p org.test.dispatch.jaxbsource ${schema.source.dir}/jaxbsource.xsd"/>
+    	    <arg line="-d ${schema.generated.src.dir} -quiet -p org.test.dispatch.jaxbsource ${schema.source.dir}/jaxbsource.xsd"/>
     	</java>
+
     	<ant:echo>Generating java from doclit_nonwrap.wsdl for javabean endpoint support</ant:echo>
     	<java classname="com.sun.tools.xjc.Driver" fork="true"> 
     		<jvmarg line="${maven.junit.jvmargs}"/>
@@ -127,6 +149,7 @@
     		<classpath location="${compiled.classes.dir}"/>
     		<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/doclit_nonwrap.wsdl"/>
 		</java>
+
     	<ant:echo>Generating java from doclitwrap.wsdl for javabean endpoint support</ant:echo>
 		<java classname="com.sun.tools.xjc.Driver" fork="true"> 
 			<jvmarg line="${maven.junit.jvmargs}"/>
@@ -134,22 +157,24 @@
 			<classpath location="${compiled.classes.dir}"/>
 			<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/doclitwrap.wsdl"/>
 		</java>
-		<ant:echo>Generating java from doclitbare.wsdl for javabean endpoint support</ant:echo>
+
+    	<ant:echo>Generating java from doclitbare.wsdl for javabean endpoint 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}/doclitbare.wsdl"/>
         </java>
+
     	<ant:echo>Generating java from EchoMessage.wsdl for javabean endpoint 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} -wsdl ${wsdl.source.dir}/EchoMessage.wsdl"/>
-    	        </java>
+   	    <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}/EchoMessage.wsdl"/>
+	    </java>
+
     	<ant:echo>Generating java from resourceinjection.wsdl for javabean endpoint Resource Injection support</ant:echo>
-		
     	<java classname="com.sun.tools.xjc.Driver" fork="true"> 
     	    <jvmarg line="${maven.junit.jvmargs}"/>
     	    <classpath refid="maven.dependency.classpath"/>
@@ -309,39 +334,50 @@
 		</ant:copy>
 		
 		<ant:copy toDir="target/test-classes/services/ProxyDocLitnonWrapped/">
-					<ant:fileset dir="target/test-classes">
-						<ant:include name="org/apache/axis2/jaxws/proxy/doclitnonwrapped/**"/>
-					</ant:fileset>
-					<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/doclitnonwrapped">
-		                <ant:include name="META-INF/**"/>
-					</ant:fileset>
-					<ant:fileset dir="target/classes">
-		                <ant:include name="org/apache/axis2/jaxws/server/**"/>
-					</ant:fileset>
+			<ant:fileset dir="target/test-classes">
+				<ant:include name="org/apache/axis2/jaxws/proxy/doclitnonwrapped/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/doclitnonwrapped">
+		        <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/RPCLit/">
-					<ant:fileset dir="target/test-classes">
-						<ant:include name="org/apache/axis2/jaxws/proxy/rpclit/**"/>
-					</ant:fileset>
-					<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/rpclit">
-		                <ant:include name="META-INF/**"/>
-					</ant:fileset>
-					<ant:fileset dir="target/classes">
-		                <ant:include name="org/apache/axis2/jaxws/server/**"/>
-					</ant:fileset>
+			<ant:fileset dir="target/test-classes">
+				<ant:include name="org/apache/axis2/jaxws/proxy/rpclit/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/rpclit">
+		        <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/SOAP12EchoService/">
+			<ant:fileset dir="target/test-classes">
+				<ant:include name="org/apache/axis2/jaxws/proxy/soap12/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/soap12/server">
+		        <ant:include name="META-INF/**"/>
+			</ant:fileset>
+		</ant:copy>
+		
 		<ant:copy toDir="target/test-classes/services/gorilla_dlw/">
-					<ant:fileset dir="target/test-classes">
-						<ant:include name="org/apache/axis2/jaxws/proxy/gorilla_dlw/**"/>
-					</ant:fileset>
-					<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/gorilla_dlw">
-		                <ant:include name="META-INF/**"/>
-					</ant:fileset>
-					<ant:fileset dir="target/classes">
-		                <ant:include name="org/apache/axis2/jaxws/server/**"/>
-					</ant:fileset>
+			<ant:fileset dir="target/test-classes">
+				<ant:include name="org/apache/axis2/jaxws/proxy/gorilla_dlw/**"/>
+			</ant:fileset>
+			<ant:fileset dir="test/org/apache/axis2/jaxws/proxy/gorilla_dlw">
+		        <ant:include name="META-INF/**"/>
+			</ant:fileset>
+			<ant:fileset dir="target/classes">
+		        <ant:include name="org/apache/axis2/jaxws/server/**"/>
+			</ant:fileset>
 		</ant:copy>
-        <!-- ================================================================ -->
+		<!-- ================================================================ -->
         <!--- Java Bean Endpoint Samples -->
         <!-- ================================================================ -->
 		<ant:copy toDir="target/test-classes/services/AddressBookService/">
@@ -498,12 +534,9 @@
 
     <goal name="jar">
         <attainGoal name="jar:install"/>
-
     </goal>
 
     <goal name="release" prereqs="dist-bin,dist-src">
-
-
     </goal>
 
     <goal name="dist-bin" prereqs="jar">

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=482070&r1=482069&r2=482070
==============================================================================
--- 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 Sun Dec  3 20:52:56 2006
@@ -47,6 +47,7 @@
 import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
 import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.MessageException;
 import org.apache.axis2.jaxws.message.Protocol;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
@@ -365,20 +366,28 @@
 	public void setSeiClazz(Class seiClazz) {
 		this.seiClazz = seiClazz;
 	}
+    
 	private void initialize(){
 		SOAPBinding.Style style = operationDesc.getSoapBindingStyle();
-		
+        Protocol p = null;
+        try {
+            EndpointDescription epDesc = getEndpointDescription();
+            String bindingID = epDesc.getClientBindingID();
+            p = Protocol.getProtocolForBinding(bindingID);
+        } catch (MessageException e) {
+            e.printStackTrace();
+        }
+        
 		MethodMarshallerFactory cf = (MethodMarshallerFactory) FactoryRegistry.getFactory(MethodMarshallerFactory.class);
 		if(style == SOAPBinding.Style.DOCUMENT){
-			methodMarshaller = createDocLitMethodMarshaller(cf);
+			methodMarshaller = createDocLitMethodMarshaller(cf, p);
 		}
 		if(style == SOAPBinding.Style.RPC){
-			methodMarshaller = createRPCLitMethodMarshaller(cf);
-			
-		}
-	
+			methodMarshaller = createRPCLitMethodMarshaller(cf, p);
+		}	
 	}
-	private MethodMarshaller createDocLitMethodMarshaller(MethodMarshallerFactory cf){
+    
+	private MethodMarshaller createDocLitMethodMarshaller(MethodMarshallerFactory cf, Protocol p){
 		ParameterStyle parameterStyle = null;
 		if(isDocLitBare()){
 			parameterStyle = SOAPBinding.ParameterStyle.BARE;
@@ -386,18 +395,16 @@
 		if(isDocLitWrapped()){
 			parameterStyle = SOAPBinding.ParameterStyle.WRAPPED;
 		}
-		//FIXME: The protocol should actually come from the binding information included in
-	    // either the WSDL or an annotation.
+
 		return cf.createMethodMarshaller(SOAPBinding.Style.DOCUMENT, parameterStyle, 
-                serviceDesc, endpointDesc, operationDesc, Protocol.soap11, true);
+                serviceDesc, endpointDesc, operationDesc, p, true);
 	}
 	
-	private MethodMarshaller createRPCLitMethodMarshaller(MethodMarshallerFactory cf){
-        //    FIXME: The protocol should actually come from the binding information included in
-        // either the WSDL or an annotation.
+	private MethodMarshaller createRPCLitMethodMarshaller(MethodMarshallerFactory cf, Protocol p){
         return cf.createMethodMarshaller(SOAPBinding.Style.RPC, SOAPBinding.ParameterStyle.WRAPPED,
-                serviceDesc, endpointDesc, operationDesc, Protocol.soap11, true);
+                serviceDesc, endpointDesc, operationDesc, p, true);
 	}
+    
 	protected boolean isDocLitBare(){
 		SOAPBinding.ParameterStyle methodParamStyle = operationDesc.getSoapBindingParameterStyle();
 		if(methodParamStyle!=null){

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=482070&r1=482069&r2=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Sun Dec  3 20:52:56 2006
@@ -14,8 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.axis2.jaxws.description.impl;
 
 import java.util.ArrayList;
@@ -23,16 +21,15 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 import javax.jws.WebService;
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
-import javax.wsdl.PortType;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingType;
 import javax.xml.ws.Service;
@@ -114,7 +111,7 @@
     // The JAX-WS Handler port information corresponding to this endpoint
     private PortInfo portInfo;
     
-    private String clientBindingID = DEFAULT_CLIENT_BINDING_ID;
+    private String clientBindingID;
     // The effective endpoint address.  It could be set by the client or come from the WSDL SOAP address
     private String endpointAddress;
     // The endpoint address from the WSDL soap:address extensibility element if present.
@@ -1126,14 +1123,28 @@
         }
         return wsdlBinding;
     }
+    
     public String getWSDLBindingType() {
         String wsdlBindingType = null;
         Binding wsdlBinding = getWSDLBinding();
         if (wsdlBinding != null) {
-            wsdlBindingType = wsdlBinding.getQName().getNamespaceURI();
+            List<ExtensibilityElement> elements = wsdlBinding.getExtensibilityElements();
+            Iterator<ExtensibilityElement> itr = elements.iterator();
+            while (itr.hasNext()) {
+                ExtensibilityElement e = itr.next();
+                if (javax.wsdl.extensions.soap.SOAPBinding.class.isAssignableFrom(e.getClass())) {
+                    javax.wsdl.extensions.soap.SOAPBinding soapBnd = (javax.wsdl.extensions.soap.SOAPBinding) e;
+                    wsdlBindingType = soapBnd.getTransportURI();
+                }
+                else if (SOAP12Binding.class.isAssignableFrom(e.getClass())) {
+                    SOAP12Binding soapBnd = (SOAP12Binding) e;
+                    wsdlBindingType = soapBnd.getTransportURI();
+                }
+            }
         }
         return wsdlBindingType;
     }
+    
     public String getName() {
         return getAnnoWebServiceName();
     }
@@ -1197,9 +1208,20 @@
         }
         return isValid;
     }
+    
     public String getClientBindingID() {
+        if (clientBindingID == null) {
+            if (getWSDLDefinition() != null) {
+                System.out.println(">> Getting bindingID from WSDL");
+                clientBindingID = getWSDLBindingType();
+            }
+            else {
+                clientBindingID = DEFAULT_CLIENT_BINDING_ID;
+            }
+        }
         return clientBindingID;
     }
+    
     public void setEndpointAddress(String endpointAddress) {
         // REVIEW: Should this be called whenever BindingProvider.ENDPOINT_ADDRESS_PROPERTY is set by the client?
         if (!DescriptionUtils.isEmpty(endpointAddress)) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java?view=diff&rev=482070&r1=482069&r2=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java Sun Dec  3 20:52:56 2006
@@ -29,6 +29,10 @@
 public enum Protocol {
 	soap11, soap12, rest, unknown;
     
+    // WS-I Basic Profile 1.1 specifies a different value for the SOAP 1.1 HTTP
+    // binding than the one specified in JAX-WS, section 10.4.1
+    private static final String SOAP11HTTP_WSI_BINDING = "http://schemas.xmlsoap.org/soap/http";
+    
     /**
      * Return the right value for the Protocol based on the binding
      * URL that was passed in.
@@ -37,8 +41,9 @@
      * @return
      */
     public static Protocol getProtocolForBinding(String url) throws MessageException {
-        //TODO: Add support for more URLs as needed.
-        if (url.equals(SOAPBinding.SOAP11HTTP_BINDING) || 
+        System.out.println(">> Looking up binding [" + url + "]");
+        if (url.equals(Protocol.SOAP11HTTP_WSI_BINDING) ||
+            url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
         	url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
             return Protocol.soap11;
         }

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-JAXWS.wsdl Sun Dec  3 20:52:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org/bindingtest/soap11" 
+      xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap11"
+      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://jaxws.axis2.apache.org/bindingtest/soap11"
+         xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap11"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoType">
+            <sequence>
+               <element name="request" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoResponseType">
+            <sequence>
+               <element name="response" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <element name="echo" type="tns:echoType"/>
+         <element name="echoResponse" type="tns:echoResponseType"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echo">
+      <part name="parameters" element="tns:echo"/>
+   </message>
+
+   <message name="echoResponse">
+      <part name="parameters" element="tns:echoResponse"/>
+   </message>
+
+   <portType name="Echo">
+      <operation name="echo">
+         <input message="tns:echo" />
+         <output message="tns:echoResponse" />
+      </operation>
+   </portType>
+
+   <binding name="EchoBinding" type="tns:Echo">
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/wsdl/soap/http"/>
+      <operation name="echo">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="SOAP11EchoService">
+      <port binding="tns:EchoBinding" name="EchoPort">
+         <soap:address location="http://localhost:8080/axis2/services/SOAP11EchoService"/>
+      </port>
+   </service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-WSI.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-WSI.wsdl?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-WSI.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP11Binding-WSI.wsdl Sun Dec  3 20:52:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org/bindingtest/soap11" 
+      xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap11"
+      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://jaxws.axis2.apache.org/bindingtest/soap11"
+         xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap11"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoType">
+            <sequence>
+               <element name="request" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoResponseType">
+            <sequence>
+               <element name="response" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <element name="echo" type="tns:echoType"/>
+         <element name="echoResponse" type="tns:echoResponseType"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echo">
+      <part name="parameters" element="tns:echo"/>
+   </message>
+
+   <message name="echoResponse">
+      <part name="parameters" element="tns:echoResponse"/>
+   </message>
+
+   <portType name="Echo">
+      <operation name="echo">
+         <input message="tns:echo" />
+         <output message="tns:echoResponse" />
+      </operation>
+   </portType>
+
+   <binding name="EchoBinding" type="tns:Echo">
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+      <operation name="echo">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="SOAP11EchoService">
+      <port binding="tns:EchoBinding" name="EchoPort">
+         <soap:address location="http://localhost:8080/axis2/services/SOAP12EchoService"/>
+      </port>
+   </service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Binding-JAXWS.wsdl Sun Dec  3 20:52:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org/bindingtest/soap12" 
+      xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap12"
+      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://jaxws.axis2.apache.org/bindingtest/soap12"
+         xmlns:tns="http://jaxws.axis2.apache.org/bindingtest/soap12"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoType">
+            <sequence>
+               <element name="request" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoResponseType">
+            <sequence>
+               <element name="response" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <element name="echo" type="tns:echoType"/>
+         <element name="echoResponse" type="tns:echoResponseType"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echo">
+      <part name="parameters" element="tns:echo"/>
+   </message>
+
+   <message name="echoResponse">
+      <part name="parameters" element="tns:echoResponse"/>
+   </message>
+
+   <portType name="Echo">
+      <operation name="echo">
+         <input message="tns:echo" />
+         <output message="tns:echoResponse" />
+      </operation>
+   </portType>
+
+   <binding name="EchoBinding" type="tns:Echo">
+      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <operation name="echo">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="SOAP12EchoService">
+      <port binding="tns:EchoBinding" name="EchoPort">
+         <soap:address location="http://localhost:8080/axis2/services/SOAP12EchoService"/>
+      </port>
+   </service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/SOAP12Echo.wsdl Sun Dec  3 20:52:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12" 
+      xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
+      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://jaxws.axis2.apache.org/proxy/soap12"
+         xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoType">
+            <sequence>
+               <element name="request" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoResponseType">
+            <sequence>
+               <element name="response" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <element name="echo" type="tns:echoType"/>
+         <element name="echoResponse" type="tns:echoResponseType"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echo">
+      <part name="parameters" element="tns:echo"/>
+   </message>
+
+   <message name="echoResponse">
+      <part name="parameters" element="tns:echoResponse"/>
+   </message>
+
+   <portType name="Echo">
+      <operation name="echo">
+         <input message="tns:echo" />
+         <output message="tns:echoResponse" />
+      </operation>
+   </portType>
+
+   <binding name="EchoBinding" type="tns:Echo">
+      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <operation name="echo">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="SOAP12EchoService">
+      <port binding="tns:EchoBinding" name="EchoPort">
+         <soap:address location="http://localhost:8080/axis2/services/SOAP12EchoService"/>
+      </port>
+   </service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java Sun Dec  3 20:52:56 2006
@@ -0,0 +1,153 @@
+/*
+ * 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.databinding;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.description.DescriptionTestUtils;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.message.Protocol;
+import org.apache.axis2.jaxws.spi.ServiceDelegate;
+
+/**
+ * A suite of tests for reading the binding from a WSDL file and
+ * making sure we are configuring the Protocol correctly for 
+ * messages based on that binding ID.
+ */
+public class BindingToProtocolTests extends TestCase {
+    
+    private static final String SOAP11_TEST_NS = "http://jaxws.axis2.apache.org/bindingtest/soap11";
+    private static final String SOAP12_TEST_NS = "http://jaxws.axis2.apache.org/bindingtest/soap12";
+    private static final QName SOAP11_SVC_QNAME = new QName(SOAP11_TEST_NS, "SOAP11EchoService");
+    private static final QName SOAP12_SVC_QNAME = new QName(SOAP12_TEST_NS, "SOAP12EchoService");
+    
+    public BindingToProtocolTests(String name) {
+        super(name);
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.1 binding transport URL
+     * in a WSDL, as specified by JAX-WS section 10.4.1.
+     */
+    public void testReadJAXWSSOAP11Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP11Binding-JAXWS.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP11_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP11_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap11));
+        */
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.1 binding transport URL
+     * in a WSDL, as specified by WS-I Basic Profile 1.1.
+     */
+    public void testReadWSISOAP11Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP11Binding-WSI.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP11_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP11_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap11));
+        */
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.2 binding transport URL
+     * in a WSDL, as specified by JAX-WS.
+     */
+    public void testReadJAXWSSOAP12Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP12Binding-JAXWS.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP12_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP12_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap12));
+        */
+    }
+    
+    /**
+     * Test to see if we are defaulting the soap binding to SOAP 1.1
+     * correctly in the absence of a WSDL document.
+     */
+    public void testDefaultBindingNoWSDL() {
+        
+    }
+}

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=482070&r1=482069&r2=482070
==============================================================================
--- 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 Sun Dec  3 20:52:56 2006
@@ -23,6 +23,7 @@
 
 import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
 import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
+import org.apache.axis2.jaxws.databinding.BindingToProtocolTests;
 import org.apache.axis2.jaxws.description.AnnotationDescriptionTests;
 import org.apache.axis2.jaxws.description.AnnotationProviderImplDescriptionTests;
 import org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests;
@@ -63,6 +64,7 @@
 import org.apache.axis2.jaxws.proxy.ProxyNonWrappedTests;
 import org.apache.axis2.jaxws.proxy.ProxyTests;
 import org.apache.axis2.jaxws.proxy.RPCProxyTests;
+import org.apache.axis2.jaxws.proxy.SOAP12ProxyTests;
 import org.apache.axis2.jaxws.sample.AddNumbersTests;
 import org.apache.axis2.jaxws.sample.AddressBookTests;
 import org.apache.axis2.jaxws.sample.BareTests;
@@ -100,6 +102,7 @@
         suite.addTestSuite(XMLStreamReaderSplitterTests.class);
         suite.addTestSuite(SOAP12Tests.class);
         suite.addTestSuite(MTOMSerializationTests.class);
+        suite.addTestSuite(BindingToProtocolTests.class);
         
         suite.addTestSuite(ServiceAnnotationTests.class);
         suite.addTestSuite(WSDLTests.class);
@@ -130,6 +133,7 @@
         suite.addTestSuite(ProxyNonWrappedTests.class);
         suite.addTestSuite(RPCProxyTests.class);
         suite.addTestSuite(GorillaDLWProxyTests.class);
+        suite.addTestSuite(SOAP12ProxyTests.class);
         suite.addTestSuite(ExceptionFactoryTests.class);
         suite.addTestSuite(BasicAuthSecurityTests.class);
 

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java Sun Dec  3 20:52:56 2006
@@ -0,0 +1,94 @@
+/*
+ * 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.proxy;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.proxy.soap12.Echo;
+import org.apache.axis2.jaxws.proxy.soap12.SOAP12EchoService;
+
+/**
+ * A suite of tests to test dynamic proxy clients sending SOAP 1.2
+ * requests.  The endpoint can accept different keys to determine
+ * what it should send back.
+ */
+public class SOAP12ProxyTests extends TestCase {
+
+    private static final String SEND_SOAP11_RESPONSE = "RESPONSE-SOAP11";
+    private static final String SEND_SOAP12_RESPONSE = "RESPONSE-SOAP12";
+    
+    public SOAP12ProxyTests(String name) {
+        super(name);
+    }
+    
+    /**
+     * Send a SOAP 1.2 request and expect a SOAP 1.2 response.
+     */
+    public void testSOAP12RequestSOAP12Response() throws Exception {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // create the proxy instance.  the WSDL used by this proxy
+        // should have a proper SOAP 1.2 binding configured
+        SOAP12EchoService service = new SOAP12EchoService();
+        Echo proxy = service.getPort(new QName("http://jaxws.axis2.apache.org/proxy/soap12", "EchoPort"), Echo.class);
+        
+        // invoke the remote operation.  send a key that tells the 
+        // service send back a SOAP 1.2 response.
+        String response = proxy.echo(SEND_SOAP12_RESPONSE);
+        System.out.println("response returned [" + response + "]");
+        
+        // validate the results
+        assertNotNull(response);
+        assertTrue(!response.equals("FAIL"));
+    }
+    
+    /**
+     * Send a SOAP 1.2 request, but have the server send back a SOAP 1.1
+     * response.  This should result in an exception.
+     */
+    public void testSOAP12RequestSOAP11Response() {
+        System.out.println("---------------------------------------");
+        System.out.println("test: " + getName());
+        
+        // create the proxy instance.  the WSDL used by this proxy
+        // should have a proper SOAP 1.2 binding configured
+        SOAP12EchoService service = new SOAP12EchoService();
+        Echo proxy = service.getPort(new QName("http://jaxws.axis2.apache.org/proxy/soap12", "EchoPort"), Echo.class);
+        
+        // invoke the remote operation.  send a key that tells the 
+        // service send back a SOAP 1.1 response.  this should result
+        // in an error.
+        try {
+            String response = proxy.echo(SEND_SOAP11_RESPONSE);
+            System.out.println("response returned [" + response + "]");
+            
+            // if we've gotten this far, then something went wrong.
+            fail();
+        }
+        catch (WebServiceException wse) {
+            System.out.println("an exception was thrown, as expected");
+            System.out.println(wse.getMessage());
+        }
+    } 
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/Echo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/Echo.java?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/Echo.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/Echo.java Sun Dec  3 20:52:56 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.proxy.soap12;
+
+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;
+
+@WebService(name = "Echo", targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12")
+public interface Echo {
+
+    @WebMethod
+    @WebResult(name = "response", targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12")
+    @RequestWrapper(localName = "echo", targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12", className = "org.apache.axis2.jaxws.proxy.soap12.EchoType")
+    @ResponseWrapper(localName = "echoResponse", targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12", className = "org.apache.axis2.jaxws.proxy.soap12.EchoResponseType")
+    public String echo(
+        @WebParam(name = "request", targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12")
+        String request);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/SOAP12EchoService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/SOAP12EchoService.java?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/SOAP12EchoService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/SOAP12EchoService.java Sun Dec  3 20:52:56 2006
@@ -0,0 +1,60 @@
+/*
+ * 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.proxy.soap12;
+
+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;
+
+@WebServiceClient(name = "SOAP12EchoService", 
+        targetNamespace = "http://jaxws.axis2.apache.org/proxy/soap12", 
+        wsdlLocation = "SOAP12Echo.wsdl")
+public class SOAP12EchoService
+    extends Service
+{
+
+    private final static URL SOAP12ECHOSERVICE_WSDL_LOCATION;
+
+    static {
+        URL url = null;
+        try {
+            url = new URL("file:./target/test-classes/services/SOAP12EchoService/META-INF/SOAP12Echo.wsdl");
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        SOAP12ECHOSERVICE_WSDL_LOCATION = url;
+    }
+
+    public SOAP12EchoService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public SOAP12EchoService() {
+        super(SOAP12ECHOSERVICE_WSDL_LOCATION, new QName("http://jaxws.axis2.apache.org/proxy/soap12", "SOAP12EchoService"));
+    }
+
+    @WebEndpoint(name = "EchoPort")
+    public Echo getEchoPort() {
+        return (Echo)super.getPort(new QName("http://jaxws.axis2.apache.org/proxy/soap12", "EchoPort"), Echo.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/SOAP12Echo.wsdl Sun Dec  3 20:52:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12" 
+      xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
+      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://jaxws.axis2.apache.org/proxy/soap12"
+         xmlns:tns="http://jaxws.axis2.apache.org/proxy/soap12"
+         xmlns="http://www.w3.org/2001/XMLSchema"
+         elementFormDefault="qualified">
+
+         <complexType name="echoType">
+            <sequence>
+               <element name="request" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <complexType name="echoResponseType">
+            <sequence>
+               <element name="response" type="xsd:string"/>
+            </sequence>
+         </complexType>
+
+         <element name="echo" type="tns:echoType"/>
+         <element name="echoResponse" type="tns:echoResponseType"/>
+
+      </xsd:schema>
+   </types>
+
+   <message name="echo">
+      <part name="parameters" element="tns:echo"/>
+   </message>
+
+   <message name="echoResponse">
+      <part name="parameters" element="tns:echoResponse"/>
+   </message>
+
+   <portType name="Echo">
+      <operation name="echo">
+         <input message="tns:echo" />
+         <output message="tns:echoResponse" />
+      </operation>
+   </portType>
+
+   <binding name="EchoBinding" type="tns:Echo">
+      <soap:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
+      <operation name="echo">
+         <soap:operation soapAction=""/>
+         <input>
+            <soap:body use="literal"/>
+         </input>
+
+         <output>
+            <soap:body use="literal"/>
+         </output>
+      </operation>
+   </binding>
+
+   <service name="SOAP12EchoService">
+      <port binding="tns:EchoBinding" name="EchoPort">
+         <soap:address location="http://localhost:8080/axis2/services/SOAP12EchoService"/>
+      </port>
+   </service>
+</definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/services.xml?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/META-INF/services.xml Sun Dec  3 20:52:56 2006
@@ -0,0 +1,11 @@
+<serviceGroup>
+ <service name="SOAP12EchoService">
+  <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.proxy.soap12.server.SOAP12EchoImpl</parameter>
+  <operation name="echo" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/SOAP12EchoImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/SOAP12EchoImpl.java?view=auto&rev=482070
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/SOAP12EchoImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/proxy/soap12/server/SOAP12EchoImpl.java Sun Dec  3 20:52:56 2006
@@ -0,0 +1,98 @@
+/*
+ * 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.proxy.soap12.server;
+
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
+
+@ServiceMode(Mode.MESSAGE)
+@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
+@WebServiceProvider(targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12", wsdlLocation="META-INF/SOAP12Echo.wsdl")
+public class SOAP12EchoImpl implements Provider<String> {
+    
+    private static final String SOAP11_NS_URI = "http://schemas.xmlsoap.org/soap/envelope/";
+    private static final String SOAP12_NS_URI = "http://www.w3.org/2003/05/soap-envelope";
+    
+    private static final String SEND_SOAP11_RESPONSE = "RESPONSE-SOAP11";
+    private static final String SEND_SOAP12_RESPONSE = "RESPONSE-SOAP12";
+    
+    public static final String SOAP11_ENVELOPE_HEAD = 
+        "<?xml version='1.0' encoding='utf-8'?>" + 
+        "<soapenv:Envelope xmlns:soapenv=\"" + SOAP11_NS_URI + "\">" +
+        "<soapenv:Header />" + 
+        "<soapenv:Body>";
+    
+    public static final String SOAP12_ENVELOPE_HEAD = 
+        "<?xml version='1.0' encoding='utf-8'?>" + 
+        "<soapenv:Envelope xmlns:soapenv=\"" + SOAP12_NS_URI + "\">" +
+        "<soapenv:Header />" + 
+        "<soapenv:Body>";
+    
+    public static final String SOAP11_ENVELOPE_TAIL = 
+        "</soapenv:Body>" + 
+        "</soapenv:Envelope>";
+    
+    public static final String SOAP12_ENVELOPE_TAIL = 
+        "</soapenv:Body>" + 
+        "</soapenv:Envelope>";
+        
+    public String invoke(String input) {
+        System.out.println("received request [" + input + "]");
+        
+        // check the request to see if it contains the SOAP 1.1 namespace 
+        // URI.  if so, then that is an error and we should respond with 
+        // a failure.
+        String status = "FAIL";
+        if (input.indexOf(SOAP12_NS_URI) > 0) {
+            status = "PASS";
+            System.out.println("the request contains the SOAP 1.2 namespace as expected.");
+        }
+        else {
+            System.out.println("the request did NOT contain the SOAP 1.2 namespace.");
+            System.out.println("sending back a failure");
+        }
+        
+        // the contents of the response should contain the status
+        String responseBody =             
+            "<echoResponse xmlns=\"http://jaxws.axis2.apache.org/proxy/soap12\">" +
+            "<response>" + status + "</response>" +
+            "</echoResponse>"; 
+        
+        // build up the appropriate envelope type for the response
+        // based on what was the client requested.
+        StringBuffer response = new StringBuffer();
+        if (input.indexOf(SEND_SOAP11_RESPONSE) > 0) {
+            response.append(SOAP11_ENVELOPE_HEAD);
+            response.append(responseBody);
+            response.append(SOAP11_ENVELOPE_TAIL);
+        }
+        else if (input.indexOf(SEND_SOAP12_RESPONSE) > 0) {
+            response.append(SOAP12_ENVELOPE_HEAD);
+            response.append(responseBody);
+            response.append(SOAP12_ENVELOPE_TAIL);
+        }
+        
+        System.out.println("sending response [" + response + "]");        
+        return response.toString();
+    }
+}



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