FALCONSEYE
Programmer
i have the following piece of code
<Cftry>
<cfinvoke webservice="#request.WebServiceURL#" timeout="2" method="createNewOrder" Record="#myStruct#" returnvariable="myCUID">
<cfcatch type="any">
<cfif IsDefined('cfcatch.Message')>
<cfset request.myCustomerID = 'null'>
<cfelse>
<cfset request.myCustomerID = myCUID>
</cfif>
</cfcatch>
</cftry>
<cfoutput>#request.myCustomerID#</cfoutput>
this returns an error saying Variable MYCUID is undefined.
if i run this instead
<cfinvoke webservice="#request.WebServiceURL#" timeout="2" method="createNewOrder" Record="#myStruct#" returnvariable="myCUID">
<cfoutput>#myCuID#</cfoutput>
it runs perfectly fine and outputs something like E123456.
why does CF not like surrounding the cfinvoke with cftry. sometimes, the webservice goes down and i want to capture that. if there is a cfcatch.message, i want to set the myCuID to null, otherwise to myCuID. i cannot figure out what i am doing wrong. thanks for the help in advance...
<Cftry>
<cfinvoke webservice="#request.WebServiceURL#" timeout="2" method="createNewOrder" Record="#myStruct#" returnvariable="myCUID">
<cfcatch type="any">
<cfif IsDefined('cfcatch.Message')>
<cfset request.myCustomerID = 'null'>
<cfelse>
<cfset request.myCustomerID = myCUID>
</cfif>
</cfcatch>
</cftry>
<cfoutput>#request.myCustomerID#</cfoutput>
this returns an error saying Variable MYCUID is undefined.
if i run this instead
<cfinvoke webservice="#request.WebServiceURL#" timeout="2" method="createNewOrder" Record="#myStruct#" returnvariable="myCUID">
<cfoutput>#myCuID#</cfoutput>
it runs perfectly fine and outputs something like E123456.
why does CF not like surrounding the cfinvoke with cftry. sometimes, the webservice goes down and i want to capture that. if there is a cfcatch.message, i want to set the myCuID to null, otherwise to myCuID. i cannot figure out what i am doing wrong. thanks for the help in advance...