« How does Wireless Mesh Networking work?
» Using ColdFusion to Ping Sitemap Services

XML, Microsoft, ColdFusion

XML RPC using ColdFusion and Microsoft.XMLHTTP COM Object

02.19.08 | 3 Comments

I had recently been reviewing some documentation on a web based API that was available as an XML RPC. At first I was wondering how to achieve this, but then adapted an ASP example provided into a nice neat ColdFusion implementation. For anybody else with a similar problem of invoking an XML RPC API, the code below will at least get you started and heading down the right track.

<cfscript>
serviceurl = ‘http://testurl.com;
serviceport = 99999;
serviceuser = ‘xxxxxxxx’;
servicepass = ‘????????’;
aData= ‘123456789′;

strXML = “<?xml version=’1.0′ encoding=’utf-8′ ?>”;
strXML = strXML & ‘<rpc module=’test’ method=’Method Name’ version=’1.0′>”;
strXML = strXML & “<auth>”;
strXML = strXML & “<username>” & serviceuser & “</username>”;
strXML = strXML & “<password>” & servicepass & “</password>”;
strXML = strXML & “</auth>”;
strXML = strXML & “<cli datatype=’cli’>” & Trim(aData & “</cli>”;
strXML = strXML & “</rpc>”;
objHTTP = CreateObject(”com”,”Microsoft.XMLHTTP”);
objHTTP.Open(”POST”,serviceurl & ‘:’ & serviceport & ‘/’,false);
objHTTP.Send(strXml);
</cfscript>

Once you have the response from the call, you can then use XmlParse() to transform the XML response into a working XML DOM for processing and for variable assignment.

3 Comments

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

:

:


« How does Wireless Mesh Networking work?
» Using ColdFusion to Ping Sitemap Services