0

I am unable to send the correct argument to the service.

Code used:

var soap = require('soap');
var url = 'http://example.com';

soap.WSDL.prototype.ignoredNamespaces = ['targetNamespace', 'typedNamespace'];

var args = {'name':'test'};

soap.createClient(url, function(err, client) {
    client.Hello(args, function(err,result,res){
        console.log(result);
        console.log(client.lastRequest);
    });
});

The Hello-function should return string "Hello test !". However, I get:

'Hello null !'

The request being sent is:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ....><soap:Body>
<tns:Hello xmlns:tns="http://example/">
    <tns:name>test</tns:name>
</tns:Hello></soap:Body></soap:Envelope>

where test is the interesting part. The service is expecting

<name>test</name>

without namespace (i tested this with http://www.soapclient.com/)

So, the question is: how do I send the request argument without tns attached? (tns:name => name) Thanks!

2 Answers 2

3

The correct way to override namespace is to send the parameters like this:

var params = { ':name' : 'test' }

It's in documentation: Overriding the namespace prefix

Sign up to request clarification or add additional context in comments.

Comments

0

In your code instead of passing argument as

var args = {'name':'test'};

try

var args = {arg0: 'testName'};

I am not an expert but it worked for me to pass an argument from node.js while invoking SOAP client.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.