node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

envelope misses encoding attribute

Open maxwellium opened this issue 13 years ago • 2 comments

using current soap (0.2.7) and node (0.10.5)

line 117 of client.js in soap module reads

(method.inputSoap === 'encoded') && (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ');

js linter/hinter flags it, because it is expecting an assignment or a function call, but instead this is an expression.

also, this line seems to misbehave. console logging method.inputSoap gives me

{
  '$name': 'ping0In',
  use: 'encoded',
  encodingStyle: 'http://schemas.xmlsoap.org/soap/encoding/'
}

so it is definitely not === 'encoded'. However, second part of the above expression is not executed. encoding which is declared as var encoding = ''; stays empty and the encoding attribute is not added to soap envelope.

unfortunately for me, server endpoint was made by some java d***heads, and throws fatal errors at me for not specifying encoding in the envelope ;)

replacing line 117 with

if (method.inputSoap !== 'encoded') {
  encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ';
}

solves this for me.

maxwellium avatar May 02 '13 10:05 maxwellium

+1

(method.inputSoap === 'encoded') && (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ');

This is an incredibly convoluted way to do a simple if statement... For reference if (method.inputSoap === 'encoded') is false (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ') is set.

emilbayes avatar Aug 24 '14 13:08 emilbayes

@maxwellium thanks for submitting! Can you enter a pull request for this?

jsdevel avatar Aug 26 '14 01:08 jsdevel