• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help consuming webservice?

New Here ,
Feb 18, 2009 Feb 18, 2009

Copy link to clipboard

Copied

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" output="false" returntype="string" displayname="setUpWebUserSession">
<cfset isSuccesful="true">
<cfargument name="userName" required="true" default="">
<cfargument name="applicationToLogIn" required="true" default="">
<cflock scope="session" throwontimeout="true" timeout="120" type="exclusive"><!--- --->
<cfset session.WebUserUI = createObject("component", "org.atcc.webuser.client.presentation.WebUserUI")>
</cflock>
<cfreturn isSuccesful>
Second webservice in the same file:-

<cffunction name="getProfileHTML" access="remote" displayname="getProfileHTML" output="false" returntype="string">
<cfset var profileHTML = "">
<cfsavecontent variable="profileHTML">
<cfoutput>#session.WebUserUI.getWebProfileHTML()#</cfoutput>
</cfsavecontent>
<cfreturn application.CTiStringCleaner.getCleanString(profileHTML)>
<!--- <cfreturn profileHTML> --->
</cffunction>

Error Message from Axis:
ErrorCode:
message: session.WebUserUI.getSalesOrderHistorySection() doesn't exist.
detail: Error at line 1, column 52

the way I am consuming webservice

<cfcomponent>
<cfinvoke webservice=" http://172.0.0.1:8080//WebServicesAPI.cfc?wsdl"
method="setUpWebUserSession"
returnVariable="soo">
<cfinvokeargument name="userName" value="muddu_shafi@yahoo.com">
<cfinvokeargument name="applicationToLogIn" value="atccWeb">
</cfinvoke>
<cfoutput> #soo# </cfoutput>
<cfinvoke webservice=" http://172.0.0.1:8080//WebServicesAPI.cfc?wsdl"
method= "getSaleOrderHistoryHTML"
returnVariable="foo">
</cfinvoke>
<cfoutput>#foo#</cfoutput>
<!-- TS024546-->
</cfcomponent>

First Web service Second webservice
TOPICS
Advanced techniques

Views

363

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 18, 2009 Feb 18, 2009

Copy link to clipboard

Copied

LATEST
Don't use session variables with webservices. You are asking for trouble.

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation