<cfobject type="JAVA"
action="Create"
name="factory"
class="coldfusion.server.ServiceFactory">
<cfset RpcService = factory.XmlRpcService />
<cfset RpcService.refreshWebService("http://myURL/webservices/mycfc.cfc?WSDL")>
Sharing some of the useful snippets of code i stumble across with the world. It will mostly be Android, cloud computing, ColdFusion, SQL, Amazon AWS and other web technologies. If you like what you read or it helps, drop in a comment and say so, it will be appreciated.
19 August 2008
Cold Fusion reload web service
javascript web service
This little bit of code allows you to call a web service from JavaScript. I have found many articles and ways of doing this on the interweb and non of them seem to work. This one works with CF web services.
The interesting thing i found is you don't need to pass parameters using the XMLHttpRequest method, to call a specific function just append &method= to the end of the wsdl string.
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("myDivResponse").innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open("GET","http://myurl/webserrvices/mycfc.cfc?WSDL&method=getSomething",true);
xmlHttp.send(null);
}