Posted Monday, April 23, 2007 8:18:37 PM by Chaz
Interview between Michael Smith and Chaz Chumley
Michael Smith: This time we are talking with Chaz Chumley about his CFUNITED-07 talk "Creating and Consuming WebServices". So why should a developer come to your session Chaz?
Chaz Chumley: Web Services make up such an integral part of the web framework when developing applications today. Such technologies as ColdFusion, Flash and Flex make working with XML data easier and quicker than could have been conceived. If a developer plans on sharing data with external customers or consume data from such clients like Google, Yahoo or RSS feeds then they don't want to miss this session. I will be sharing real world examples of just how easy it is to produce and consume web services utilizing ColdFusion.
MS: Can you tell me more specifics about some of those web services and why they are cool to add to my app?
CC: No one wants to reinvent the wheel, so to speak. Web Services are "cool" because we can build some great functionality once and reuse it by sharing it with the outside world just by specifying where the Web Service lives and how to interact with it. Imagine if a client asked you to pull in all the local news into a portal or web site. Do you want to statically write the news items down each day and then republish it. Of course not. Why not browse over to Yahoo!'s Web Services and tap into an already prebuilt API that does all the work for you. In addition to web search results, Yahoo!'s API includes the ability to fetch results for images, local information, news, and video.
MS: OK! So is it hard to create a web service in ColdFusion? What do I need to do?
CC: The great thing about ColdFusion versus other languages is just how easy it is to create a web service. More and more developers are writing ColdFusion Components to encapsulate their logic from their presentation. Following these best practices we can expose the logic inside a CFC simply by adding one attribute (|access="remote"|) to any of your component's methods to turn it into a web service. However if you want to learn more about it in detail you will have to come to my CFUnited session Michael.
MS: One parameter to publish a web service - that is easy! What about reading those cool web services that you mentioned above? That must be hard right?
CC: You might think that but actually it is very simple. Let's take the Yahoo API's for example. All that is needed to get started is to register with Yahoo, obtain an application ID which is just a string that uniquely identifies your application and send a request url to Yahoo. The information is then returned in the form of a REST (Representational State Transfer) response.
MS: Cool! Now it sounds like some of those web services might return complex data - how does ColdFusion deal with that?
CC: When a web service returns a complex data type you can write the return value directly to a ColdFusion variable. You can then access elements of the variable using dot notation the same way you would access a structure. So if we had a person object returned to us we could access the firstname element by specifying "person.firstName".
MS: Do I need CF 7 Enterprise to use web services or do other versions of CF work too?
CC: You can both create and consume web services with any version of ColdFusion.
MS: What about all this SOAP my java buddies keep telling me about? How does that relate to web services and does ColdFusion support SOAP?
CC: SOAP (Simple Object Access Protocol) is just one of the XML-based protocols that you can use to write messages to send and receive web service requests and responses over the internet. ColdFusion does support SOAP thru the use of a WSDL (Web Services Descriptor Language) that describes the arguments accepted by a specific web service. The great thing about ColdFusion is that the WSDL is automatically generated when the ColdFusion Component is deployed.
MS: This all sounds so easy! Are there any gotchas to watch out for with web services?
CC: One of the biggest gotchas when developing web services is forgetting to refresh the web service within the ColdFusion Administrator. CFAdmin caches the web service when it is first generated so any changes will not be reflected until you refresh it. We will be looking at more gotchas in detail in my session.
MS: I am looking forward to seeing you at CFUNITED.
Creating and Consuming WebServices
Web services provide us a channel to communicate using standard XML (Extensible Markup Language) to users over an internet, intranet or extranet without exposing all of the functionality of your application. Using ColdFusion you can easily publish a web service - to make application functionality available for remote use as well as consume a web service - to access remote functionality to perform specific tasks. Join us as we discuss the basic structure of a web service, utilize ColdFusion Components (CFCs) to create simple data typed web services, how to consume a web service and the different data types you may encounter, take a look at working with soap requests including nillable arguments and CFMX7's new isSoapRequest function, error handling and finally best practices to ensure that your experience with ColdFusion MX 7 and web services is a memorable one.
Category tags: ColdFusion
Posted Monday, April 23, 2007 7:43:32 PM by Chaz
The Premiere ColdFusion Conference
If you are a ColdFusion developer and plan on going to any web conference this year, then you definitely don't want to miss CFUnited. Not that I am trying to self-glorify myself but I have the pleasure of speaking this year and can't wait to see all the great presenters and people involved in the ColdFusion community.
CFUnited is the only conference of its kind that is run by developers, for developers. What this means is that the topics are exactly what web developers need to learn now and are based on real world experience.
This year's conference is a 4-day event that includes a bonus on Saturday repeating the most popular sessions. You can purchase the 4 day package, 3 day package, or the Saturday only package. In addition to the keynotes and sessions you expect at any conference, this year will include Birds-of-Feather discussions in the evenings, panel discussions, a community area, and many other social and networking events. If 4 days isn't enough for you, there is a User Group Manager event on the day before the conference, and full-day hands-on classes, instructed by CFUnited presenters, during the two days prior to the conference. Read More...
Category tags: ColdFusion