Skip to content

Commit

Permalink
Reverting #914 (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdevel authored May 30, 2017
1 parent 94a8b54 commit 97e0452
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 183 deletions.
63 changes: 0 additions & 63 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,62 +182,6 @@ Client.prototype._defineMethod = function(method, location) {
};
};

Client.prototype._isSequenceRequired = function(methodName) {
var tns = this.wsdl.definitions.$targetNamespace;
var methodRequestName = _.result(this.wsdl.definitions, 'messages.' + methodName + '.$name');
var args = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.parts');

if(typeof args === 'undefined' && typeof _.pick(args, 'params') !== 'undefined') {
return false;
}
if(Object.keys(args).length === 1) {
return false;
}

var complexTypeName = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.element.$name');
var modeOfComplexType = _.result(
this.wsdl.definitions,
'schemas[\'' + tns + '\'].elements.' + complexTypeName + '.children[0].children[0].name');

if(modeOfComplexType === 'sequence') {
return true;
}

return false;
};

Client.prototype._setSequenceArgs = function(argsScheme, args) {
var result = {};
if(typeof argsScheme !== 'object') {
return args;
}
for (var partIndex in argsScheme) {
if(typeof args[partIndex] === 'undefined') {
continue;
}
if(typeof argsScheme[partIndex] !== 'object') {
result[partIndex] = args[partIndex];
} else {
result[partIndex] = this._setSequenceArgs(argsScheme[partIndex], args[partIndex]);
}
}
return result;
};

Client.prototype._getArgsScheme = function(methodName) {
var methodRequestName = _.result(this.wsdl.definitions, 'messages.'+methodName+'.$name');
var args = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.parts');

if(typeof args === 'undefined' && typeof _.pick(args, 'params') !== 'undefined') {
return [];
}
if(Object.keys(args).length === 1) {
return [];
}

return args;
};

Client.prototype._invoke = function(method, args, location, callback, options, extraHeaders) {
var self = this,
name = method.$name,
Expand All @@ -258,13 +202,6 @@ Client.prototype._invoke = function(method, args, location, callback, options, e
},
xmlnsSoap = "xmlns:" + envelopeKey + "=\"http://schemas.xmlsoap.org/soap/envelope/\"";

if(this._isSequenceRequired(name)) {
var argsScheme = this._getArgsScheme(name);
if(argsScheme) {
args = this._setSequenceArgs(argsScheme, args);
}
}

if (this.wsdl.options.forceSoap12Headers) {
headers["Content-Type"] = "application/soap+xml; charset=utf-8";
xmlnsSoap = "xmlns:" + envelopeKey + "=\"http://www.w3.org/2003/05/soap-envelope\"";
Expand Down
2 changes: 1 addition & 1 deletion lib/wsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ WSDL.prototype._fromServices = function(services) {

};

WSDL.prototype._splitQName = splitQName;


WSDL.prototype._xmlnsMap = function() {
var xmlns = this.definitions.xmlns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Copyright 2006-2015 Salesforce.com, inc. All Rights Reserved
<xsd:complexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string"/>
<xsd:element name="fullNames" type="xsd:string"/>
<xsd:element name="fullNames" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Expand Down
55 changes: 0 additions & 55 deletions test/sequence-test.js

This file was deleted.

63 changes: 0 additions & 63 deletions test/wsdl/sequnceexmple.wsdl

This file was deleted.

0 comments on commit 97e0452

Please sign in to comment.