Comparing version 2.0.0 to 2.0.1
# easysoap changelog | ||
## 2.0.1 | ||
* bugfix: "getRequestXml" is not defined on SoapRequest | ||
## 2.0.0 | ||
@@ -4,0 +7,0 @@ urgent needed cleanup release, |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "./src/index.js", | ||
@@ -14,7 +14,6 @@ "dependencies": { | ||
"underscore": "^1.8.3", | ||
"wsdlrdr": "^0.3.9", | ||
"wsdlrdr": "^0.4.0", | ||
"xmldoc": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"tap-spec": "latest", | ||
"tape": "latest", | ||
@@ -40,3 +39,3 @@ "eslint": "latest", | ||
"scripts": { | ||
"test": "node ./tests/tests.js | tap-spec" | ||
"test": "node ./tests/tests.js" | ||
}, | ||
@@ -43,0 +42,0 @@ "license": "MIT", |
@@ -5,6 +5,15 @@ # EasySoap | ||
##### Support | ||
##### [Buy me a Coffee](https://www.patreon.com/moszeed) | ||
## How to get ? | ||
install with npm | ||
npm i easysoap | ||
```shell | ||
npm i easysoap | ||
``` | ||
## Usage | ||
@@ -17,3 +26,3 @@ | ||
**params** createParams, soapOptions | ||
**params** createParams, soapOptions | ||
**response** instance of easysoap | ||
@@ -41,8 +50,8 @@ | ||
#### *call* | ||
**params** callParams | ||
**response** callResponseObject | ||
**params** callParams | ||
**response** callResponseObject | ||
#### *getRequestXml* | ||
**params** callParams | ||
**response** xml (string) | ||
**params** callParams | ||
**response** xml (string) | ||
@@ -59,3 +68,3 @@ *callParams* | ||
#### *getXmlDataAsJson* | ||
**params** xml (string) | ||
**params** xml (string) | ||
**response** xmldata as json | ||
@@ -67,3 +76,3 @@ | ||
#### *getMethodParamsByName* | ||
**params** methodName (string) | ||
**params** methodName (string) | ||
**response** methodParams (object) | ||
@@ -76,3 +85,3 @@ | ||
const EasySoap = require('easysoap'); | ||
// define soap params | ||
@@ -83,3 +92,3 @@ const params = { | ||
wsdl: '/path/wsdl/', | ||
// set soap headers (optional) | ||
@@ -92,3 +101,3 @@ headers: [{ | ||
} | ||
/* | ||
@@ -95,0 +104,0 @@ * create the client |
@@ -189,3 +189,15 @@ (() => { | ||
async function getRequestXml (params = {}, defaultParams = {}, opts = {}) { | ||
function SoapRequest (params = {}, opts = {}) { | ||
if (!(this instanceof SoapRequest)) return new SoapRequest(params, opts); | ||
this._url = getProtocol(opts) + params.host + params.path; | ||
this._headers = { | ||
'Content-Type': 'text/xml; charset=utf-8' | ||
}; | ||
this._opts = opts; | ||
this._params = params; | ||
}; | ||
SoapRequest.prototype.getRequestXml = async function (params = {}, defaultParams = {}, opts = {}) { | ||
const combinedParams = Object.assign({}, defaultParams, params); | ||
@@ -213,14 +225,2 @@ | ||
function SoapRequest (params = {}, opts = {}) { | ||
if (!(this instanceof SoapRequest)) return new SoapRequest(params, opts); | ||
this._url = getProtocol(opts) + params.host + params.path; | ||
this._headers = { | ||
'Content-Type': 'text/xml; charset=utf-8' | ||
}; | ||
this._opts = opts; | ||
this._params = params; | ||
}; | ||
SoapRequest.prototype.call = async function (params = {}) { | ||
@@ -231,8 +231,12 @@ const self = this; | ||
if (params.headers) { | ||
params.headers.forEach((headerItem) => { | ||
self._headers[headerItem.name] = headerItem.value; | ||
}); | ||
if (Array.isArray(params.headers)) { | ||
params.headers.forEach((headerItem) => { | ||
self._headers[headerItem.name] = headerItem.value; | ||
}); | ||
} else { | ||
self._headers = params.headers; | ||
} | ||
} | ||
const requestXml = await getRequestXml(params, this._params, this._opts); | ||
const requestXml = await self.getRequestXml(params, this._params, this._opts); | ||
const result = await asyncRequest({ | ||
@@ -239,0 +243,0 @@ url : this._url, |
@@ -9,10 +9,2 @@ (() => { | ||
[{ | ||
host : 'www.webservicex.net', | ||
path : '/globalweather.asmx', | ||
wsdl : '/globalweather.asmx?WSDL', | ||
headers: { | ||
'SOAPAction': 'http://www.webserviceX.NET/GetWeather' | ||
} | ||
}], | ||
[{ | ||
host: 'webservices.oorsprong.org', | ||
@@ -56,9 +48,7 @@ path: '/websamples.countryinfo/CountryInfoService.wso', | ||
try { | ||
const runtime = soapClients.map( | ||
(soapClient) => soapClient.instance.getAllFunctions().then((functionArray) => { | ||
var arrLength = functionArray.length; | ||
t.ok(arrLength !== 0, `${arrLength} functions (${soapClient.instance._params.host})`); | ||
}) | ||
); | ||
await Promise.all(runtime); | ||
for (let soapClient of soapClients) { | ||
t.comment(`=> ${soapClient.instance._params.host}`); | ||
let functionsAsArray = await soapClient.instance.getAllFunctions(); | ||
t.ok(functionsAsArray.length !== 0, `${functionsAsArray.length} functions (${soapClient.instance._params.host})`); | ||
} | ||
@@ -78,3 +68,3 @@ t.end(); | ||
const response = await soapClient.instance.call({ | ||
const callParams = { | ||
method : 'NumberToDollars', | ||
@@ -87,4 +77,5 @@ attributes: { | ||
} | ||
}); | ||
}; | ||
const response = await soapClient.instance.call(callParams); | ||
t.ok(response.data.NumberToDollarsResponse.NumberToDollarsResult, 'got a number conversion'); | ||
@@ -91,0 +82,0 @@ t.end(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7
145
0
22500
8
404
+ Addedwsdlrdr@0.4.0(transitive)
- Removedsax@1.1.6(transitive)
- Removedwsdlrdr@0.3.9(transitive)
- Removedxmldoc@0.4.0(transitive)
Updatedwsdlrdr@^0.4.0