sekken
sekken copied to clipboard
Schema files from local file system
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?
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!
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.
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.
I believe it's true that File.read respects Windows style paths, so that seems reasonable.