Flex & Flash as Competitors to Java?

As previously discussed, my friend Joshua from Sun recently blogged about how the consumer JRE will take market share from Flash in 2008. Today Sameer Tyagi , also from Sun, blogged about problems with using Flex to front-end JAX-WS. Both posts seem to insinuate Flash and Flex as competitors to Java. Yet for me Java and Flex have always been a perfect match.

The continued success of Flash and Flex only helps to better position Java in the enterprise. Adobe is not a threat to Java’s continued dominance on the server. In fact many Adobe enterprise products are built on the Java platform including Flex Data Services. If you must have an enemy then I suggest targeting those who actually have something to gain by Java losing market share in the enterprise. That is definitely not Adobe.

As I’ve said elsewhere, Java and Flex developers should be working more closely together to make building RIAs easier for developers and to make experiencing those applications better for end users. Both technologies have similar values when it comes to openness, free tools and runtimes, and cross platform support. And the areas in which Java and Flex overlap are really very minimal. Developers and end users have much more to benefit by our harmony than by our discord. I continue to meet many people who are embracing this vision of a harmonious union of these two great technologies. I encourage others to consider doing the same.

Now to respond to Sameer’s disappointment “with the Web Services support, or lack thereof, in Adobe’s recent Flex 3.0 beta release” I built a quick Flex app which calls the non-trivial Web Service from the JAX-WS samples that Sameer referenced. Here is the code for what I came up with:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:Script>
  <![CDATA[
  import mx.rpc.events.ResultEvent;
  import mx.rpc.events.FaultEvent;
  import mx.controls.Alert;

  private function handleFault(event:FaultEvent):void
  {
    Alert.show(event.fault.faultDetail, event.fault.faultString);
  }

  private function handleResult(event:ResultEvent):void
  {
    Alert.show("Your shipment number is: " + event.result.shipmentNumber, "Purchase Order Accepted");
  }

  private function submitPO():void
  {
    var po:Object = new Object();
    po.customerNumber = "1";
    po.orderNumber = "1";

    var item1:Object = new Object();
    item1.itemID = 1;
    item1.name = "a";
    item1.price = 1;
    item1.quantity = 1;

    var item2:Object = new Object();
    item2.itemID = 2;
    item2.name = "b";
    item2.price = 1;
    item2.quantity = 1;

    po.itemList = [item1,item2];

    srv.submitPO.send(po);
  }
  ]]>
  </mx:Script>

  <mx:WebService id="srv" wsdl="http://localhost:8080/jaxws-supplychain/submitpo?wsdl" fault="handleFault(event)" result="handleResult(event)">
    <mx:operation name="submitPO"/>
  </mx:WebService>

  <mx:Button label="Submit PO" click="submitPO()"/>

</mx:Application>

This is a very simple example and doesn’t have the UI necessary to actually assemble a PO based on user input. That piece would also be trivial so I’ve left it out of this example. The key thing is that it correctly talks to the JAX-WS based Web Service. This is just one example which uses Java and Flex together. There are many more. And there are plenty of enterprises happily using Java and Flex together. Pitting these technologies against each other does nothing to benefit developers or end users.

