ColdFusion .Net Integration

Again - forgive the haphazard nature of the notes.

.Net Integration Session

Why? Leverage functionality available in .Net. Leverage MS products like Word, Excel, Outlook, etc.

Idea is to keep it simple. (Like rest of ColdFusion.) Right now you can talk to .Net using web services (if the .Net code is available via web services.) With Scorpio you will be able to do it directly.

How can we interact with .Net?
Web Services (available now)
Messaging
Using COM
Runtime Unification (new in Scorpio)

Runtime Unification:
Make .net components locally available. Invoke .net components directly from CFM. Using cfobject and createObject. Works very much like cfobject/createobject for Java

<cfobject type=“.net” class=“xxx” assembly=“foo.dll” name=“something”> <cfset foo = something.method>

Web Services versus RU:

Loose coupling versus tight coupling.
Coarse granular and less programmatic control versus fine granular and more programmatic control.
Low on performance/realiability versus better performance/reliability.
Stateless versus Stateful.
Web services more useful for external clients where RU is better for internal clients.

Features:
Seamless (no configuration)
Location independent (components can be remote or local)
Platform independent (CF can be on any platform calling .Net on a Windows platform)
Hot deployment of assemblies.
Can talk to multiple .net servers.
Secure
Automatic conversion from/to basic CF datatypes and .Net datatypes.

Syntax:
cfobject: class, name, assembly, protocol, secure, server, port

For assembly, can be a list of exe’s or dlls or proxy jars. mscorlib.dll always included.

For protocol, binary is default with best performance. HTTP can be used across the net.

For constructors, you manually call init() after the cfobject call.

For static methods, no need to call init.

Example shows getting running processes via .Net. Next example is creating Word docs via ColdFusion.

For datatypes - decimal type not supported. You can use JavaCast on the CF side. JavaCast updated to support byte, short, and char. They have a full mapping of .Net to Java conversions. (Too much to type.)

A proxy is used to handle communication. This means that if you are on a non-Windows machine, must use a command line tool to create the proxies. Proxies generated for .Net 1.x can be used for 2.0 as well. Proxies generated for 2.0 can only be used for 2.0.

Deploment scenario: .net and cf on same machine - no configuration - simplest.

CF and .Net on 2 different machines. The “.Net Side Agent” needs to be installed on other machine and you have to register the assemblies that CF will have access too.

CF on non-Windows machine. .Net side agent needs to be installed on the .Net machine. Generate proxy. This is done on .Net machine and you copy the generated JAR to the CF machine.

Limitations: Enum and Decimal data type not supported.
Methods with out parameters as arguments.
Methods with pointers as arguments or return type.
.Net UI components
Callbacks

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.

Want to read more like this?

    Sorry, nothing recent related to this content is available.