[391170] WebServicesParser should convert the WSDL URI to a valid URI
diff --git a/bundles/org.eclipse.wst.ws.parser/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.ws.parser/META-INF/MANIFEST.MF
index 4f30eea..e662fcd 100644
--- a/bundles/org.eclipse.wst.ws.parser/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.ws.parser/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.wst.ws.parser
-Bundle-Version: 1.0.403.qualifier
+Bundle-Version: 1.0.500.qualifier
Bundle-Activator: org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/wsil/WebServicesParser.java b/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/wsil/WebServicesParser.java
index 9aa2fea..61f14a8 100644
--- a/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/wsil/WebServicesParser.java
+++ b/bundles/org.eclipse.wst.ws.parser/src/org/eclipse/wst/ws/internal/parser/wsil/WebServicesParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
* 20060711 150301 pmoogk@ca.ibm.com - Peter Moogk
* 20060818 154393 pmoogk@ca.ibm.com - Peter Moogk
* 20060906 156420 pmoogk@ca.ibm.com - Peter Moogk
+ * 20121004 385354 kchong@ca.ibm.com - Keith Chong
*******************************************************************************/
package org.eclipse.wst.ws.internal.parser.wsil;
@@ -228,7 +229,7 @@
ByteArrayInputStream bais = new ByteArrayInputStream(b);
WSDLFactory factory = WSDLPlugin.INSTANCE.createWSDL4JFactory();
WSDLReader wsdlReader = factory.newWSDLReader();
- definition = wsdlReader.readWSDL(wsdlURI, new InputSource(bais));
+ definition = wsdlReader.readWSDL(wsdlURI.replace('\\', '/'), new InputSource(bais));
wsEntity.setType(WebServiceEntity.TYPE_WSDL);
wsEntity.setModel(definition);
}
diff --git a/features/org.eclipse.wst.ws_core.feature/feature.xml b/features/org.eclipse.wst.ws_core.feature/feature.xml
index 19031b8..e764d1d 100644
--- a/features/org.eclipse.wst.ws_core.feature/feature.xml
+++ b/features/org.eclipse.wst.ws_core.feature/feature.xml
@@ -1,155 +1,155 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.wst.ws_core.feature"
- label="%featureName"
- version="3.4.0.qualifier"
- provider-name="%providerName"
- license-feature="org.eclipse.license"
- license-feature-version="1.0.0.qualifier">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <includes
- id="org.eclipse.wst.ws_wsdl15.feature"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.command.env"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.command.env.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.codec"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.ws"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.ws.parser"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.wsdl"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.wsdl.validation"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.wsi"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.logging"
- download-size="0"
- install-size="0"
- version="1.0.4.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.apache.log4j"
- download-size="0"
- install-size="0"
- version="1.2.15.qualifier"
- unpack="false"/>
-
- <plugin
- id="org.apache.wsil4j"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.uddi4j"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.commons.discovery"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="javax.xml.rpc"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="javax.xml.soap"
- download-size="0"
- install-size="0"
- version="1.2.0.qualifier"/>
-
- <plugin
- id="org.apache.axis"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="javax.mail"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="javax.activation"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.wst.ws.service.policy"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.wst.ws_core.feature"
+ label="%featureName"
+ version="3.4.2.qualifier"
+ provider-name="%providerName"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.0.qualifier">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.wst.ws_wsdl15.feature"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.command.env"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.command.env.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.codec"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.ws"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.ws.parser"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.wsi"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.logging"
+ download-size="0"
+ install-size="0"
+ version="1.0.4.qualifier"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.log4j"
+ download-size="0"
+ install-size="0"
+ version="1.2.15.qualifier"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.wsil4j"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.uddi4j"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.commons.discovery"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="javax.xml.rpc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="javax.xml.soap"
+ download-size="0"
+ install-size="0"
+ version="1.2.0.qualifier"/>
+
+ <plugin
+ id="org.apache.axis"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="javax.mail"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.activation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.ws.service.policy"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.wst.ws_tests.feature/feature.xml b/features/org.eclipse.wst.ws_tests.feature/feature.xml
index ee041c5..a9c9446 100644
--- a/features/org.eclipse.wst.ws_tests.feature/feature.xml
+++ b/features/org.eclipse.wst.ws_tests.feature/feature.xml
@@ -1,58 +1,58 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.wst.ws_tests.feature"
- label="%featureName"
- version="3.0.600.qualifier"
- provider-name="%providerName"
- license-feature="org.eclipse.license"
- license-feature-version="1.0.0.qualifier">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <plugin
- id="org.eclipse.wst.ws.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.wsdl.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.wsdl.tests.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.wsdl.validation.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.wsi.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.wsdl.ui.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
-</feature>
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.wst.ws_tests.feature"
+ label="%featureName"
+ version="3.0.700.qualifier"
+ provider-name="%providerName"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.0.qualifier">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="license.html">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.wst.ws.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl.tests.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl.validation.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.wsi.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.wst.wsdl.ui.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+</feature>
diff --git a/tests/org.eclipse.wst.ws.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.ws.tests/META-INF/MANIFEST.MF
index 79190a4..0b1232a 100644
--- a/tests/org.eclipse.wst.ws.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.wst.ws.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.wst.ws.tests; singleton:=true
-Bundle-Version: 1.0.302.qualifier
+Bundle-Version: 1.0.400.qualifier
Bundle-Activator: org.eclipse.wst.ws.tests.plugin.TestsPlugin
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-Localization: plugin
@@ -22,7 +22,9 @@
org.eclipse.wst.command.env.ui,
org.eclipse.wst.common.environment,
org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.wst.ws.parser,
+ javax.wsdl;bundle-version="[1.5.0,1.6.0)"
Eclipse-LazyStart: true
Export-Package: org.eclipse.wst.ws.test.popup,
org.eclipse.wst.ws.tests.data,
diff --git a/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsecommonbindings.wsdl b/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsecommonbindings.wsdl
new file mode 100644
index 0000000..37f5dd2
--- /dev/null
+++ b/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsecommonbindings.wsdl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/AreaService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="wsparsecommonbindings" targetNamespace="http://tempuri.org/AreaService/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://tempuri.org/AreaService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="area" type="xsd:float"/>
+ <xsd:element name="parameters" type="tns:dimensions"/>
+ <xsd:complexType name="dimensions">
+ <xsd:sequence>
+ <xsd:element name="width" type="xsd:float"></xsd:element>
+ <xsd:element name="height" type="xsd:float"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="CalculateRectAreaResponse">
+ <wsdl:part element="tns:area" name="area"/>
+ </wsdl:message>
+ <wsdl:message name="CalculateRectAreaRequest">
+ <wsdl:part element="tns:parameters" name="parameters"/>
+ </wsdl:message>
+ <wsdl:portType name="AreaService">
+ <wsdl:operation name="CalculateRectArea">
+ <wsdl:input message="tns:CalculateRectAreaRequest"/>
+ <wsdl:output message="tns:CalculateRectAreaResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AreaServiceSOAP" type="tns:AreaService">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="CalculateRectArea">
+ <soap:operation soapAction="http://tempuri.org/AreaService/NewOperation"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+</wsdl:definitions>
diff --git a/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsetest.wsdl b/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsetest.wsdl
new file mode 100644
index 0000000..281a121
--- /dev/null
+++ b/tests/org.eclipse.wst.ws.tests/data/Bug391170/wsparsetest.wsdl
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/AreaService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AreaService" targetNamespace="http://tempuri.org/AreaService/">
+<wsdl:import namespace="http://tempuri.org/AreaService/" location="wsparsecommonbindings.wsdl"/>
+ <wsdl:service name="AreaService">
+ <wsdl:port binding="tns:AreaServiceSOAP" name="AreaServiceSOAP">
+ <soap:address location="http://tempuri.org"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.ws.tests/tests/org/eclipse/wst/ws/tests/unittest/Bug391170ParserTest.java b/tests/org.eclipse.wst.ws.tests/tests/org/eclipse/wst/ws/tests/unittest/Bug391170ParserTest.java
new file mode 100644
index 0000000..6ff9515
--- /dev/null
+++ b/tests/org.eclipse.wst.ws.tests/tests/org/eclipse/wst/ws/tests/unittest/Bug391170ParserTest.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20120531 xxxxxx jenyoung@ca.ibm.com - Jennifer Young
+ *******************************************************************************/
+
+package org.eclipse.wst.ws.tests.unittest;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.wst.ws.tests.plugin.TestsPlugin;
+import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt;
+
+public class Bug391170ParserTest extends TestCase {
+
+ private final String ACTUAL_TESTFILEPATH = "data\\Bug391170\\wsparsetest.wsdl";
+
+ public static Test suite(){
+ return new TestSuite(Bug391170ParserTest.class);
+ }
+ /*
+ * Test if WebServicesParser.getWSDLDefinition method
+ * returns a valid Definition object when the URI parameter
+ * passed in contains back slashes. In this case,
+ * the test wsdl file is referencing a binding that is
+ * in another wsdl file. When backslashes are used for the
+ * URI, it cannot find the referenced binding and port.getbinding
+ * returns null. In this test case, we are verifying that
+ * after the fix (replace backslashes with forward slashes
+ * prior to reading the wsdl file in WebServicesParser.getWSDLDefinition),
+ * port.getBinding() no longer returns null.
+ */
+ public void testGetWSDLDefinition(){
+
+ String wsdlPath = getInstallURL() + ACTUAL_TESTFILEPATH;
+ wsdlPath=wsdlPath.replace('/', '\\');
+ wsdlPath = "file:/" + wsdlPath.substring(1);
+ WebServicesParser webServicesParser = new WebServicesParserExt();
+ Definition definition = webServicesParser.getWSDLDefinition(wsdlPath);
+ if (definition.getServices()!=null) {
+ Collection serviceValues = definition.getServices().values();
+
+ Iterator serviceIter = serviceValues.iterator();
+ while(serviceIter.hasNext()){
+ Service service = (Service) serviceIter.next();
+
+ Collection servicePorts = service.getPorts().values();
+ Iterator portIter = servicePorts.iterator();
+ while(portIter.hasNext()){
+ Port port = (Port)portIter.next();
+ assertNotNull(port.getBinding());
+ }
+ }
+ }
+ }
+
+ private String getInstallURL(){
+ URL url;
+ try {
+ url = FileLocator.resolve(TestsPlugin.getDefault().getBundle().getEntry("/"));
+ } catch (IOException e) {
+ return null;
+ }
+ return url.getPath();
+ }
+
+}