Learning ColdFusion 8: Javascript Object Notation (JSON) Part II - Remote Method Calls

<!---
	Create the URL at which we can access our
	DateUtility.cfc as a WSDL style web service.
	Notice that we are appending "?wsdl" to signify
	that we are accessing this function as a
	remote web service.
--->
<cfset strURL = (
	"http://#CGI.server_name#" &
	GetDirectoryFromPath( CGI.script_name ) &
	"DateUtility.cfc?wsdl"
	) />
 
 
<!---
	Invoke GetWeekDatesAsJSON() as webservice. We are going
	to pass in today's date as the argument (even though we
	did not passed in the date previously - I dislike
	dealing with optional arguments in web services).
--->
<cfinvoke
	webservice="#strURL#"
	method="GetWeekDatesAsJSON"
	refreshwsdl="true"
	returnvariable="strDates">
 
	<cfinvokeargument
		name="Date"
		value="06/08/2007"
		/>
 
</cfinvoke>
 
 
<!---
	Dump out the value returned from the web service call.
	Remember, our return format was specified as JSON.
--->
<cfdump
	var="#strDates#"
	label="Remote Call to GetWeekDatesAsJSON()"
	/>

For Cut-and-Paste