Chip, Within the service add this line right under the <cfargument> tag.
<cfset var aADUserInfo = structNew()> The reason its not working properly is because you are really only creating strings that happen to have a 'dot' in the name. Unless you specifically declare a variable as a structure, cf assumes it's just a string. (Least I'm pretty sure. You should put the <cfset> right beneath the <cfargument> tag so you can declare the variable as local to the function. (Which is what the 'var' is doing). It's not mandatory but it ensures that if any other functions within that component use the same variable name, there won't be any conflicts. Better safe than sorry; plus theoretically the variable should be trashed when the function ends, so it should free up some memory too. Otherwise it hangs around for the life of the component. Adam Wayne Lehman Web Systems Developer Johns Hopkins Bloomberg School of Public Health Distance Education Division -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of chip willis Sent: Wednesday, June 25, 2003 6:14 PM To: [EMAIL PROTECTED] Subject: Re: [CFCDev] display a struct from component Hi, I tried that and got this error message: The value returned from function userinformation() is not of type struct. Also tried query, and array. With the string it returns the last value in the struct. aADUserInfo.NUID aADUserInfo.SAMAccountName aADUserInfo.displayName aADUserInfo.email aADUserInfo.firstName aADUserInfo.manager aADUserInfo.lastName aADUserInfo.title aADUserInfo.typeDesc <--returns this -CW >From: "Keith L. Miller" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: <[EMAIL PROTECTED]> >Subject: Re: [CFCDev] display a struct from component >Date: Wed, 25 Jun 2003 16:34:12 -0500 > >Assuming aADUserInfo is your structure then in the line: > > <cffunction name="userinformation" access="public" returntype="string" >hint="Get user information"> > >change: > > returntype="string" to returntype="struct" > >That should do it. > >----------------------------------------------------------------------- ----- >---- >Keith L. Miller >[EMAIL PROTECTED] > >"A good programmer learns from his/her mistakes, but a great programmer >learns >from the mistakes of others." - Hal Helms >"The Power of Antipatterns" ColdFusion Developers Journal Volume: 05 Issue: >05) > >----- Original Message ----- >From: "chip willis" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Wednesday, June 25, 2003 4:26 PM >Subject: [CFCDev] display a struct from component > > > > Hi, > > I have two web services in a component and one is working fine, the >other >is > > working but I do not know how to return the struct. The web service has >a > > structure. > > How do I pass back the struct? > > <cfcomponent> > > <cffunction name="userinformation" access="public" returntype="string" > > hint="Get user information"> > > <cfargument name="LogInName" type="string" required="true" hint="the >users > > name"> > > <cfinvoke > > webservice="blbla" > > method="getUserInfo" > > returnvariable="aADUserInfo"> > > <cfinvokeargument name="username" value="LogInName"/> > > </cfinvoke> > > <cfreturn #aADUserInfo#> > > </cffunction> > > </cfcomponent> > > > > The struct looks like this: > > aADUserInfo.SAMAccountName > > aADUserInfo.displayName > > aADUserInfo.email > > aADUserInfo.firstName > > aADUserInfo.lastName > > > > Here is how I am calling it: > > <cfinvoke > > component="Components\WebServices" > > method="userinformation" > > returnvariable="aADUserInfo"> > > <cfinvokeargument name="LogInName" value="#url.username#"/> > > </cfinvoke> > > > > But this output does not work: > > <cfoutput>#aADUserInfo.displayName#</cfoutput> > > > > I do not get an error message but nothing will display. If I run the web > > service outside the component then it works. > > Thanks > > -CW > > > > _________________________________________________________________ > > The new MSN 8: smart spam protection and 2 months FREE* > > http://join.msn.com/?page=features/junkmail > > > > ---------------------------------------------------------- > > You are subscribed to cfcdev. To unsubscribe, send an email > > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' > > in the message of the email. > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported > > by Mindtool, Corporation (www.mindtool.com). > > >---------------------------------------------------------- >You are subscribed to cfcdev. To unsubscribe, send an email >to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' >in the message of the email. > >CFCDev is run by CFCZone (www.cfczone.org) and supported >by Mindtool, Corporation (www.mindtool.com). _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
