any2api-generator-soap
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -83,11 +83,13 @@ var path = require('path'); | ||
def.wsdl_doc = ''; | ||
def.wsdl_doc = def.wsdl_doc || ''; | ||
if (!_.isEmpty(def.description)) def.wsdl_doc += 'Description: ' + def.description + '\n\n'; | ||
if (!_.isEmpty(def.default)) { | ||
if (S(def.type).toLowerCase().contains('json')) { | ||
def.wsdl_doc += 'Actual type: JSON\n\n'; | ||
def.wsdl_doc += 'Default value: ' + JSON.stringify(def.default) + '\n\n'; | ||
def.wsdl_default = def.wsdl_default || JSON.stringify(def.default); | ||
} else { | ||
def.wsdl_doc += 'Default value: ' + def.default + '\n\n'; | ||
def.wsdl_default = def.wsdl_default || def.default; | ||
} | ||
def.wsdl_default = S(def.wsdl_default).escapeHTML().s | ||
} | ||
@@ -105,4 +107,6 @@ | ||
def.wsdl_doc += '\n\nActual type: JSON'; | ||
if (!_.isEmpty(def.json_schema)) { | ||
def.wsdl_doc += 'JSON schema:\n' + JSON.stringify(def.json_schema, null, 2); | ||
def.wsdl_doc += '\n\nJSON schema:\n' + JSON.stringify(def.json_schema, null, 2); | ||
} | ||
@@ -121,3 +125,3 @@ } else if (S(def.type).toLowerCase().contains('xml')) { | ||
if (_.isEmpty(def.wsdl_doc.trim())) delete def.wsdl_doc; | ||
if (_.isEmpty(def.wsdl_doc)) delete def.wsdl_doc; | ||
//else def.wsdl_doc = S(def.wsdl_doc).escapeHTML().s; | ||
@@ -124,0 +128,0 @@ }); |
{ | ||
"name": "any2api-generator-soap", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"author": "Johannes Wettinger <mail@jojow.de>", | ||
@@ -5,0 +5,0 @@ "description": "SOAP/WSDL API implementation generator for any2api", |
@@ -23,4 +23,4 @@ var path = require('path'); | ||
var wsdl = fs.readFileSync(path.resolve(__dirname, 'spec.wsdl'), 'utf8'); | ||
wsdl = wsdl.replace(/{{baseAddress}}/g, baseAddress); | ||
var rawWsdl = fs.readFileSync(path.resolve(__dirname, 'spec.wsdl'), 'utf8'); | ||
var wsdl = rawWsdl.replace(/{{baseAddress}}/g, baseAddress); | ||
@@ -58,2 +58,5 @@ var apiSpec; | ||
} catch (err) { | ||
err.soapText = 'Parameter value ' + name + 'is not valid JSON: '; | ||
err.soapText += err.message || err.toString(); | ||
return callback(err); | ||
@@ -109,6 +112,6 @@ } | ||
Code: { | ||
Value: "soap:Sender", | ||
Subcode: { value: "rpc:Error" } | ||
Value: "soap:Sender" | ||
//, Subcode: { value: "soap:Error" } | ||
}, | ||
Reason: { Text: err } | ||
Reason: { Text: err.soapText || err.message || err.toString() } | ||
} | ||
@@ -127,5 +130,9 @@ }; | ||
//var tailoredWsdl = wsdl.replace(/{{baseAddress}}/g, 'http://' + req.headers.host); | ||
var tailoredWsdl = wsdl; | ||
res.write(wsdl); | ||
if (!process.env.BASE_ADDRESS) { | ||
tailoredWsdl = rawWsdl.replace(/{{baseAddress}}/g, 'http://' + req.headers.host); | ||
} | ||
res.write(tailoredWsdl); | ||
} else { | ||
@@ -132,0 +139,0 @@ res.write('404 Not Found: ' + req.url); |
Sorry, the diff of this file is not supported yet
24130
355
19