Your goal is basically for true interop for any app to consume it regardless
of the code.

What we did is create an API which acts as a wrapper to a bank of CFCs, it
take an defined/published XML input to call things like search, stats, CMS
functions and it returns back structured XML as the result.  The API
converts and and all simple and complex ColdFusion object into XML
automatically using a util CFC, so we never have to worry about ever
exposing a CFC directly or worry about converting objects.. It's all
automagical!





"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
To: CF-Talk
Sent: Fri Mar 02 20:45:32 2007
Subject: Re: Create a webservice that returns a structure, to be consumed
by .NET

Your best bet here is simply to use XML, it is what it was designed
for..true interop.

It is a simple process to convert a struct to an XML doc.

 



"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Ben Mueller
To: CF-Talk
Sent: Fri Mar 02 19:31:25 2007
Subject: Re: Create a webservice that returns a structure, to be consumed by
...NET

Rick,

Thank you so much for the reply.  You may have just saved me from a week of
banging my head against my desk.

So, a question:  when you convert the structure to an array, does that mean
that the caller then needs to know which return variable is in each position
of the array?  So, they'd have to know that "errorcode" is array[1], and
"errormessage" is array[2], and so on, right?

If that's the case, then I probably don't want to go that route.  Seems like
too many chances for them to screw up (i.e. "I thought first name was
array[5], not array[4]", and so on).

I think I'll just serialize the data to a string.



>BTW, here is an example of a function from the wrapper CFC code....
>
>
><cffunction name="authByUsername" output="no" access="remote"
>returntype="Array" displayname="authByUsername"
>   hint="Verify a username and password against DB2">
> <cfargument name="UNAME" type="string" required="yes">
> <cfargument name="PWORD" type="string" required="yes">
> <cfargument name="SPECIFICLOGINS" type="string" required="Yes">
> <cfargument name="SPECIFICGROUPS" type="string" required="Yes">
> <cfargument name="OTHER_RESTRICTIONS" type="string" required="no"
>DEFAULT="">
>
>
> <cfset var authCFC = createObject("component","authorize")>
> <CFSET var retVal = initRetVal(ArrayNew(1))>
> <cfset var results = authCFC.authByUsername(
>  arguments.uname,
>  arguments.pword,
>  arguments.specificlogins,
>  arguments.specificgroups,
>  arguments.other_restrictions,
>  "ADVANCE/ER"
> )>
>
> <cfif results.errorcode gt 0>
>  <cfset retVal[1] = results.errorCode>
>  <cfset retVal[2] = results.errorMessage>
> <cfelse>
>  <cfset retVal[1] = 0>
>  <cfset retVal[2] = "">
>  <CFSET retVal[3]= results.NAME>
>  <CFSET retVal[4] = results.title>
>  <CFSET retVal[5] = results.dept>
>  <CFSET retVal[6] = results.phone>
>  <CFSET retVal[7] = results.fax>
>  <CFSET retVal[8]= results.location>
>  <CFSET retVal[9] = results.dukebox>
>  <CFSET retVal[10] = results.lninitial>
>
>  <CFSET retVal[15] = results.email>
>  <CFSET retVal[16] = results.userid>
>  <CFSET retVal[17]  = results.SECURITY_GROUP>
>  <CFSET retVal[18] = results.MOVESFLAG1>
>  <CFSET retVal[19] = results.MOVESFLAG2>
>  <CFSET retVal[20] = results.FLASHCOOKIE>
>  <CFSET retVal[21] = results.ERUSERFLAG>
>  <CFSET retVal[22]  = results.IMAGE_URL>
>  <CFSET retVal[23] = results.DROPRACEFLAG>
> </cfif>
> <CFRETURN retVal>
>
></cffunction>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271359
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to