cfinvoke vs creatobject

View: New views
3 Messages — Rating Filter:   Alert me  

cfinvoke vs creatobject

by Alex-207 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm having a heck of a time trying to figure this out.

The code below works great when I use createObject, but it doesn't when I
use cfinvoke.  The reason I want to use cfinvoke is that it takes a while
for it to return the data, and I can set a timeout on the cfinvoke (and I
can't when I use createObject).

When I use the CFInvoke, I get the "Web service operation runXS with
parameters..." error.

Any ideas?


<!--- Set WSDL Location --->
<cfset wsdlUrl = "http://examplecom/sample.wsdl">

<!--- Set Parameters --->
<cfset selectArray = arrayNew(1)>
<cfset selectArray[1] = '01/01/09'>
<cfset selectArray[2] = '02/01/09'>
<cfset selectArray[3] = 'EXAMPLE'>

<cfset argsXS = structNew()>
<cfscript>
            argsXS.method = 'SELECT';
            argsXS.data = selectArray;
            argsXS.version = '';
            argsXS.result = '';
</cfscript>

<cfset selectDTO = structNew()>
<cfscript>
            selectDTO.args = argsXS;
                        selectDTO.connString = "";
                        selectDTO.userName = "";
                        selectDTO.password = "";
</cfscript>




<!--- Method #1: Works Great! --->
<cfset myWS = createObject("webservice", "#wsdlUrl#")>
<cfset selectResponse = myWS.runXS( selectDTO )>


<!--- Method #2: Doesn't Work :-( --->
<cfinvoke
    method="runXS"
    returnvariable="selectResponse"
    argumentcollection="#selectDTO#"
    webservice="#wsdlUrl#"
    >
</cfinvoke>


Thanks!
Alex


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328047
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: cfinvoke vs creatobject

by James Holmes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What does the target webservice accept as arguments for the runXS method?

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/



2009/11/5 Alex <listnuffy@...>:
>
> I'm having a heck of a time trying to figure this out.
>
> The code below works great when I use createObject, but it doesn't when I
> use cfinvoke.  The reason I want to use cfinvoke is that it takes a while
> for it to return the data, and I can set a timeout on the cfinvoke (and I
> can't when I use createObject)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328058
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: cfinvoke vs creatobject

by Simon Hooker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>What does the target webservice accept as arguments for the runXS method?
>
>mxAjax / CFAjax docs and other useful articles:
>http://www.bifrost.com.au/blog/
>>
>> I'm having a heck of a time trying to figure this out.
>>
>> The code below works great when I use createObject, but it doesn't when I
>> use cfinvoke.  The reason I want to use cfinvoke is that it takes a while
>> for it to return the data, and I can set a timeout on the cfinvoke (and I
>> can't when I use createObject)

Assuming you are on CF8 upwards you could put the CreateObject part within a <cfthread>, and have a timeout on the thread.  Just rejoin it after it's done or timed out and then continue as before.  I've used this method in places where a similar functionality is desired.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328061
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4