I remain disappointed with the Web Services support, or lack thereof, in Adobe's recent Flex 3.0 beta release. Dont let this document fool you, that GUI hasnt been available for a long time. It was there in the original Macromedia release only. If youre building a RIA thats consuming web services, and I mean real-world web services - not the hello world or getXXX services that only pull data - Document Based Web Services that send and receive requests, responses and faults based on anything beyond a very simple XML schema, then you're in for a surprise. For example, consider a simple purchase order Web Service (like this one) that send a po, gets a status or a fault, heres whats involved from a high level. - Once you have the nice flashy UI up, you include a web service MXML tag which references the web service by mapping WSDL to that tag (detailed IBM doc here)
- Then figure out what the exact SOAP request looks like (careful with the namespaces etc).
- Map UI input into above request structure by writing Actionscript.
- Send the request.
- Map reponse and fault structures into corresponding UI data elements with Actionscript
If you dont understand the complexity of step 1-3 above, consider the underlying gymnastics , outlined in this link (from Flex documentation), to write MXML which generates a SOAP request like listing 15 with a variable number of LineItems. You have to write a some other client first to get capture the soap request structure, copy-paste it into the script and then code to bind request/reponses/faults to UI element and objects (theres a for-loop involved in adding the various line items)
Does that mean real-world Flex based Web Service RIA are hard ? Without significant architectual foresight, perhaps yes; Harder than the general Architects perception, mostly created by the plethora of hello-world type demos floating around and the tremendous marchitecture leading to info-management. Perhaps with Introspection wizards slated for M3 this will change. Those disagreeing should take a shot at developing an out of the box Flex client for web services based the of the UBL or STAR schemas.
11 comments:
Sameer,
I've posted a blog which correctly connects to the purchase order JAX-WS Web Service. Let me know if that works for you.
-James
James, thanks for the feedback. However my concern remains. It doesnt matter if you use explicit or implicit binding, the fact is that if you want to use a service that takes a schema input and has multiple operations, you have to manually/visually parse that schema to understand what goes in and what comes out,figure out how wsdl structures map into mxml, and map schema structures into mxml. All of which is error prone and time consuming if the schema/wsdl is complex. This can be remedied in two ways - have some kind of proxy generator/wsdl parser in flex builder or have the steps automated with wizards.
Yes that is true. What I actually had done first which I didn't include in the blog was to convert the Java VOs to AS VOs and use those instead of dynamically typed objects. That worked fine, but added to the code. Ideally what we need is wsdl2as that would do the stubbing out for you like wsdl2java does. Using something like j2as makes the process easier, but not fully automated. I've thought about porting wsdl2java to wsdl2as but haven't had the time. This is the kind of thing that I hope the community would bite off. But no one seems to have stepped up. Want to volunteer? I'll lend a hand.
-James
I finally managed to put the flex+jaxws example together that somewhat works(screenshot here). As described in the previous comments, you need to manually look at the schema and map the element names and types.The code can be found here.
Stab in the dark here by an old architect vs. developer :)..
Why not consume the Web Service server side (where many tools are strong) then feed into UI via standard Flex engine?
Sam, you can also use WSDL2AS (by open source flash) and use objects instead of XML when you communicate to web service.
Is this using Beta 2? Im looking at Flex for the first time and the Data Wizard "Import Web Service" seems to do an OK job of creating AS3 files for all classes & methods. There are a few bugs, but hopefully this will be fixed.
Hi!
I'm trying to import a web service into a Flex Builder 3.0 proyect using the wizard provided and I get a "Provider com.bea.xml.stream.MXParserFactory not found" error when click finish.
The service comes from a Netbeans 6.0 web service sample proyect runing on Glassfish v2
What can I do?
If anybody is still curious on this. Based on what the issue is, I would recommend entering the URL of the wsdl in a web address bar. This most likely will redirect you to another URL. Use that URL.
HI,
I also get the same error , when importing a web service.
"Provider com.bea.xml.stream.MXParserFactory not found"
Any idea on how can I resolve this.
Also if any one is facing the same issue please see this also:
http://bugs.adobe.com/jira/browse/FB-13000
I would recommend to vote for this also if you are facing the same issue.
Thanks.
I have to wonder if Adobe even tested this stuff with JAX-WS. The new Import Web Service function seems to work alright with a WCF service, but, I'm having issues with JAX-WS. I call a method and the result is null even though I can see the SOAP response come back in a valid format using a debugging proxy. Another annoying thing that I've seen is that unlike the old way of calling web services in Flex 2, if a property on an object is null, it passes the name of the property with nil=true. This results in JAX-WS creating a default object for the property rather than just making it null.
Post a Comment