sekken icon indicating copy to clipboard operation
sekken copied to clipboard

Schema files from local file system

Open tsujigiri opened this issue 11 years ago • 4 comments

I would like to keep a copy of a WSDL and its schema files in my local file system. I can load a local WSDL by just passing the path into Sekken.new, the resolver lets me. To do the same with the associated schema files I replaced the schemaLocation attributes to have the local paths as values. The problem is, that this prevents me from importing them.

What is the reason for limting the schema locations to http URLs?

tsujigiri avatar Sep 10 '14 12:09 tsujigiri

I believe the reason for limiting schema locations to URLs is that it's pretty common for services to provide a WSDL (and that this WSDL can change arbitrarily, since it's server hosted content).

I think it's fairly reasonable to want to load your WSDL and schema files from your filesystem. Taking a look at this code, it seems like it's trying to only load absolute URLs (e.g.: it skips relative urls like /foo). File URLs are an interesting edge case in that determining relative versus absolute requires knowing the system (since / is root on unix and on windows it would look like C:\).

If you're up to submitting a pull request for allowing schema files from the local file system, I'd be more than happy to merge that in!

tjarratt avatar Sep 22 '14 19:09 tjarratt

Additionally, @rubiii has done the lion's share of the work on Sekken, née Savon v3, so he might have some additional insight into why loading Schema files is different. In my opinion, looking at this for all of several minutes, it appears to just be a simple oversight.

tjarratt avatar Sep 22 '14 19:09 tjarratt

Since everything that doesn't look like a URL or XML is passed dierectly into File.read, it should work on any system as long as the paths in the schemaLocation match the system. Assuming, File.read uses Windows-style paths on Windows for example. Hence, as a patch, I would simply remove the absolute path check.

tsujigiri avatar Sep 23 '14 07:09 tsujigiri

I believe it's true that File.read respects Windows style paths, so that seems reasonable.

tjarratt avatar Sep 23 '14 07:09 tjarratt