I have two webservices which I am trying to consume one after
the other. The first webservice does return a true string, but the
second webservice displays an error as it is unable to find the
session variable that I setup in the first webservice.
What should I do? How should I call the session variable when
I invoke the webservice?
first Webservice in a file:
<cffunction name="setUpWebUserSession" access="remote"
<cfargument name="userName" required="true"
<cfargument name="applicationToLogIn" required="true"
<cflock scope="session" throwontimeout="true"
timeout="120" type="exclusive"><!--- --->
<cfset session.WebUserUI = createObject("component",
Second webservice in the same file:-
Don't use session variables with webservices. You are asking
In the first webservice, return a structure that includes the
string and the value of that session variable. That makes it
available to pass as an argument to the 2nd web service.
Or, if the two webservices are in the same cfc, set up a
global variable outside of any functions. Then write a function to
give it a value. In your other two functions, put in some if/else
logic to see if you have to call that third function. Note that if
you choose this method, you'll be wanting to use the createobject
way of calling your webservice, instead of cfinvoke. Actually, you
probably want to anyhow, this is just another reason.