Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow includes to be relative paths for local files.

  • Loading branch information...
commit 289ed3082ddf0963ee209736fa563343e5c53529 1 parent a8b8552
@alnorth alnorth authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 lib/wsdl.js
View
21 lib/wsdl.js
@@ -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 = {
@@ -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)) {
+ 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) {
Please sign in to comment.
Something went wrong with that request. Please try again.