How to connect Flex application with Java - apache-flex

I have a average Java knowledge. but i don't have a good knowledge about adobe flex. i want to create flex application which will work with java and i see through the internet it can be done by using BlazeDS. there is 2 configuration files called services-config.xml and remoting-config.xml. I don't have any idea about these files. if these are automatically created through the flex or will i have to create these files manually ? and how to connect flex application with java web project.
I followed this - http://cgrant.wordpress.com/2009/11/20/connecting-flex-to-java-with-blazeds/
Please help me.

There are several middlewares meet your requirement.
In addition, another 2 are:
GraniteDS (recommended, much powerful than BlazeDS)
Pimento (Support enum type)

Related

Application Development Using Flex with SpringMVC

I want to build a demo app using SpringMVC as a backend and Flex as a fronend.
Can anyone please help me in this work.
My Questions:
1) Which tool I should use, where I can write code for both SpringMVC and Flex?
2) How to integrate this two different components?
3) I just want to build a Registration/Login demo. Please help me?
Note: I want to use free tools, plugins etc only
You can use Eclipse for both - just download the Flashbuilder plugin to allow you to develop Flex. Have a look at something like BlazeDS, which will allow you to call the spring MVC classes from Flex.
You may use Powerflasher's FDT, it is Eclipse based, last time I checked it has a free edition. Like TrueDub says, BlazeDS is worth looking at, and there is also Spring BlazeDS integration you can take advantage too.

Consuming .net SOAP Service on BlackBerry PlayBook

I am looking for approaches I can take to consume my .net SOAP service on the BlackBerry Playbook. So far I believe there are two main approaches to my problem.
Apache CXF wsdl2js
I have used wsdl2js to generate the javascript needed to communicate with the service. However I end up getting a http 500 error and have not been able to get past that. I have looked through the provided examples from the Apache CXF download and I have done some searching and cannot find a solid example of creating the javascript client. A lot of examples seem to somehow access the wsdl file at runtime from a server but my javascript is already generated from the CXF tool and I just include the scripts... if anyone has some tips here that would be great.
Adobe Flex and AS3
Another option I have considered is using Adobe Flex. I create a new Mobile Flex project in Flash Builder using the BlackBerry PlayBook SDK and Flex 4.5. However when I use the menu options to connect to a web service I get prompted with "This option is only available for flex projects."
Are there any other options out there that provide a solution to this problem? If you need more information just let me know.I understand this is a large topic, thank you for your time.
In Flex, you can use the WebService class to access SOAP WebServices. More info here.. I'm sure you can use this class for a non-Flex AS3 solution.
I'm not sure why they disable the Flash Builder tooling for this; but it shouldn't prevent you from using the actual classes to access WebServices.
I can't speak about the alternate approaches.

How to externally configure logging in a Flex app?

I was wondering what people are using for externally configuring logging in a Flex app. Are there any ready baked solutions out there, similar to Log4J's configuration via properties files for instance?
If there are, do these work directly with the Flex logging API or are they part of a separate logging library?
yes there is a library that comes with flex mx.logging using this u can add logging functionality in your application both in Adobe Air and Adobe Flex. hope i answered your question :)
Regards,

How to use C# with AIR?

I have some basic experience in making Flex sites, but I think I have more use for Flex in making a desktop AIR application.
Anyway, I was wondering if it is at least possible to use C# alongside Actionscript/AIR? I can't find any example of this.
Also, can I use custom Flash components in a Flex app? I know I can use Javascript components.
Thanks
Your options with AIR are limited to HTML/JS, Flash/ActionScript or Flex. There's no support for other languages and frameworks.
You can create a C# console application and call this application from AIR.
var file:File = File.applicationDirectory;
file = file.resolvePath("CSharpConsoleApplication.exe");
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
nativeProcessStartupInfo.arguments.push("-arg");
var process:NativeProcess = new NativeProcess();
process.addEventListener(NativeProcessExitEvent.EXIT,onProcessDone);
process.start(nativeProcessStartupInfo);
In this way we have a C# application with AIR interface.
Slukse is correct -- it depends on what you mean by "alongside."
Obviously you can't compile C# code into a SWF -- that much we know. But you can certainly embed (as davr suggests) an ActiveX control into a .NET Forms app, load the SWF into that control, and use the ExternalInterface API to bridge the C# code running in the desktop app and the ActionScript code running in the SWF. If by alongside you mean writing server-side C# code to render data consumable by the Flex app, then of course, you can do that, too -- there's plenty of documentation out there covering how to connect a Flash or Flex (or AIR, by extension) app to Web Services of a variety of flavors, including the relatively new-ish WCF stuff.
Another way to go would be to run a standalone C# desktop app (e.g., a service, console app or the like) and have that app listening over a certain local port -- then have your SWF talk to that app using the Socket classes. I'm doing something like this now (with Java, not C#, but the idea's the same) for a personal project.
If by 'alongside' you mean using c# as middleware to connect to your database (probably SQL Server), or to perform remote calculations then yes you can. You can connect to a c# service using remote objects. The midnight coders produce a product called WebORB that is fairly simple to use. Version 3.4 was a totally free version that should suffice if you are building desktop applications in Air. The next two versions are not free but basically offer no real advantage to you.
The only way I know of doing this is with C# web service programs and the AIR/Flex apps communicate with the web services.
The whole point of AIR is to enable web developers who know AS/JS to be able to easily make desktop applications which are automatically portable to win, linux, and mac. Hence why there is no way to connect it to other languages like C#, C++, etc, since web developers generally don't care about those languages, and if they were used, the app is no longer portable (yes, most languages can be ported to other OS's with some effort, but the point of AIR is that you write whatever you want, and it runs everywhere with no extra work).
If you want to combine C# and Flash, instead of trying to put C# inside AIR, what you should be doing is putting Flash inside a C# app. There are various resources for this on the internets, here is one I found in a quick search: Example: Using the External API with an ActiveX container. When you are searching, make sure it talks about the newer, more advanced ExternalInterface / External API method, and not the oldschool SetVariable/CallFunction/watch method. The newer one is much easier to use & has more features.
Also, yes, you can use custom Flash components inside a Flex app. Generally you just make a SWC inside Flash CS3 (or CS4), and then import that SWC inside Flex Builder (or Flex SDK, or FlashDevelop, or ...)
If you are making the components yourself inside Flash CS3, you should use the Flex Component Kit. It provides some features for you, and puts in the boilerplate code, to make your flash component play nice inside Flex. It's included with Flex Builder/Flex SDK.

Can I generate a Flex web and Air desktop app from the same source code?

I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version and one for the Flex/SWF version?
The best approach I've found to creating both Flex and AIR applications from the same source, is to use a core library project for almost all code, with separate small projects for the Flex and AIR applications.
There are two key concepts that make this very powerful and maintainable, allowing for not just two applications, but for many "editions" if you're so inclined.
Modules:- If the core application is
actually a module (or a module that
loads other modules) you'll be able
to easily create stub Flex and AIR
applications that are basically
there to set project properties,
reference classes for cross-module
communication, and then simply load
the core application module with a
ModuleLoader.
Factory Objects:- When there are
things you want to do on the AIR
desktop application that you can't
do in the Flex application, or any
case where you want something to
work differently across
applications, a factory object that
creates an instance of a project
specific class is a great way to do
it. for example, you can call your
"save" function, which for AIR saves
to the file system, but for Flex calls
a web service.
Have a look at Todd Prekaski's
excellent Flex DevNet article on
Building Flex and Adobe AIR
applications from the same code base
on how to do this.
Once you've created a Flex Library project where you're going to create your main module, create your Flex and AIR application projects. In the properties of the two application projects add the library project src directory to the Flex Build Path. While in the project settings you'll also need to add the modules to the Flex Modules section, setting the option to optimise for the project.
You can't mix both AIR and Flex in the same Flex Builder project, but you can share code. Here's how...
Create a Flex based project as you
normally would.
Create a second AIR based project.
In the second application, go to
project->properties.
Select the "Flex build path" option.
Under "Source Path" add the folder
that contains the source from your
first Flex based project.
Now both projects share the code from the flex project.
You need to be careful not to use AIR only API's in code you intend to share between both apps.
You can use the same.
One way is to put the bulk of the application in a Group-based component in a library.
Both Flex and AIR applications can embed that component in their Window.
If you need to have custom code, have your Group component accept an Interface object that has all the methods that are specific to a platform (loadFile, saveFile, etc.). Each application injects an object that implements these methods appropriately.
I've worked on a product that injected a whole local-data access layer (to the SQLite database) and the core application had no idea if it was running in a browser or on the desktop (connected or disconnected).
Cheers
Create 3 project: Air, Web, and common. from air and web, include common.
http://simplifiedchaos.com/how-to-compile-both-flex-and-air-application

Resources