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 pr...@apache.org on 2010/01/27 16:25:15 UTC
svn commit: r903677 - in /webservices/axis2/trunk/java/modules:
integration/test-resources/wsdl/
integration/test/org/apache/axis2/deployment/
jaxws/src/org/apache/axis2/jaxws/ jaxws/test-resources/wsdl/
jaxws/test/org/apache/axis2/jaxws/addressing/
Author: pradine
Date: Wed Jan 27 15:25:14 2010
New Revision: 903677
URL: http://svn.apache.org/viewvc?rev=903677&view=rev
Log:
Applying patch for https://issues.apache.org/jira/browse/AXIS2-4596
Added:
webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl (with props)
webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl (with props)
webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl (with props)
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl (with props)
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl (with props)
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl (with props)
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java (with props)
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
Added: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,119 @@
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://axisversion.sample/xsd"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://axisversion.sample/xsd">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://axisversion.sample/xsd" attributeFormDefault="qualified"
+ elementFormDefault="unqualified" targetNamespace="http://axisversion.sample/xsd">
+ <xs:element name="ExceptionFault">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true"
+ type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getVersionResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getVersionRequest"/>
+ <wsdl:message name="getVersionResponse">
+ <wsdl:part name="parameters" element="ns0:getVersionResponse"/>
+ </wsdl:message>
+ <wsdl:message name="getVersionFault">
+ <wsdl:part name="parameters" element="ns0:ExceptionFault"/>
+ </wsdl:message>
+ <wsdl:portType name="VersionPortType">
+ <wsdl:operation name="getVersion">
+ <wsdl:input message="ns0:getVersionRequest" wsaw:Action="urn:getVersion"/>
+ <wsdl:output message="ns0:getVersionResponse" wsaw:Action="urn:getVersionResponse"/>
+ <wsdl:fault message="ns0:getVersionFault" name="getVersionFault"
+ wsaw:Action="urn:getVersionFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="VersionSOAP11Binding" type="ns0:VersionPortType">
+ <wsaw:UsingAddressing />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionSOAP12Binding" type="ns0:VersionPortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap12:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap12:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionHttpBinding" type="ns0:VersionPortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getVersion">
+ <http:operation location="Version/getVersion"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Version">
+ <wsdl:port name="VersionSOAP11port_http" binding="ns0:VersionSOAP11Binding">
+ <soap:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionSOAP12port_http" binding="ns0:VersionSOAP12Binding">
+ <soap12:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionHttpport" binding="ns0:VersionHttpBinding">
+ <http:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressing.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,119 @@
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://axisversion.sample/xsd"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://axisversion.sample/xsd">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://axisversion.sample/xsd" attributeFormDefault="qualified"
+ elementFormDefault="unqualified" targetNamespace="http://axisversion.sample/xsd">
+ <xs:element name="ExceptionFault">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true"
+ type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getVersionResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getVersionRequest"/>
+ <wsdl:message name="getVersionResponse">
+ <wsdl:part name="parameters" element="ns0:getVersionResponse"/>
+ </wsdl:message>
+ <wsdl:message name="getVersionFault">
+ <wsdl:part name="parameters" element="ns0:ExceptionFault"/>
+ </wsdl:message>
+ <wsdl:portType name="VersionPortType">
+ <wsdl:operation name="getVersion">
+ <wsdl:input message="ns0:getVersionRequest" wsaw:Action="urn:getVersion"/>
+ <wsdl:output message="ns0:getVersionResponse" wsaw:Action="urn:getVersionResponse"/>
+ <wsdl:fault message="ns0:getVersionFault" name="getVersionFault"
+ wsaw:Action="urn:getVersionFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="VersionSOAP11Binding" type="ns0:VersionPortType">
+ <wsaw:UsingAddressing wsdl:required="false" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionSOAP12Binding" type="ns0:VersionPortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap12:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap12:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionHttpBinding" type="ns0:VersionPortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getVersion">
+ <http:operation location="Version/getVersion"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Version">
+ <wsdl:port name="VersionSOAP11port_http" binding="ns0:VersionSOAP11Binding">
+ <soap:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionSOAP12port_http" binding="ns0:VersionSOAP12Binding">
+ <soap12:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionHttpport" binding="ns0:VersionHttpBinding">
+ <http:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingOptional.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,119 @@
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://axisversion.sample/xsd"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://axisversion.sample/xsd">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://axisversion.sample/xsd" attributeFormDefault="qualified"
+ elementFormDefault="unqualified" targetNamespace="http://axisversion.sample/xsd">
+ <xs:element name="ExceptionFault">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true"
+ type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getVersionResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getVersionRequest"/>
+ <wsdl:message name="getVersionResponse">
+ <wsdl:part name="parameters" element="ns0:getVersionResponse"/>
+ </wsdl:message>
+ <wsdl:message name="getVersionFault">
+ <wsdl:part name="parameters" element="ns0:ExceptionFault"/>
+ </wsdl:message>
+ <wsdl:portType name="VersionPortType">
+ <wsdl:operation name="getVersion">
+ <wsdl:input message="ns0:getVersionRequest" wsaw:Action="urn:getVersion"/>
+ <wsdl:output message="ns0:getVersionResponse" wsaw:Action="urn:getVersionResponse"/>
+ <wsdl:fault message="ns0:getVersionFault" name="getVersionFault"
+ wsaw:Action="urn:getVersionFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="VersionSOAP11Binding" type="ns0:VersionPortType">
+ <wsaw:UsingAddressing wsdl:required="true" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionSOAP12Binding" type="ns0:VersionPortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="getVersion">
+ <soap12:operation soapAction="urn:getVersion" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="getVersionFault">
+ <soap12:fault use="literal" name="getVersionFault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionHttpBinding" type="ns0:VersionPortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getVersion">
+ <http:operation location="Version/getVersion"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="getVersion"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Version">
+ <wsdl:port name="VersionSOAP11port_http" binding="ns0:VersionSOAP11Binding">
+ <soap:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionSOAP12port_http" binding="ns0:VersionSOAP12Binding">
+ <soap12:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ <wsdl:port name="VersionHttpport" binding="ns0:VersionHttpBinding">
+ <http:address location="http://127.0.0.1:8000/axis2/services/Version"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/UsingAddressingRequired.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java?rev=903677&r1=903676&r2=903677&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java Wed Jan 27 15:25:14 2010
@@ -19,6 +19,8 @@
package org.apache.axis2.deployment;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisService;
@@ -62,5 +64,94 @@
}
}
-}
+ // Check the addressing requirement parameter is set to
+ // ADDRESSING_UNSPECIFIED when <wsaw:UsingAddressing /> is NOT used in the
+ // WSDL
+ public void testWithoutUsingAddressing() {
+ File testResourceFile = new File(wsdlLocation);
+ try {
+ WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
+ new FileInputStream(testResourceFile));
+ AxisService axisService = builder.populateService();
+ String addressingRequired = AddressingHelper
+ .getAddressingRequirementParemeterValue(axisService);
+ assertEquals("Unexpected addressingRequirementParameter value: "
+ + addressingRequired,
+ AddressingConstants.ADDRESSING_UNSPECIFIED,
+ addressingRequired);
+ } catch (Exception e) {
+ System.out.println("Error in WSDL : " + testResourceFile.getName());
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check the addressing requirement parameter is set to
+ // ADDRESSING_OPTIONAL when <wsaw:UsingAddressing /> is used in the WSDL
+ public void testUsingAddressing() {
+ wsdlLocation = System.getProperty("basedir", ".") + "/"
+ + "test-resources/wsdl/UsingAddressing.wsdl";
+ File testResourceFile = new File(wsdlLocation);
+ try {
+ WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
+ new FileInputStream(testResourceFile));
+ AxisService axisService = builder.populateService();
+ String addressingRequired = AddressingHelper
+ .getAddressingRequirementParemeterValue(axisService);
+ assertEquals("Unexpected addressingRequirementParameter value: "
+ + addressingRequired,
+ AddressingConstants.ADDRESSING_OPTIONAL, addressingRequired);
+ } catch (Exception e) {
+ System.out.println("Error in WSDL : " + testResourceFile.getName());
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check the addressing requirement parameter is set to
+ // ADDRESSING_OPTIONAL when <wsaw:UsingAddressing wsdl:required="false" />
+ // is used in the WSDL
+ public void testUsingAddressingOptional() {
+ wsdlLocation = System.getProperty("basedir", ".") + "/"
+ + "test-resources/wsdl/UsingAddressingOptional.wsdl";
+ File testResourceFile = new File(wsdlLocation);
+ try {
+ WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
+ new FileInputStream(testResourceFile));
+ AxisService axisService = builder.populateService();
+ String addressingRequired = AddressingHelper
+ .getAddressingRequirementParemeterValue(axisService);
+ assertEquals("Unexpected addressingRequirementParameter value: "
+ + addressingRequired,
+ AddressingConstants.ADDRESSING_OPTIONAL, addressingRequired);
+ } catch (Exception e) {
+ System.out.println("Error in WSDL : " + testResourceFile.getName());
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check the addressing requirement parameter is set to
+ // ADDRESSING_REQUIRED when <wsaw:UsingAddressing wsdl:required="true" /> is
+ // used in the WSDL
+ public void testUsingAddressingRequired() {
+ wsdlLocation = System.getProperty("basedir", ".") + "/"
+ + "test-resources/wsdl/UsingAddressingRequired.wsdl";
+ File testResourceFile = new File(wsdlLocation);
+ try {
+ WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
+ new FileInputStream(testResourceFile));
+ AxisService axisService = builder.populateService();
+ String addressingRequired = AddressingHelper
+ .getAddressingRequirementParemeterValue(axisService);
+ assertEquals("Unexpected addressingRequirementParameter value: "
+ + addressingRequired,
+ AddressingConstants.ADDRESSING_REQUIRED, addressingRequired);
+ } catch (Exception e) {
+ System.out.println("Error in WSDL : " + testResourceFile.getName());
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+}
\ No newline at end of file
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?rev=903677&r1=903676&r2=903677&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Wed Jan 27 15:25:14 2010
@@ -20,6 +20,7 @@
package org.apache.axis2.jaxws;
import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.binding.BindingUtils;
import org.apache.axis2.jaxws.binding.SOAPBinding;
@@ -86,7 +87,12 @@
// Setting standard property defaults for the request context
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.FALSE);
requestContext.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
- requestContext.put(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+
+ // Addressing is disabled by default unless it is turned on in the WSDL
+ String addressingFlagFromWSDL = AddressingHelper.getAddressingRequirementParemeterValue(endpointDesc.getAxisService());
+ if(AddressingConstants.ADDRESSING_UNSPECIFIED.equals(addressingFlagFromWSDL)){
+ requestContext.put(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+ }
// Set the endpoint address
String endpointAddress = (epr != null ) ? epr.getAddress() : endpointDesc.getEndpointAddress();
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test" targetNamespace="http://test">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="input" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="echo"/>
+ </wsdl:message>
+ <wsdl:portType name="TestPortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input message="tns:echo"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestBinding" type="tns:TestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <soap:operation soapAction="http://test/echoString"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestService">
+ <wsdl:port binding="tns:TestBinding" name="TestPort">
+ <soap:address location="http://localhost:6060/axis2/services/EchoService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/Test.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test" targetNamespace="http://test" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="input" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="echo"/>
+ </wsdl:message>
+ <wsdl:portType name="TestPortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input message="tns:echo"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestBinding" type="tns:TestPortType">
+ <wsaw:UsingAddressing />
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <soap:operation soapAction="http://test/echoString"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestService">
+ <wsdl:port binding="tns:TestBinding" name="TestPort">
+ <soap:address location="http://localhost:6060/axis2/services/EchoService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressing.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test" targetNamespace="http://test" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="input" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="echo"/>
+ </wsdl:message>
+ <wsdl:portType name="TestPortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input message="tns:echo"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestBinding" type="tns:TestPortType">
+ <wsaw:UsingAddressing wsdl:required="false" />
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <soap:operation soapAction="http://test/echoString"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestService">
+ <wsdl:port binding="tns:TestBinding" name="TestPort">
+ <soap:address location="http://localhost:6060/axis2/services/EchoService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingOptional.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl Wed Jan 27 15:25:14 2010
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test" targetNamespace="http://test" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="input" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="echo"/>
+ </wsdl:message>
+ <wsdl:portType name="TestPortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input message="tns:echo"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestBinding" type="tns:TestPortType">
+ <wsaw:UsingAddressing wsdl:required="true" />
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <soap:operation soapAction="http://test/echoString"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="TestService">
+ <wsdl:port binding="tns:TestBinding" name="TestPort">
+ <soap:address location="http://localhost:6060/axis2/services/EchoService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Propchange: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/UsingAddressingRequired.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java Wed Jan 27 15:25:14 2010
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.addressing;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace="http://test",
+ serviceName="TestService",
+ portName="TestPort")
+public interface Sample {
+
+ public String echoString(String input);
+
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/Sample.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java?rev=903677&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java Wed Jan 27 15:25:14 2010
@@ -0,0 +1,171 @@
+/*
+ * 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.addressing;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.AddressingConstants;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+
+public class UsingAddressingTests extends TestCase {
+
+ public QName serviceQName;
+
+ public QName portQName;
+
+ public UsingAddressingTests(String name) {
+ super(name);
+
+ serviceQName = new QName("http://test", "TestService");
+ portQName = new QName("http://test", "TestPort");
+ }
+
+ public void testDispatchAddressingDisabledByDefault() {
+ Service svc = Service.create(serviceQName);
+ svc.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, "");
+
+ Dispatch dsp = svc.createDispatch(portQName, Source.class,
+ Service.Mode.MESSAGE);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) dsp;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ assertTrue("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ }
+
+ public void testProxyAddressingDisabledByDefault() {
+ Service svc = Service.create(serviceQName);
+ Sample s = svc.getPort(Sample.class);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) s;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ assertTrue("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ }
+
+ // Check addressing is disabled when <wsaw:UsingAddressing /> is NOT used in
+ // the WSDL
+ public void testWithoutUsingAddressing() {
+ String wsdlLocation = "file:///" + System.getProperty("basedir", ".")
+ + "/" + "test-resources/wsdl/Test.wsdl";
+ try {
+ Service svc = Service.create(new URL(wsdlLocation), serviceQName);
+ Sample s = svc.getPort(portQName, Sample.class);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) s;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ assertTrue("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ } catch (MalformedURLException e) {
+ System.out.println("Error in WSDL : " + wsdlLocation);
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check addressing is enabled when <wsaw:UsingAddressing /> is used in the
+ // WSDL.
+ public void testUsingAddressing() {
+ String wsdlLocation = "file:///" + System.getProperty("basedir", ".")
+ + "/" + "test-resources/wsdl/UsingAddressing.wsdl";
+ try {
+ Service svc = Service.create(new URL(wsdlLocation), serviceQName);
+ Sample s = svc.getPort(portQName, Sample.class);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) s;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ // Do NOT change this to assertFalse since this allows us to
+ // differentiate from addressing being enabled by JAX-WS 2.1
+ // features and annotations which override the WSDL.
+ assertNull("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ } catch (MalformedURLException e) {
+ System.out.println("Error in WSDL : " + wsdlLocation);
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check addressing is enabled when <wsaw:UsingAddressing
+ // wsdl:required="false" /> is used in the WSDL
+ public void testUsingAddressingOptional() {
+ String wsdlLocation = "file:///" + System.getProperty("basedir", ".")
+ + "/" + "test-resources/wsdl/UsingAddressingOptional.wsdl";
+ try {
+ Service svc = Service.create(new URL(wsdlLocation), serviceQName);
+ Sample s = svc.getPort(portQName, Sample.class);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) s;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ // Do NOT change this to assertFalse since this allows us to
+ // differentiate from addressing being enabled by JAX-WS 2.1
+ // features and annotations which override the WSDL.
+ assertNull("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ } catch (MalformedURLException e) {
+ System.out.println("Error in WSDL : " + wsdlLocation);
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+
+ // Check addressing is enabled when <wsaw:UsingAddressing
+ // wsdl:required="true" /> is used in the WSDL
+ public void testUsingAddressingRequired() {
+ String wsdlLocation = "file:///" + System.getProperty("basedir", ".")
+ + "/" + "test-resources/wsdl/UsingAddressingRequired.wsdl";
+ try {
+ Service svc = Service.create(new URL(wsdlLocation), serviceQName);
+ Sample s = svc.getPort(portQName, Sample.class);
+
+ org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) s;
+
+ Boolean addressingDisabled = (Boolean) bp.getRequestContext().get(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ // Do NOT change this to assertFalse since this allows us to
+ // differentiate from addressing being enabled by JAX-WS 2.1
+ // features and annotations which override the WSDL.
+ assertNull("Unexpected disableAddressingForOutMessages value: "
+ + addressingDisabled, addressingDisabled);
+ } catch (MalformedURLException e) {
+ System.out.println("Error in WSDL : " + wsdlLocation);
+ System.out.println("Exception: " + e.toString());
+ fail("Caught exception " + e.toString());
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/addressing/UsingAddressingTests.java
------------------------------------------------------------------------------
svn:eol-style = native