Consuming web services in ColdFusion is easy - at least since CF9, because it used to be a PITA in previous versions for some kinds of services (e.g. SOAP).
You can even write it in one line - woohoo! -, like this:
1 2 3 |
|
CFInvoke assumes that the url of the service and its endpoint are the same. As usual with ColdFusion, this is all very nice and handy as long as your situation matches the default. But from the moment you have to customize a bit, you can start pulling out your hair. And the fact is that the real world has this tendency not to match the default situation.
For example: if the service you want to access has an endpoint that differs from the service url, you’re out of luck. I found the following - completely undocumented - solution to use a custom endpoint:
1 2 3 4 5 6 7 8 9 10 11 |
|
Notice the underscore? That means you should probably not be using this.
Anyway, while researching this I also figured out the cfscript syntax to do the same thing.
1 2 3 4 5 |
|
You can also find this snippet on Gist.