Permalink
Browse files

code pretty

  • Loading branch information...
1 parent 78374d9 commit ed55853af955a27a17eb9c970b36782f0c903aa8 Marc Greenstock committed May 10, 2011
Showing with 15 additions and 15 deletions.
  1. +15 −15 lib/douche/wsdl.js
View
@@ -9,7 +9,7 @@ var WSDL = function(href) {
this.operations = {};
this.endpoint = '';
this.element_form_default = 'unqualified';
-}
+};
module.exports = WSDL;
@@ -21,40 +21,40 @@ WSDL.prototype.parse = function(cb) {
self._read_xml(xml);
cb(self);
});
-}
+};
WSDL.prototype._read_xml = function(attrs) {
var self = this;
var types_tag = this._read_tag(attrs,'types','http://schemas.xmlsoap.org/wsdl/');
var schema_tag = this._read_tag(types_tag,'schema','http://www.w3.org/2001/XMLSchema');
- this.element_form_default = schema_tag['@']['elementFormDefault'] || this.element_form_default;
+ this.element_form_default = schema_tag['@'].elementFormDefault || this.element_form_default;
var binding_tag = this._read_tag(attrs,'binding','http://schemas.xmlsoap.org/wsdl/');
var operation_tag = this._read_tag(binding_tag,'operation','http://schemas.xmlsoap.org/wsdl/');
if(operation_tag instanceof Array) {
operation_tag.forEach(function(operation_tag,index) {
- var name = operation_tag['@']['name'];
- var soap_action = self._read_tag(operation_tag,'operation','http://schemas.xmlsoap.org/wsdl/soap/')['@']['soapAction'];
+ var name = operation_tag['@'].name;
+ var soap_action = self._read_tag(operation_tag,'operation','http://schemas.xmlsoap.org/wsdl/soap/')['@'].soapAction;
self.operations[name] = {
soap_action: soap_action
};
});
} else {
- var name = operation_tag['@']['name'];
- var soap_action = self._read_tag(operation_tag,'operation','http://schemas.xmlsoap.org/wsdl/soap/')['@']['soapAction'];
+ var name = operation_tag['@'].name;
+ var soap_action = self._read_tag(operation_tag,'operation','http://schemas.xmlsoap.org/wsdl/soap/')['@'].soapAction;
self.operations[name] = {
soap_action: soap_action
};
}
var service_tag = this._read_tag(attrs,'service','http://schemas.xmlsoap.org/wsdl/');
var port_tag = this._read_tag(service_tag,'port','http://schemas.xmlsoap.org/wsdl/');
- this.endpoint = this._read_tag(port_tag,'address','http://schemas.xmlsoap.org/wsdl/soap/')['@']['location'];
+ this.endpoint = this._read_tag(port_tag,'address','http://schemas.xmlsoap.org/wsdl/soap/')['@'].location;
return;
-}
+};
WSDL.prototype._read_tag = function(attrs,tag_name,namespace) {
for(var prefix in this.namespaces) {
@@ -67,7 +67,7 @@ WSDL.prototype._read_tag = function(attrs,tag_name,namespace) {
}
}
return false;
-}
+};
WSDL.prototype._read_namespaces = function(attrs) {
var self = this;
@@ -76,21 +76,21 @@ WSDL.prototype._read_namespaces = function(attrs) {
self.target_namespace = url;
}
if(index == 'xmlns') {
- self.namespaces['_xmlns'] = url;
+ self.namespaces._xmlns = url;
}
- if(index.indexOf('xmlns:') == 0) {
+ if(index.indexOf('xmlns:') === 0) {
self.namespaces[index.split(':')[1]] = url;
}
});
-}
+};
WSDL.prototype._get = function(cb) {
var url_parts = url.parse(this.href);
http.get({
host: url_parts.host,
port: url_parts.port || 80,
- path: (url_parts.pathname || '/') + (url_parts.search || ''),
+ path: (url_parts.pathname || '/') + (url_parts.search || '')
}, function(res) {
var xml = '';
res.setEncoding('utf8');
@@ -104,4 +104,4 @@ WSDL.prototype._get = function(cb) {
}).on('error', function(err) {
cb(err,null);
});
-}
+};

0 comments on commit ed55853

Please sign in to comment.