Thursday 13 April 2017

how to pass parameter as object with xmlrpc - node module (github.com/baalexander/node-xmlrpc)

actually need to pass a parameter which is an xml as an object with xmlrpc node module github.com/baalexander/node-xmlrpc;

client call is :

client.methodCall('anAction', ['aParam'], function (error, value) {})

need to replace aParam with something like that:

<?xml version='1.0'?>
<methodCall>
<methodName>GetBalanceAndDate</methodName>
<params>
<param>
<value><struct>
<member>
<name>originTransactionID</name>
<value><string>90000001</string></value>
</member>
<member>
<name>originHostName</name>
<value><string>PADFVPZ452P01</string></value>
</member>
<member>
<name>subscriberNumber</name>
<value><string>24107482594</string></value>
</member>
<member>
<name>subscriberNumberNAI</name>
<value><int>1</int></value>
</member>
<member>
<name>originTimeStamp</name>
<value><dateTime.iso8601>20140626T14:53:53+0100</dateTime.iso8601></value>
</member>
<member>
<name>originNodeType</name>
<value><string>EXT</string></value>
</member>
</struct></value>
</param>
</params>
</methodCall>

I've tried :

var req1 = {
value: {
struct:{
member:{$name:'originTransactionID',value:'90000001'},
mamber:{$name:'originHostName',value:'GAGAPOPAAPZP01'},
member:{$name:'subscriberNumber',value:'24104151708'},
member:{$name:'subscriberNumberNAI',value: 1},
member:{$name:'originTimeStamp', value: new Date()},
member:{$name:'originNodeType', value:  'EXT'}
}
}
};



client.methodCall('GetBalanceAndDate', [req1], function (error, value) {})

but having error : faultString: 'Illegal request message'

any idea on how it works please??



via Carter igondjo

No comments:

Post a Comment