Comparing version 0.0.3 to 0.0.4
@@ -41,3 +41,3 @@ const request = require('request'); | ||
envelope(operation, body, options) { | ||
var xml = '<?xml version="1.0" encoding="UTF-8"?>'; | ||
let xml = '<?xml version="1.0" encoding="UTF-8"?>'; | ||
xml += '<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + | ||
@@ -79,4 +79,4 @@ 'xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" ' + this.namespaces(options.namespaces) + '>'; | ||
namespaces(ns) { | ||
var attributes = ''; | ||
for (var name in ns) { | ||
let attributes = ''; | ||
for (let name in ns) { | ||
attributes += name + '="' + ns[name] + '" '; | ||
@@ -92,3 +92,3 @@ } | ||
gunzip(callback) { | ||
var gunzip = zlib.createGunzip(); | ||
let gunzip = zlib.createGunzip(); | ||
gunzip.on('error', callback); | ||
@@ -95,0 +95,0 @@ return gunzip; |
{ | ||
"name": "handsoap", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A (really) simple soap client", | ||
@@ -5,0 +5,0 @@ "main": "handsoap.js", |
# handsoap | ||
## Basic Usage | ||
```javascript | ||
@@ -7,4 +9,2 @@ const handsoap = require('handsoap'); | ||
const url = 'MY URL'; | ||
const operation = 'MyOper'; | ||
const action = 'MyAction'; | ||
const body = { | ||
@@ -23,3 +23,6 @@ some: { | ||
}, | ||
namespace: 'MyNamespace' | ||
namespaces: [ | ||
'MyNameSpace': 'My.Name.Space', | ||
'MyNameSpace2': 'My.Name.Space.2' | ||
] | ||
} | ||
@@ -34,1 +37,35 @@ | ||
``` | ||
## Wrapper Example | ||
```javascript | ||
// definition | ||
const handsoap = require('handsoap'); | ||
HandSoapWrapper = function(url, options, auth) { | ||
this.url = url; | ||
this.options = options; | ||
this.auth = auth; | ||
}; | ||
HandSoapWrapper.prototype._wrapRequest = function(operation, action, body) { | ||
return handsoap(this.url, operation, action, body, this.options, this.auth); | ||
} | ||
HandSoapWrapper.prototype.myOperation = function(body) { | ||
const operation = 'MyOper'; | ||
const action = 'MyAction'; | ||
return this._wrapRequest(operation, action, body); | ||
} | ||
// usage | ||
const handSoapWrapper = new HandSoapWrapper() | ||
handSoapWrapper.myOperation(body).then((response) => { | ||
// Success | ||
}, (err) => { | ||
// Error | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5433
69