Hi,
The web service is private and it is sitting on a separate box on another domain., I work at a University and it uses a persons Windows login name to get the names and email address and other information form active directory. It is written in .Net.
I made a WSDL file with a .Net utility and then imported it into ColdFusion. I code in CF. my co-worker makes the services in .Net.
The web service works when I do not put it into a component and the var' work also.
aADUserInfo.NUID
aADUserInfo.SAMAccountName
aADUserInfo.displayName
aADUserInfo.email
aADUserInfo.firstName
aADUserInfo.lastName
aADUserInfo.manager
aADUserInfo.title
aADUserInfo.typeDesc


I tried to put the (<cfreturn #aADUserInfo#>) in the web service like below but get the error:
Local variable aADUserInfo on line 23 must be grouped at the top of the function body.
<!--- Get the users information --->
<cffunction name="userinformation" access="public" returntype="struct" hint="Get user information">
<cfargument name="LogInName" type="string" required="true" hint="the users name">
<cfset var aADUserInfo = structNew()>
<cfinvoke
webservice="http://ve211jm.nu.edu/ADService/Service1.asmx?WSDL";
method="getUserInfo"
returnvariable="aADUserInfo">
<cfset var aADUserInfo = structNew()>
<cfinvokeargument name="username" value="LogInName"/>
</cfinvoke>
<cfreturn #aADUserInfo#>
</cffunction>
</cfcomponent>


And when I put this the way it was (out side the web service inside the function) and put the code you gave me in the calling page I get this error.
The value returned from function userinformation() is not of type struct.



<!--- Get the users information --->
<cffunction name="userinformation" access="public" returntype="struct" hint="Get user information">
<cfargument name="LogInName" type="string" required="true" hint="the users name">
<cfset var aADUserInfo = structNew()>
<cfinvoke
webservice="http://ve211jm.nu.edu/ADService/Service1.asmx?WSDL";
method="getUserInfo"
returnvariable="aADUserInfo">
<cfinvokeargument name="username" value="LogInName"/>
</cfinvoke>
<cfreturn #aADUserInfo#>
</cffunction>
</cfcomponent>


So it looks like it is not a struct. But did you see the image of the web service I sent? It sure looks as though it is one.
-CW





From: "Adam Wayne Lehman" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: RE: [CFCDev] display a struct from component
Date: Thu, 26 Jun 2003 14:36:25 -0400

Chip,

I actually meant for you to put the <cfset> tag in the webservice
itself, but it definitely doesn't hurt to be in the userInformation() as
well.

Following the <cfinvoke> include the following:
<cfif isStruct(aADUserInfo)>
        <cfreturn aADUserInfo>
<cfelse>
        web service is not returning a structure.<cfabort>
</cfif>

This way we can see if the webservice itself is returning a struct or
not, which I'm guessing it's not. (note you don't need the # signs
within the <cfreturn> tag.

For a little more background, is the webservice running on the same box?
If not where is it and what type of server is hosting it. Is it some
really confidential stuff? If not, if you fill me in on the details off
list, I'll gladly try and debug it.

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: Thursday, June 26, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] display a struct from component

Hi,
OK I tried that.
<!--- Get the users information --->
<cffunction name="userinformation" access="public"  returntype="struct"
hint="Get user information">
  <cfargument name="LogInName" type="string"  required="true" hint="the
users name">
  <cfset var aADUserInfo = structNew()>
  <cfinvoke
    webservice="TheWebService"
    method="getUserInfo"
    returnvariable="aADUserInfo">
  <cfinvokeargument name="username" value="LogInName"/>
  </cfinvoke>
<cfreturn #aADUserInfo#>
</cffunction>
</cfcomponent>

But I get this error:
The value returned from function userinformation() is not of type
struct.

I attached a pic of my web service struct.

>From: "Adam Wayne Lehman" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: RE: [CFCDev] display a struct from component
>Date: Wed, 25 Jun 2003 19:09:51 -0400
>
>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).

_________________________________________________________________
Help STOP 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).

_________________________________________________________________
Help STOP 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).

Reply via email to