Discussion:
adding CFC timeout?
(too old to reply)
purabk
2007-12-03 20:24:41 UTC
Permalink
iam trying add a timeout in a CFC but having some issues with it...I need
help...here is my sample CFC which needs a timeout added....could somebody
please help me how to add a timeout in the code..i tried requesttimeout using
cfsetting but i could not pull WSDL up..

<cfsetting requesttimeout="30" />
<cfcomponent>
<cffunction name = "test" access="remote" returntype="struct" output="no">

<cfargument name="var1" required="true">
<cfargument name="var2" required="true">
<cfscript>
//Request structure
stOrder = structNew();
stOrder.var11 = #arguments.var1#;
stOrder.var21 = #arguments.var1#;


//needs a timeout added around this call

ws = createObject("webservice", "#WebServiceURL#");
myReturnVar = ws.NewOrder(stOrder); //end of timeout

</cfscript>
<CFSET returnStruct = StructNew()>
<CFSET structRC = StructInsert(returnStruct, "output",
myReturnVar.outputvar1)>
<cfreturn returnStruct>
</cffunction>
</cfcomponent>
GArlington
2007-12-04 09:38:51 UTC
Permalink
Post by purabk
iam trying add a timeout in a CFC but having some issues with it...I need
help...here is my sample CFC which needs a timeout added....could somebody
please help me how to add a timeout in the code..i tried requesttimeout using
cfsetting but i could not pull WSDL up..
<cfsetting requesttimeout="30" />
<cfcomponent>
<cffunction name = "test" access="remote" returntype="struct" output="no">
<cfargument name="var1" required="true">
<cfargument name="var2" required="true">
<cfscript>
//Request structure
stOrder = structNew();
stOrder.var11 = #arguments.var1#;
stOrder.var21 = #arguments.var1#;
//needs a timeout added around this call
ws = createObject("webservice", "#WebServiceURL#");
myReturnVar = ws.NewOrder(stOrder); //end of timeout
</cfscript>
<CFSET returnStruct = StructNew()>
<CFSET structRC = StructInsert(returnStruct, "output",
myReturnVar.outputvar1)>
<cfreturn returnStruct>
</cffunction>
</cfcomponent>
I suspect that you will need to put your <cfsetting
requesttimeout="30" /> inside executable code, i.e. before <cfscript>
in your function "test". Another thing that you can try is to dump
your "ws" var, there maybe a method to set timeout there too...

Loading...