cf.Objective() Sean Corfield: SOA

SOA: Service-Oriented Architecture

This will be interesting. There will be very little code because, Sean no longer works for Adobe. So, he has no access to the code that his team wrote...

What you need/ should have.

  • Data Dictionary
  • Service Directory
  • SaaS (Service as a Service)

Why would you do SOA?

IDC predicts a compound growth rate of 20% per annum for SaaS. That means that there is money to be made.

What does SOA Applications look like?

They will usually be a combination of Local Code and Remote code.

Typically MVC or MVP (Model View Presenter) So, you would have local code for the View and Controller. And you'd have a Service Locator to expose the remote Services.

ColdFusion is a great choice for SOA because it has such good support for the different protocals that you would access remote services.

How is SOA different?

They are Client-Server by definition.

The software consuming the service becomes the client. This is different than what we are used to with the browser being the client.

Often the "client" will not have any sense of session. So, don't rely on session, cookie or client scope. In fact, you may need to turn session management off to avoid creating orphaned sessions every time your service is hit.

So, session management will have to be basically hand-coded. You will need your own authentication. You may have server clusters, so you would need to store authenticated clients in a database server.

Also, beware of call and return types. Different clients will have support for different ranges of data types. Most of them will have support for the simple data types. Query data type is probably a no-no for most non-CF clients. Un-types stucts may be a problem too. Typed "structs" are good and involve using CFCs with cfproperty that only contain data. XML is also a good choice. And JSON is building momentum.

You could also check out Sean's REST Adapter. It wraps remote CFC API in simple XML.

Gotchas:

API:
Your API, once released is a contract with your clients. You want to be sure you have locked in your API. Then, you will have to be extremely careful with any changes. In fact, if you make any changes to your API, you may need to provide new end-points to your consumers and support both versions for a grace-period.

Exceptions:
You should consider returning success/failure as a root node in whatever packet you are sending to the clients. Then, you may want to send back a result code, that could be translated by any client and into any language.

Clustering and Caching:
Each member of a cluster has it's own cache. So, you will need to keep caches across servers in sync.

Testing:

Sean says, "Write an extensive suite of tests". And make running them part of your development habits. There are tools to help, like cfcUnit. And you can even automate cfcUnit in Eclipse with an ANT task.

Also, check out Cruise Control. It can automate testing by watching your version control repository and deploying code to a test server and running tests when you check code in.

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.6.002.