Skip to content

Commit

Permalink
Merge pull request vpulim#97 from alnorth29/master
Browse files Browse the repository at this point in the history
Allow relative files paths for local includes
  • Loading branch information
milewise committed Oct 17, 2012
2 parents bf6455a + a7bd3c2 commit 8c10fa4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/wsdl.js
Expand Up @@ -8,6 +8,7 @@ var expat = require('node-expat'),
http = require('./http'),
fs = require('fs'),
url = require('url'),
path = require('path'),
assert = require('assert').ok;

var Primitives = {
Expand Down Expand Up @@ -629,16 +630,24 @@ WSDL.prototype._processNextInclude = function(includes, callback) {
include = includes.shift();

if (!include) return callback()
open_wsdl(url.resolve(self.uri, include.location), function(err, wsdl) {
if (err) {
return callback(err);
}


var includePath;
if (!/^http/.test(self.uri) && !/^http/.test(include.location)) {
includePath = path.resolve(path.dirname(self.uri), include.location);
} else {
includePath = url.resolve(self.uri, include.location);
}

open_wsdl(includePath, function(err, wsdl) {
if (err) {
return callback(err);
}

self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace] = wsdl.definitions;
self._processNextInclude(includes, function(err) {
callback(err);
})
});
});
}

WSDL.prototype.processIncludes = function(callback) {
Expand Down

0 comments on commit 8c10fa4

Please sign in to comment.