Bump-ish. It seems my attempt at making a "proxy" to forward calls to the live .cfc files, and it hasn't been going well
<code>
<cfcomponent access="remote" output="false">
<!---
This onMissingMethod function will capture all method calls that aren’t defined locally.
It then proxies the call via an HTTP POST to the real component.
--->
<cffunction name="onMissingMethod" access="remote" returntype="any" output="false" hint="Proxies calls to remote OtherClass">
<cfargument name="methodName" type="string" required="true">
<!--- Make sure to avoid shadowing the built-in "arguments" scope --->
<cfargument name="args" type="struct" required="true">
<!--- Build the remote URL including the method name and JSON return format --->
<cfset var remoteUrl = "
http://www.example.com/cfc/OtherClass.cfc?method=" & #arguments.methodName# & "&returnFormat=json">
<cfset var httpResponse = "">
<!--- Issue the HTTP call. Here, we use POST so that all the method parameters are sent as form fields --->
<cfhttp url="#remoteUrl#" method="post" charset="utf-8" result="httpResponse">
<cfloop collection="#arguments.args#" item="key">
<cfhttpparam type="formField" name="#key#" value="#arguments.args[key]#">
</cfloop>
</cfhttp>
<!--- Check for a successful remote call; if successful, decode the JSON response --->
<cfif httpResponse.statusCode eq 200>
<cfreturn deserializeJSON(httpResponse.fileContent)>
<cfelse>
<cfthrow message="Remote call failed: #httpResponse.statusCode# - #httpResponse.fileContent#">
</cfif>
</cffunction>
</cfcomponent>
</code>
I just keep getting nags about MethodName being undefined. Is it because one of the arguments is supposed to be an array?
That's what I get for trusting AI, I guess