This entry was posted in Flash Player, Flex, Java. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Sameer Tyagi

    Correction – I dont work at Sun, used too in the past. You may want to correct that in the entry above.

  • http://www.jamesward.org James Ward

    Thanks Sameer. That has been fixed. Sorry I misunderstood that.

    -James

  • http://www.mindmeld.ws Les

    One of the problems is that adobe needs to be pushed into making flex do the things that other libraries do…like accessibility, solid transmission security, etc. To this point, they have not gone there. If there is some competition, then maybe one of the parties will come up with a reasonable component model for RIAs. However, if they cooperate we are likely to get more of the same (see the fall of communism :)).

  • http://www.jamesward.org James Ward

    Les,

    Flex has great accessibility support:
    http://livedocs.adobe.com/flex/201/html/accessible_088_01.html

    And solid transmission security since we use the browser’s networking stack. Thus we support HTTPS. You can also do RTMPS if you want an encrypted real-time channel.

    Am I misunderstanding what you were referring to?

    -James

  • Pingback: .:: a few thoughts on the subject by rob wright ::. » links for 2007-08-23()

  • http://sameertyagi.blogspot.com/ Sameer Tyagi

    There is a significant difference in the Java and Flex “monetizing” models. If an enterprise wants to build a Flex application today, they need to dig deep in their pockets. The only IDE available for Flex today starts at $499/seat ($749 if you want to use charts).The Flex Data Services component you refer to above is additional $ ($20K if I m not mistaken?). Compare this with a Java+Ajax/Dojo/Javascript/other solution where everything end-to-end can be used at zero cost thanks to Sun and the huge open source community.

    If Adobe truly want to see Flex and Java work together,rather than just riding on Java’s popularity in the enterprise, it should start by loosening the reigns on the technology and worrying less about monetizing on it directly. The step to open source the SDK is a first one in the right direction. Taking ActionScript and AMF to a standards body and developing it in the community rather than unanimously would be a close second.

  • http://www.jamesward.org James Ward

    Sameer,

    There are open source / free alternatives to Flex Builder and Flex Data Services.

    Also ActionScript is an implementation of the ECMAScript specification, the same spec that JavaScript is based on.

    -James

  • http://www.himalayansouvenirs.com surajz

    Are there any free flex chart components available?

  • http://www.jamesward.org James Ward

    Hi surajz,

    Not that I’m aware of. But you can do a lot by hand just drawing your own vectors.

    -James

  • http://www.newyyz.com Edward Apostol

    Just to add commentary to Sameer’s note about AMF. Not only has ActionScript been submitted to the Mozilla Foundation to be an open language along the lines of JavaScript see (http://www.mozilla.com/en-US/press/mozilla-2006-11-07.html) , but the AMF format itself has not been submitted for open publication as well (http://labs.adobe.com/technologies/blazeds/).

    Specfically, the press release on ActionScript is as follows:

    “Adobe Systems Incorporated (Nasdaq:ADBE) and the Mozilla Foundation, a public-benefit organization dedicated to promoting choice and innovation on the Internet, today announced that Adobe has contributed source code for the ActionScript™ Virtual Machine, the powerful standards-based scripting language engine in Adobe® Flash® Player, to the Mozilla Foundation. Mozilla will host a new open source project, called Tamarin, to accelerate the development of this standards-based approach for creating rich and engaging Web applications.

    The Tamarin project will implement the final version of the ECMAScript Edition 4 standard language, which Mozilla will use within the next generation of SpiderMonkey, the core JavaScript engine embedded in Firefox®, Mozilla’s free Web browser. As of today, developers working on SpiderMonkey will have access to the Tamarin code in the Mozilla CVS repository via the project page located at http://www.mozilla.org/projects/tamarin/. Contributions to the code will be managed by a governing body of developers from both Adobe and Mozilla.”

    And regarding AMF (and BlazeDS, the open source Data Services project)

    “Adobe is announcing its plans to contribute the proven BlazeDS technologies to the community under the LGPL v3. BlazeDS gives the rapidly growing Adobe developer community free access to the powerful remoting and messaging technologies developed by Adobe.

    Concurrent with this prerelease of BlazeDS, Adobe is publishing the AMF binary data protocol specification, on which the BlazeDS remoting implementation is based, and is committed to partnering with the community to make this protocol available for every major server platform. The source code will be available for download early 2008. Please read the FAQ for further details on BlazeDS and Adobe’s open source plans.”

  • http://www.jamesward.org James Ward

    Hi Edward,

    Did you mean to say “but the AMF format itself has also been submitted for open publication”? Changing the “not” to “also”. Since the AMF format is now a published spec.

    -James

  • http://www.newyyz.com Edward Apostol

    Hi James –

    Yes, “Not” meant “also”…I think I did learn this great language called English once (smile)

    regards

    Edward

  • Tim Goodman

    Hi James,

    I tried the example you gave with one of my SOAP servers, and I got the error below. Did you also need to update the services-config.xml file? If so, can you post that also?

    Many Thanks,
    Tim

    ‘Destination ‘https://{servername}.com/soapi.pl’ either does not exist or the destination has no channels defined (and the application does not define any default channels.)’]
    at mx.messaging.config::ServerConfig$/internalGetChannelSet()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\config\ServerConfig.as:624]
    at mx.messaging.config::ServerConfig$/getChannelSet()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\config\ServerConfig.as:255]

  • Rohit

    hi James,

    Thanks for the enlighting post,it was a great help!!
    Can you explain how do we send an object array,something like this :
    public class XXX
    {

    private var id:int;
    private var organization:String;
    private var owner:UserRecord;
    private var params:Array;
    }
    public class UserRecord
    {
    private var display_name:String;
    private var id:int;
    private var xx:Array;
    }

    Now I have a tree structure..when I try to pass it as an object in the Axis webservice,It receives null.
    Object is constructed at the flex end though.

    What are the available options?Any help would be appreciated.

    Thanks,

  • http://www.dailytechnologytips.com Sunil

    Nice article. I am sending a very complex object from flex to Java using Axis. The structure is like this

    Class A{
    var 1
    var 2
    .
    .
    var n
    Array B
    }

    Class B{
    var 1
    var 2
    .
    .
    var n
    Array C
    Array D
    }

    Class C{
    var 1
    var 2
    .
    .
    var n
    Array E
    }

    Something like this. And on the java side, i am getting nothing. With Java test client, my webservice works very fine. But with flex client, it does not.

    Any help or suggestion is welcome.

    Thanks,
    Sunil

  • http://www.jamesward.org James Ward

    Those having problems should first try the new Web Service Import wizard in Flex Builder 3. If that doesn’t work or you want to use mx:WebService please file a bug:
    http://bugs.adobe.com/flex

    -James

  • Pingback: Fears about Open Source are Real « Storagedumpasia Rumblings()

  • Jon

    Has anyone had success using the proxy classes that the new “Import Web Service (WSDL)…” function in Flex Builder 3 generate? I REALLY wish Adobe would fix up their web service support. What is the deal? As near as I can tell, it doesn’t even work. I have had some success doing it the old way without the generated classes, but, I’ve ran into numerous bugs doing it that way as well. Specifically, I’ve had a lot of issues with collections. The new way works just fine WCF, yet it seems to completely fail with JAX-WS. This to me makes no sense given Adobe seems to use Java on the backend. I don’t get it. Even Silverlight works fine with JAX-WS.

  • http://www.jamesward.org James Ward

    Hi Jon,

    SOAP Web Services are a tough thing to consistently support given all the differences in implementations. Can you file a bug for your specific problem? http://bugs.adobe.com/flex

    Thanks.

    -James

  • http://www.fg114.com Bing Ran

    @Jon

    I think I have a workaround for Flex WDSL importer with JAX-WS.

    It’s a simple wrapped parameter thing.

    Once I have imported a wsdl from jax-ws (with minimal jax-ws annotation), I opened the BaseMyTestService and searched for all the

    requestMessage.isWrapped

    and

    responseMessage.isWrapped

    and set them to false.

    That’s all.

    Not sure why, since I’m not a webservice export. I’m curious thou.

  • Patrick

    Please share the modifications made to the wsdl to allow the import. I am trying to import a wsdl for an Oracle PL/SQL service, but have the same issue you are having with JAX-WS. It just doesn’t work..

    Thanks,

    Patrick

  • http://www.jamesward.com James Ward

    @Patrick
    Can you also file a bug with your WSDL:
    http://bugs.adobe.com/flex

    Thanks.

    -James



  • View James Ward's profile on LinkedIn