Permalink
Browse files

Added method for soapHeaders

  • Loading branch information...
1 parent a8b8552 commit 03c85a6adf830c56d4fa7bfba47b1ab18812fd19 Artem committed Sep 22, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/client.js
View
@@ -16,6 +16,16 @@ var Client = function(wsdl, endpoint) {
this._initializeServices(endpoint);
}
+Client.prototype.addSoapHeader = function(soapHeader, name, namespace, xmlns) {
+ if(!this.soapHeaders){
+ this.soapHeaders = [];
+ }
+ if(typeof soapHeader == 'object'){
+ soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns);
+ }
+ this.soapHeaders.push(soapHeader);
+}
+
Client.prototype.setEndpoint = function(endpoint) {
this.endpoint = endpoint;
this._initializeServices(endpoint);
@@ -117,6 +127,7 @@ Client.prototype._invoke = function(method, arguments, location, callback) {
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
"<soap:Header>" +
+ (self.soapHeaders ? self.soapHeaders.join("\n") : "") +
(self.security ? self.security.toXML() : "") +
"</soap:Header>" +
"<soap:Body>" +

0 comments on commit 03c85a6

Please sign in to comment.