HTTPService: With and Without BlazeDS
BlazeDS supports HTTPService. This can be a little confusing at first because HTTPService has been available in the free Flex SDK since Flex 2 and before BlazeDS was made available. In fact, it is the same
HTTPServicein both cases. Without BlazeDS, a Flex developer is limited to using
HTTPServicewith its useProxy attribute set to false and the connection is made directly to the HTTP service specified by the url attribute.
So, why is it useful to be able to set
HTTPService.useProxy=trueto take advantage of BlazeDS's proxy server support for
HTTPService? The advantage is that BlazeDS's support for the Flex proxy server allows for use of HTTP methods other than POST and GET (including DELETE and TRACE). This is more REST-friendly and is described in the Flex 3 Language Reference documentation for HTTPService.
Another advantage of using BlazeDS in conjunction with
HTTPServiceis that doing so removes the need to use a crossdomain.xml file when accessing a remote server from a Flex application. Besides removing the need for a
crossdomain.xmlfile, the use of BlazeDS server proxy also enables more granular control over access of a server-side service. This means that useful additions like service authentication and service access logging can be performed.
WebService: With and Without BlazeDS
HTTPService, the Flex WebService is supported both with and without BlazeDS. The differences between using
WebServicewithout BlazeDS as compared to with BlazeDS are similar to those for
HTTPService. Instead of the
urlattribute (used by
WebServiceused without BlazeDS will use the value of the wsdl attribute as the location of the server-side SOAP-based web service to invoke and, as with
HTTPService, the useProxy attribute must be set to false when BlazeDS (or other Flex server implementation) is not used.
HTTPService, there are advantages to using
WebServicein conjunction with a BlazeDS-provided Flex server. These advantages are strikingly similar to those for
HTTPServicewith BlazeDS: no need for a
crossdomain.xmlwhen remotely accessing a web service on a remote machine and greater ability to log access or perform authentication checks on potential web service access.
RemoteObject: Only Available with BlazeDS
The previously mentioned two RPC approaches (
WebService) can be used with or without BlazeDS. BlazeDS supports a third RPC mechanism, RemoteObject, that is not available in standard Flex without BlazeDS (or other Flex server proxy product).
Besides being only available with BlazeDS, another difference with RemoteObject (as compared to
WebService) is the encoding used with RemoteObject. While
WebServiceboth make use of XML/text over HTTP,
RemoteObjectuses Action Message Format (AMF) encoding. Also,
RemoteObjectallows Flex developers to write ActionScript code as if they were accessing server-side Java classes directly rather than handling XML as is often the case with
The three RPC mechanisms supported by BlazeDS are highly useful and each has its own advantages. I hope to devote some future blog entries to more in-depth details on each of these three RPC mechanisms and to demonstrate them with code examples. I also plan to include future blog entries on the Flex-to-server communication support offered by BlazeDS outside of the RPC mechanisms (Messaging mechanisms).