I am using meteor's http package to connect to server which communicates through SOAP messages. Following is the code (without original url, namespaces, method names and parameters):
HTTP.call('POST', 'http://soap-service-url.com', {
auth: 'user:password',
headers: {
SOAPTarget: 'http://soap-service-url.com',
SOAPAction: 'http://required-namespace.com/methodName',
'Content-Type': 'text/xml'
},
params: {
parameter1: "parameterValue",
parameter2: '<?xml version="1.0"?><some-xml-goes-here>',
},
content: '<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soap:Body> ' +
'<m:methodName xmlns:m="http://required-namespace.com"> ' +
'<m:parameter1 xsi:type="xsd:string">parameterValue</m:parameter1>' +
'<m:parameter2 xsi:type="xsd:string"><![CDATA[<?xml version="1.0"?><some-xml-goes-here>]]></m:parameter2>' +
'</m:methodName> ' +
'</soap:Body> ' +
'</soap:Envelope>'
}, function (err, result) {
if (err) {
console.log('error occurred..');
console.log(err);
return;
}
console.log(result);
console.log('----------------------');
});
When I am calling methods without parameters I can get the expected output. But when I am calling methods with parameters, I am getting unexpected output. As the parameters given in the content property are not passed, I have added params property, even then I am unable to receive the expected output. To test the issue, I have created a node js application and connected to the same server using node-soap module. I can pass the parameters through the args on client.myMethod(args, callback[, options]) and get the expected result. How to pass the parameters when using meteor's http package?