Last active
December 15, 2016 21:44
-
-
Save theY4Kman/94e1bae90dfe8cdd5cf71c483f17578f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var util = require('util'); | |
| var xmlrpc = require('xmlrpc'); | |
| var Serializer = require('xmlrpc/lib/serializer'); | |
| function DoubleType(raw) { | |
| xmlrpc.CustomType.call(this, raw); | |
| } | |
| util.inherits(DoubleType, xmlrpc.CustomType); | |
| DoubleType.prototype.tagName = 'double'; | |
| var amount = 189.0; | |
| console.log(Serializer.serializeMethodCall('test', [amount])); | |
| // <?xml version="1.0"?><methodCall><methodName>test</methodName><params><param><value><int>189</int></value></param></params></methodCall> | |
| console.log(Serializer.serializeMethodCall('test', [new DoubleType(amount)])); | |
| // <?xml version="1.0"?><methodCall><methodName>test</methodName><params><param><value><double>189</double></value></param></params></methodCall> | |
| // Used like: | |
| var client = new Meteor.XmlRpcClient('https://{url_here}'); | |
| client.methodCall('payMeNow', [new DoubleType(189.00)], (error, value) => console.log(error, value)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment