Provider com.bea.xml.stream.MXParserFactory not found - apache-flex

Anyone come across this error when trying to import a WSDL in Flex builder 3?
Seems it only occurs when trying to import a WCF based service which has 'virtual' endpoints...
Some digging around makes me think Flex has trouble parsing the wsdl (however standard web services work fine).
A bug has been opened for months and still no reply from Adobe:
http://bugs.adobe.com/jira/browse/FB-13542

I am using Flex Builder 3 and the solution found here http://poradowski.com/fb/ that was mentioned in the adobe bug base at FB-13542 worked for me. I just backed up the com.adobe.flexbuilder.axis2_3.0.214193.jar file and put the updated jar file in it's place. Restarted Flex Builder and was able to import our wsdl that had the "policy" tags in it.

This generally happens when you are using the StAX API, and you do not have a StAX implementation in your classpath. See http://forums.java.net/jive/thread.jspa?messageID=117971
I am not too familiar with Flex - but even if you are not using StAX directly, it may be using it under the covers.

Related

conditional compilation in Flex (Actionscript) and import statements

I have a web application written in Flex and I'm trying to build an AIR application from the same code base using conditional compilation.
In the AIR application, I need to have import statements such as the following:
import flash.data.SQLConnection;
import flash.filesystem.File;
but I cannot have these import statements in the web application because they are AIR only classes.
I thought I could use conditional compilation to overcome this issue but then I read the following on page http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7abd.html:
"You cannot use constant Boolean values to conditionalize metadata or import statements."
If that's the case, how can I have common codebase for Flex based web as well as desktop applications? Has anyone solved this conundrum?
Thanks,
Dilip
More on this question after some trials and errors...
I have 3 projects in Eclipse for this project... one for web application, one for AIR application and one for the common source code. In the web and AIR project, I point to the common source code. In the common code, I used conditional compilation and it looks like you can do something like the following:
CONFIG::desktopMode {
import flash.data.SQLConnection;
import flash.events.SQLEvent;
import flash.events.SQLErrorEvent;
import flash.filesystem.File;
}
and similar approach to include web or AIR specific functions during compilation. The approach seems to have worked so far!
The only place I have run across issues is in my Cairngorm's model locator. If I put CONFIG::desktopMode around import statements in Cairngorm's model locator, it starts giving "Uncaught exception in compiler" or "1131 classes must not be nested" error. I'm not sure how to address this error!
Dilip
You can avoid imports referring fully qualified class names in code. This way you can use conditional compilation.
A common 'codebase' isn't really the situation. Your common codebase is the views and such, but from your Flex to your Air application, your business layer changes. For this, I would recommend you create 2 different projects (one for web, the other for air) and have a library project for all common components, classes, whatever, that can be shared between the two.
It's impossible to have a class like you're saying that says 'if flex, only use this code; if air use this one' since the air SDK adds extra functionality and just saying 'import this' won't work because you also need to remove all references to that import which makes it unreadable.
You need to architect your project properly so that you can separate and abstract out most classes so they can be used for both projects, and then within each project have their specific implementation. Using an application framework like Parsley might help you to accomplish this; I know it helped me.
You can always switch to some full preprocessor like M4 and build your program using normal build tools and not the IDE.

Remoting in flex - Is service-config really needed? And What is endpoint url?

Rather than calling it a question, i would like to call it a discussion and the topic is Flex Remoting. Forms and blogs explaining remoting in flex always mention 2 things:
service-config.xml
endpoint url
Now what i want to know is that
1. is service-config file actually needed if we need to bind our front end (which is in flex / air) with some database (mySql for instance). Coz i've done a couple of projects in flex and air and didn't use this config file. I used Flex 3. Though i used this config file in the projects i did in earlier version of flex 2.0 .
2. What actually this endpoint url does; could someone please explain it.
The way i implement remoting is like this:
<mx:RemoteObject id="remoteObj" source="MyPHPCls" destination="AMFPHP" result="remoteResult(event)">
<mx:method name="someServerSideMethod" result="onMethodResult(event)" />
</mx:RemoteObject>
Also if you could please tell me if the approach i am following to use remoting is incorrect.
Hope to hear from someone soon :).
Thnx,
Jatin
The services-config.xml data is compiled, or hard coded, into your application at compile time. You don't need to use a services-config.xml file if you don't want to; but if you want to use RemoteObject, that data will need to be available to your SWF somehow.
Here is a good blog post on setting the services-config file at runtime.
The end-point URL is just a URL to a Remoting Gateway.

404 Error using Flash Builder 4 BlazeDS wizard

My issue this time around is trying to use the new DCD BlazeDS wizard in Flash Builder 4. If I set my project up as a combined Java/Flex app I am unable to connect to the RDS servlet using the wizard. I get a 404 error every time.
I'm certain the service is set up correctly since my app can access the exposed java classes and BlazeMonster can see the exposed services.
Is anyone else having this issue and if so has anyone found a work-around? I'd very much like to use the code generation features of the wizard for my project.
Thanks as always,
Codeflayer
You also need to make sure you have the RDSDispatchServlet setup in the web.xml config file.

Flex WSDL to Actionscript as ant task?

Flex Builder 3 provides support to generate actionscipt from WSDL via the GUI ( Data->Import Web Service (WSDL) ) - but this sort of method requires that you check in the generated source. This is not desirable to us (we understand both sides of the 'should generated source be checked in' and we have decided that they should not) so we would like a method to generate the actionscript classes from an ant task. In this case, the WSDL would live in the file system.
Any ideas?
You could spent some time digging through Flex Builder's JARs to find the libraries they're using to do this, then invoke them from a very thin custom Ant Task you write yourself. The likelihood of this succeeding is small but might be worth investigating to save yourself a ton of work, just in case.
Short of that, I'd start with WSDL2Java to generate Java classes that represent your WSDL entities. The results won't necessarily be beautiful but you should get classes that adhere to the JavaBean spec. Then you could use one of the open source Java-to-ActionScript generators which include:
Granite Data Services' Gas3
Spicefactory's Pimento, which has Java->AS3 generation
I'm almost positive that Gas3 has an Ant Task you can use; not sure about Pimento.
From the comments in the generated code Flex Builder uses Apache Axis2
/**
* BaseBlaBlahService.as
* This file was auto-generated from WSDL by the Apache Axis2 generator modified by Adobe
* Any change made to this file will be overwritten when the code is re-generated.
*/
I've also found this on the Adobe Forum http://forums.adobe.com/thread/96006.
I'm also trying to solve this issue. I guess we need to create a feature request on the adobe flex website. Let me see if i can find my adobe.com user id....

In Flex, is it posible to identify if the code is runing on Web or AIR?

I'm coding an app that runs both in the web and on AIR, to avoid copying code arround, I figured I should do 3 kinds of projects on flex builder: Library, Web and AIR projects.
So all my code is on the Library project.
I have accessData.as that extends EventDispatcher to fetch web services and return them as an event. I plan on using this class to also fetch SQLite data for the desktop version, but to do so I need it to decide from wich source to get the data depending on if its Web or AIR.
Anyone know how to do this?
Please refer to this link Detect AIR versus Flash Player from an actionscript library Its more detailed.
You really should have two build targets, one for Web and one for AIR. And your code should be designed in a way that the rest of the system doesnt care what the implementing part is doing, only that it conforms to a certain interface. This way, each build simply replaces the implementing code for each desired platform.
You may find something useful under System or Capabilities in the docs.
Create 2 projects Air and Standalone and create 2 conditional compilation variables for example "standalone" and "air". (more here).
Go to Project->Properties->Flex Compiler and add
For air project:
-define=CONFIG::standalone,false -define=CONFIG::air,true
and for stanalone:
-define=CONFIG::debugging,true -define=CONFIG::air,false
In your code set:
CONFIG::standalone {
trace("this code will be compiled only when air=false and standalone=true");
}
CONFIG::air {
trace("this code will be compiled only when air=true and standalone=false");
}
umm... I just found out a way
var appName:String = Application.application.name;
this works since the web version is called "" and the desktop version is called " desktop"
but if anyone has a better way please go ahead.
thanks.

Resources