Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
June 29, 2006
Ron West is discussing advanced web services in ColdFusion. He's starting out by discussing some of the current problems with web services: Security, simple examples (think weather, stocks, etc), document vs. rpc.
ColdFusion uses Apache AXIS under the covers. It basically wraps the class org.apache.axis.client.stub. There are lots of useful methods you can call directly on the class. Here are a few:
getHeaders()
setHeaders()
getUsername()
getPassword()
setAttachements()
_setPromperty()
WSDL isn't necessarily dynamic. In fact, you can create static WSDL files that correspond to CFC's on your system. You can also modify the static WSDL files. This lets you do things like manage endpoints. Endpoints are locations (URI) for accessing a web service. They can change during the web service call. This allows you to do things like create a simple authentication service for web services. Ron shows an example where you call one login webservice and after authenticating, it returns back the URI to use for the authenticated service. It's very simple, but it does add a layer of additional security (albeit very basic security).
SOAP headers allow you to pass additional information along to/from web services. Pre MX 7, working with headers was a real pain. In MX 7, two new functions made working with headers easier: getSOAPRequestHeader() and addSOAPRequestHeader(). SOAP headers are passed as XML. On the ColdFusion side, you can choose to work with the SOAP headers as XML or have them split out into name/value pairs.
Web services actually do support persistence (well, they support persistence of the objects being passed, but the connection itself is stateless). You can do them at the client level (via scopes in CF such as applicatoin and session) as well as the service level. AXIS has SESSION_MAINTAIN_PROPERTY as well as cookie support.
Ron then went on to show some integration examples, including one that integrated Salesforce.com with a ColdFusion application (CommonSpot CMS) by using salesforce.com's web services API (it has a 3500 line WSDL!).
Overall, a very good presentation on some of the advanced ways to work with web services in ColdFusion.
1/11/08 4:57 PM
Do you have an update to this for CF8 - or a link to more detials on this process.
Having 'fun' trying to generate SOAP headers with SSL key for preliminary authentication
when hitting another server with Apache/Axis while requesting a webservice.