Skip to main content
Inspiring
September 5, 2008
Question

Web Service Help

  • September 5, 2008
  • 3 replies
  • 374 views
I am setting up a web service for my first time. I have two "clients" that would like to access this web service but they would like to pass data to me differently. One would like to pass it as an array and the other would like to pass it as individual strings. How would I write the conditional statement in the CFC? CF doesn't seem to like the following...

<cfif cgi.remote_host EQ "##.##.##.##">
assign argument vars to values passed as array
<cfelseif cgi.remote_host EQ "XX.XX.XX.XX">
assign argument vars to values passed as strings
</cfif>
    This topic has been closed for replies.

    3 replies

    Known Participant
    September 9, 2008
    BKBK is right, don't do checkups for IPs in your CFCs because by doing so, you prevent your code from beeing usefull at another time, for another project and another client. Both ideas that Dan and BKBK gave you seem good. I for one would probably opt for BKBK's solution (checking if the argument is an array or not and processing the data accordingly).
    BKBK
    Community Expert
    Community Expert
    September 6, 2008
    I wouldn't bother about IPs. In fact, I wouldn't differentiate between clients as you've done. I would keep it general, using the 'any' type. Something along the following lines:



    Inspiring
    September 5, 2008
    You write two functions. Each accepts the data as sent and converts it to something you want. Then you send this data to a third function that processes it.