Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 103306

Summary: Failure when importing a WSDL file in another WSDL for WTP > M4
Product: [WebTools] WTP Webservices Reporter: Nicolas Mailhot <nicolas.mailhot>
Component: wst.wsdlAssignee: Nitin Dahyabhai <thatnitind>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: david_williams, lmandel
Version: 0.7   
Target Milestone: 1.0 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Imported wsdl
none
Importing wsdl
none
Additional test case
none
The files Alexis provided in a Web project
none
patch for ComponentResolver
none
patch for FileBufferModelManager none

Description Nicolas Mailhot CLA 2005-07-11 07:37:47 EDT
I have a WSDL file that references another WSDL file. Both are located in the
same dirctory.

Under WTP 1.0 M4 all is fine and dandy and the WSDL file validate
Under WTP 1.0 M5 the same file does not validate and eclipse complains that :

The 'messages-0.2.wsdl' document could not be imported. Check that the document
exists and that the location is correct.	bindings-0.2.wsdl	SPP/wsdl	line 11	11
juillet 2005 13:29:38

I have both versions of WTP installed in parallel so I can confirm this is a
regression, not some wsdl that changed between the checks
Comment 1 Craig Salter CLA 2005-07-19 13:26:38 EDT
Nicholas, can you please supply WSDL files that demonstrate this problem and
attach them to this bug?
Comment 2 Nicolas Mailhot CLA 2005-07-20 05:09:04 EDT
Reproduced with WTP 0.7RC1
Attached two simple wsdl that serve as test case. Just put them in the same dir
and validate the test one
Comment 3 Nicolas Mailhot CLA 2005-07-20 05:10:30 EDT
Created attachment 25033 [details]
Imported wsdl
Comment 4 Nicolas Mailhot CLA 2005-07-20 05:22:55 EDT
Created attachment 25034 [details]
Importing wsdl
Comment 5 Alexis Biller CLA 2005-07-21 06:56:21 EDT
Created attachment 25123 [details]
Additional test case
Comment 6 Alexis Biller CLA 2005-07-21 06:57:57 EDT
(In reply to comment #0)

I have encountered same bug, having migrated from WTP 1.0 M4 to M5 - identical
warning/error.

warning: The '.ProjectStuff/wsdl' document could not be imported. Check that the
document exists and that the location is correct.

This then led to further warning/error in other schemas as it failed to read
references to the File.wsdl document.

Attached sample files as 103306-ab.zip
Comment 7 Lawrence Mandel CLA 2005-07-21 18:52:42 EDT
Changing severity to P2. This is a significant problem for the WSDL validator.
Comment 8 Lawrence Mandel CLA 2005-07-21 19:18:09 EDT
Fixed in RC2. Fix committed 20050721 7:15pm EDT.
Comment 9 Alexis Biller CLA 2005-07-25 09:14:33 EDT
Problem still observed in nightly build on Friday 22 July and also in more
recent 0.7RC3. Workaround is to use M4 (or earlier) release.

Sent real wsdl by email to Lawrence (not uploaded due to confidential status).
Note - I have insufficient priviledge to reopen bug.
Comment 10 Nicolas Mailhot CLA 2005-07-25 10:53:40 EDT
Just ask
Comment 11 Lawrence Mandel CLA 2005-07-25 12:20:35 EDT
Alexis, I checked the sample docs you attached to this bug report. The namespace
in PStructDo.xsd is defined incorrectly (based on how it is imported into the
other documents). Changing the target namespace from 

http://www.projectstuff.org/schemas/version02/PStructDo.xsd
to 
http://www.projectstuff.org/schemas/version00/PStructDo.xsd

allows all the files to validate correctly. 

Nicolas, can you reproduce this problem on RC3?

Alexis (and Nicolas) can you tell me what Java runtime you are using?
Comment 12 Lawrence Mandel CLA 2005-07-26 00:59:08 EDT
Created attachment 25287 [details]
The files Alexis provided in a Web project

The problem only occurs in Web projects. This Web project reproduces the
problem.
Comment 13 Lawrence Mandel CLA 2005-07-26 01:03:33 EDT
The source of the problem is the component resolver which was added between M4
and M5. The resolver returns local results with the "file://" protocol which, as
the comments in the resolver itself state,
"On Win32, 2 slashes results in a URL object where the volume is stripped out of
the file path as the host name"
This causes the XSD and WSDL validators to fail for the Web project I've
attached. The fix is to change the 
private static final String FILE_PROTOCOL = "file://"; //$NON-NLS-1$
to
private static final String FILE_PROTOCOL = "file:///"; //$NON-NLS-1$

Nitin, I'm reassigning to you as from what I can tell you own this component. Is
there a reason the component resolver uses two slashes? Is there a reason the
component resolver is doing simple resource resolution (in this case, just
relative to the base directory) when the URI resolver framework already handles
this case?
Comment 14 Lawrence Mandel CLA 2005-07-26 01:04:47 EDT
I'm marking as critical as this defect breaks WSDL and XSD validation in Web
projects.
Comment 15 Arthur Ryman CLA 2005-07-26 10:47:01 EDT
+1
Comment 16 Nicolas Mailhot CLA 2005-07-26 12:03:36 EDT
In case it still makes a difference I'm using Sun 1.5.0_03-b07 under win32.

My next WTP download window will be the 28 (western europe time)
Comment 17 Nitin Dahyabhai CLA 2005-07-26 12:43:40 EDT
Lawrence, the resolver is doing the relative resolution because the relative
paths in the workspace won't necessarily be the same paths as on the server.

The use of two slashes came from debugging the common resolver results on
Windows and Linux and finding that the resulting number of slashes was
inconsistent across platforms if the query itself didn't begin with two slashes.
 The use of two slashes was adopted in the SSE
FileBufferModelManager.CommonURIResolver for that reason and the
ComponentResolver was written to handle two slashes as a result.  Changing both
classes to use three slashes appears to have the desired behavior, now.
Comment 18 Nitin Dahyabhai CLA 2005-07-26 12:58:23 EDT
Created attachment 25310 [details]
patch for ComponentResolver
Comment 19 Nitin Dahyabhai CLA 2005-07-26 12:58:36 EDT
Created attachment 25311 [details]
patch for FileBufferModelManager
Comment 20 Nitin Dahyabhai CLA 2005-07-26 13:01:25 EDT
Committing.  David please release.
Comment 21 Nicolas Mailhot CLA 2005-07-28 05:00:32 EDT
I can confirm my testcase works with RC4
Comment 22 Alexis Biller CLA 2005-07-28 08:32:21 EDT
Tested OK on both 0.7RC4 and 0.7RC5.
Nice work!
Comment 23 Lawrence Mandel CLA 2005-07-28 09:51:35 EDT
I'm changing the bug status to verified as both Nicolas and Alexis have verified
the fix.
Comment 24 Lawrence Mandel CLA 2005-07-28 09:51:45 EDT
Closing bug.