Brian, Peter, thanks for helping me out... I spent hours already on that not
being sure if it is my ignorance or somethings else which pretends it from
working...
when I call the remoteProxy from test.cfm with
<cfset crm = createObject('component','mocca.contact.contactServiceRemote')>
<cfdump var="#crm.getContacts()#">
it works as expected and dumps the correct result. But when I call it from
Flex with
<mx:RemoteObject id="contactService" destination="ColdFusion" source="
mocca.contact.contactServiceRemote" fault="serverFault(event)">
<mx:method name="getContactsAsQuery"
result="getContactsRO_handler(event)" />
</mx:RemoteObject>
it get the "ColdSpring BeanFactory not found" error, which is strange since
I load the SWF in a cfm-template.
The generated source of the remote proxy.... factoryname seems to be set
correctly:
<cfcomponent name="contactServiceRemote"
displayname="contactServiceRemote:RemoteProxyBean"
hint="Abstract Base Class for Aop Based Remote Proxy Beans"
output="false">
<cfset variables.beanFactoryName = "factory" />
<cfset variables.beanFactoryScope = "" />
<cfset setup() />
<cffunction name="setup" access="public" returntype="void">
<cfset var bfUtils = 0 />
<cfset var bf = 0 />
<!--- make sure scope is setup (could have been set to '', meaning
application, default) --->
<cfif not len(variables.beanFactoryScope)>
<cfset variables.beanFactoryScope = 'application' />
</cfif>
<cftry>
<cfset bfUtils = createObject("component","
coldspring.beans.util.BeanFactoryUtils").init()/>
<cfif not len(variables.beanFactoryName)>
<cfset bf = bfUtils.getDefaultFactory(
variables.beanFactoryScope) />
<cfelse>
<cfset bf = bfUtils.getNamedFactory(
variables.beanFactoryScope, variables.beanFactoryName) />
</cfif>
<cfset remoteFactory = bf.getBean("&contactService_remote") />
<cfset variables.target = bf.getBean("contactService_remote") />
<cfset variables.adviceChains =
remoteFactory.getProxyAdviceChains() />
<cfcatch>
<cfthrow type="coldspring.remoting.ApplicationContextError"
message="Sorry, a ColdSpring BeanFactory named
#variables.beanFactoryName# was not found in #variables.beanFactoryScope#
scope. Please make sure your bean factory is properly loaded. Perhapse your
main application is not running?" />
</cfcatch>
</cftry>
</cffunction>
<cffunction name="callMethod" access="private" returntype="any">
<cfargument name="methodName" type="string" required="true" />
<cfargument name="args" type="struct" required="true" />
<cfset var adviceChain = 0 />
<cfset var methodInvocation = 0 />
<cfset var rtn = 0 />
<cfset var method = 0 />
<!--- if an advice chain was created for this method, retrieve a
methodInvocation chain from it and proceed --->
<cfif StructKeyExists(variables.adviceChains, arguments.methodName)>
<cfset method = CreateObject('component','coldspring.aop.Method
').init(variables.target, arguments.methodName, arguments.args) />
<cfset adviceChain = variables.adviceChains[arguments.methodName]
/>
<cfset methodInvocation = adviceChain.getMethodInvocation(method,
arguments.args, variables.target) />
<cfreturn methodInvocation.proceed() />
<cfelse>
<!--- if there's no advice chains to execute, just call the
method --->
<cfinvoke component="#variables.target#"
method="#arguments.methodName#"
argumentcollection="#arguments.args#"
returnvariable="rtn">
</cfinvoke>
<cfif isDefined('rtn')>
<cfreturn rtn />
</cfif>
</cfif>
</cffunction>
<cffunction name="getContactsAsQuery" access="remote" returntype="any"
output="false" >
<cfset var rtn = callMethod('getContactsAsQuery', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>
<cffunction name="getContacts" access="remote" returntype="any"
output="false" >
<cfargument name="contact_id" type="String" required="false" />
<cfargument name="contacttype_id" type="String" required="false" />
<cfargument name="contact_name" type="String" required="false" />
<cfargument name="email" type="String" required="false" />
<cfargument name="website" type="String" required="false" />
<cfargument name="phone" type="String" required="false" />
<cfargument name="fax" type="String" required="false" />
<cfargument name="contact_notes" type="String" required="false" />
<cfargument name="created_date" type="Date" required="false" />
<cfargument name="updated_date" type="Date" required="false" />
<cfset var rtn = callMethod('getContacts', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>
<cffunction name="getContacttype" access="remote" returntype="any"
output="false" >
<cfargument name="contacttype_id" type="String" required="true" />
<cfset var rtn = callMethod('getContacttype', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>
<cffunction name="getContacttypes" access="remote" returntype="any"
output="false" >
<cfargument name="contacttype_id" type="String" required="false" />
<cfargument name="contacttype" type="String" required="false" />
<cfset var rtn = callMethod('getContacttypes', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>
<cffunction name="getContact" access="remote" returntype="any"
output="false" >
<cfargument name="contact_id" type="String" required="true" default="" />
<cfset var rtn = callMethod('getContact', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>
</cfcomponent>
Daniel
On 8/13/07, Peter J. Farrell <[EMAIL PROTECTED]> wrote:
>
> Excuse my ignorance, I see you posted that code. Still looking at it -
> can you paste the code to your remote proxy that is created for you?
>
> Daniel Schmid said the following on 8/13/2007 11:39 AM:
> > I try to get my first remoteProxy out of coldspring running and get
> > stuck with
>
>
>
>