Java SOAP Client
Written on 19 November 2009 by JoshuaI ran into a short problem writing a Java SOAP client. I was using the Axis[2] wsdl2java class to generate my Java classes. The latest version of wsdl2java has omitted the -T parameter that’s used to specify the SOAP version for the generate classes. The client’s soap endpoint only accepts SOAP 1.1 (not 1.2) so this proved to be a problem. I downloaded an older version of Axis [1.4] so I could specify the -T 1.1 and build against SOAP 1.1.
This time around the generated Java classes are missing the soap envelope headers needed by the service. I found a great article covering this exact problem.
The only change needed from there was in the service stub…
The org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS needed to be changed to org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS. I was a bit surpised to see those constants after building w/the wsdl2java -T 1.1 argument.
Disclaimer: I’m not a SOAP *expert* so feel free to provide feedback
Glassfish + LCDS | BlazeDS + Flex 4 Up Next
Written on 19 November 2009 by JoshuaIt’s been a busy year getting a J2EE and Data Warehousing education. I’m wrapping up the ETL portion of a large Data Warehousing project. The next phase of the project is building a Flex front-end for the warehouse. I’m looking forward to using the Spark Architecture in Flex 4 for the UI, we should be able to generate some amazing UIs.
Cheers
Josh
Debug [server + client] LCDS Java HelloWorld in Flex Builder
Written on 2 September 2009 by JoshuaPrerequisites
Install Flex Builder
Install LCDS Data Services
Install WTP in Flex Builder
Here’s a simple project that shows you how to create a simple Hello World for Flex + Java via LCDS. I’ll also show you how to debug the server [java] code as we move along.
File->New->Flex Project
Select the target runtime. You will need to click ‘New’ to create one if none are available.
Create a new target runtime if needed.
Be sure to change your Output URL to match the LCDS [tomcat] config (defaults to 8400)

Run->Debug->Other
Again, make sure the URLs are using the correct port
Project->Properties->Flex Server
Okay, are setup is complete now we’re ready to code.
Here’s the MXML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private function sayHello():void
{
testService.getOperation('sayHelloTo').send(txtName.text);
}
private function onFault(event:FaultEvent):void
{
trace(event);
}
private function onSayHelloToResult(event:ResultEvent):void
{
Alert.show(event.result as String);
}
]]>
</mx:Script>
<mx:RemoteObject id="testService" fault="onFault(event)" destination="helloDest">
<mx:method name="sayHelloTo" result="onSayHelloToResult(event)"/>
</mx:RemoteObject>
<mx:TextInput id="txtName" x="10" y="10"/>
<mx:Button click="sayHello()" x="178" y="10" label="Go"/>
</mx:Application>
Note the destination=”helloDest” line, we’ll have to configure a LCDS destination with this name in a few steps…
Create a simple java class to test against:
public class HelloWorld {
public String sayHelloTo(String name)
{
return "Hello " + name;
}
}
And finally, we need to setup the destination
To do so, edit \WebContent\WEB-INF\flex\remoting-config.xml, adding the following
<destination id="helloDest">
<properties>
<source>HelloWorld</source>
</properties>
</destination>
That’s it, now we are ready to test.
Set a breakpoint on the on ‘return “Hello ” + name;‘ line in you’re java code.
Launch the server in debug mode
Now, launch the flex app [in debug mode if you want to debug the front end as well].
Type your name in the input box and click ‘Go.’
You’ll see your breakpoint being caught, both server [java] side and client side
Install WTP in Flex Builder
Written on 2 September 2009 by JoshuaA quick walkthrough on installing the Web Tools Platform (WTP) in Flex Builder.
Help->Software Updates->Find and Install
Search for new features to install
Select the [Europa] discovery site
Select ‘Web and JEE development’
You may need to click ‘Select Required’
AMFPHP Support for JSON POST
Written on 24 July 2009 by JoshuaI found myself wanting to use JSON POSTs (not just GETs) with AMFPHP. Here’s the addition.
Open up core\json\app\Gateway.php.
After
$rawArgs = explode('/', $args);
add the following
if(isset($_POST) && count($_POST) > 0)
{
$len = count($rawArgs);
// Check for and remove [last] empty arg from URL '/' explosion
if($len && trim($rawArgs[$len-1]) == "")
unset($rawArgs[$len-1]);
// Append the POST variables
for($i=0;$i
}
The format of the post variables would be argNo=value
Ex.
Backend Function
public function ResetPassword($username,$password,$oldpassword)
{
// Code HERE
}
Javascript POST parameters for the latter
request.send("0=" + escape(username) + "&1=" + escape(oldpassword) + "&2=" + escape(newpassword));
Hoping to jump into ZendAMF soon
What, my flash gateway is already AJAX ready? Sweet.
Written on 23 July 2009 by JoshuaI’m integrating existing Flex functionality with some new COTS [AJAX RIA] software. Looks like I’m golden on two fronts:
- My existing dashboarding app leverages the dynamic module architecture blogged hear in the past. Each module was cleanly encapsulated so it’s about a dozen lines of code to convert each module into a stand-alone app that integrates w/the AJAX page.
- My AMFPHP backend is fully reusable!! Using JSON for my AJAX calls, I can simply hit
path_to_amfphp_install/json.php/class.package.classname.methodname/arg1/arg2/arg3
I really need to take some time and check out Wayne’s ZendAMF to see what he’s cooked up there, I’ve been far too busy as of late.
VerifyError: Error #1053: Illegal override of removeChild Bridge in mx.managers.SystemManagerProxy.
Written on 25 March 2009 by JoshuaRan into this error recently when using automation testing (RunTimeLoading.html/swf).
Turned out to be a recently updated SWC (library) that was compiled under a newer SDK than the main app.
With the mixed SDKs main app / SWC(s) RunTimeLoading.swf was unable to load regardless of which SDK version RunTimeLoading was compiled under.
DBF->MySQL
Written on 23 March 2009 by JoshuaWhile working on a staging area for a warehouse, I ran across the need to capture a table schema from a DBF file.
If found this link http://ae.inc.ru/dbf2mysql.php
Problem:
While running the program I received this error
error connecting to database client does not support authentication protocol requested by server; consider upgrading MySQL client
Solution:
You simply need to (in mysql):
SET PASSWORD FOR username@’host’ = OLD_PASSWORD(’password’);
Connecting to 32 bit / 64 bit data sources from Tomcat (Java)
Written on 3 March 2009 by JoshuaProblem:
When running tomcat your receive the following error when connecting to an ODBC data source
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Solution:
There are *two* ODBC managers in 64 bit windows. 64 bit ODBC data sources are separate from 32 bit data sources.
The ODBC manager accessed from the Control Panel contains the *64 bit* ODBC data sources.
Launch C:\windows\syswow64\odbcad32.exe to configure the 32 bit ODBC data sources.
If your running a 64 bit app, you’ll have access to the 64 bit data sources. Likewise, if your running a 32 bit app you’ll have access to the 32 bit data sources.
For Java apps, you’ll need to invoke the app with the correct JVM (32 bit or 64 bit) to have access to the desired data sources (32 bit or 64 bit).
On Vista, the 32 bit JVM(s) can be found (by default) at C:\Program Files (x86)\Java\jre6\bin. The 64 bit JVM is at C:\Program Files\Java\jre6
Catalina.bat (used to start tomcat) looks to see if JRE_HOME is defined so make sure this is pointing to the correct JRE or update catalina.bat accordingly.
Iterating a filtered collection
Written on 12 February 2009 by JoshuaOkay, nothing profound here but thought I’d post as it’s a common question.
If you have filtered a collection,
ex
var ac:ArrayCollection = new ArrayCollection();
...
...
ac.filterFunction = myFilter
ac.refresh()
but you’d like to iterate over / access the unfiltered collection, simply use the .list property
var items:IList = ac.list
cheers
Josh
Diving back into the blog
Written on 12 February 2009 by JoshuaI’ve had a crazy past few months. If I’ve been slow to reply to your comments - sorry !!!
I’ll be posting regularly again now
Josh
RSL + Loading [Multiple] Dynamic Modules
Written on 12 February 2009 by JoshuaSo I ran into a Flex bug recently documented here .
If your using the framework RSL (Runtime Shared Library) and loading modules, you should read the latter link. I was loading multiple modules and noticed that that they all didn’t necessary load. A little searching and I stumbled upon the open bug in JIRA.
One suggested work around was to load the modules sequentially. This works but doesn’t make for the best user experience. In my case the modules were being loaded dynamically and added to a viewstack. I opted to create a ‘lazy module loader’ component that loads the module on creationComplete().
I filled my viewstack with these components, made sure the viewstacks creation policy was set to ‘auto’ and voila, every things is working great. Of course one could avoid this component and add each module to the viewstack directly - in my use case I don’t want the main app to have to compile in [i.e. bloat] all [any of] the modules when, depending on the users auth they modules may not be used.
South Bend’s Flex User Group: RIA @ the Bend
Written on 29 December 2008 by JoshuaIf your close to the South Bend, IN area, I’ll be heading up a new Adobe Flex User Group (http://groups.adobe.com/groups/3595576894/summary). Tim Eash, another local Flex developer will also help head up the group. We’ll be updating the group site over the next few weeks.
We’ll be meeting monthly at I.U.S.B. starting in January. Many thanks to Dr. Hakimzadeh, director of Informatics at I.U.S.B. for setting up the facilities.
The groups focus is Flex, Air, ActionScript, and Catalyst development. If you have any topics you’d like to discuss just let me know.
Flex 4 (Gumbo) Compiler Benchmark
Written on 21 November 2008 by Joshua‘Benchmark’ is being used pretty loosely here. I just got back from MAX and thought I’d check out the new compiler performance.
In addition to the exciting new display logic separation (Spark Framework), the SDK team has worked on speeding up compilation.
I compiled (incremental build) a project containing 57K lines of code (34K AS3, 23K MXML) under the 3.1 SDK via FlexBuilder. The compile took 40 seconds.
I then pointed FlexBuilder to the Flex 4.0.0 SDK. Make sure you update the ‘Require Flash Player Version’ on the Flex Compiler settings page to 10.0.0. If not you will receive errors including
1046 type was not found or was not a compile-time constant Matrix3D
After building the project I then preformed the same incremental build under 4.0.0 (Gumbo). The compile took 25 seconds.
Results:
SDK 3.1: 40 seconds
SDK 4.0.0 (Gumbo): 25 seconds
That’s not too bad, only ~62% of my original compile time.
MAX 2008 - Pre-event Summary
Written on 16 November 2008 by JoshuaOkay, the first day of Adobe MAX 2008 is winding down. MAX is being held in San Francisco this year.
Today included registration and full day labs.
Badges
The badges got a technology upgrade this year, no bar codes this year, rather an RFID name badge. The local electronic stores are closed for the night - if I can find some time, it might be a fun project to grab an RFID reader and write up a quick AIR app (this *is* an Adobe conference after all
to look at the data on the card. The information kiosks include RFID reader/writers that you use to ‘update’ your badge as you change / update your session schedule.
Tidbits
A few of the new features of the next FlexBuilder and AIR Runtime did slip out today. It’s not my place to ’scoop’ that info - so I’ll wait to post until the general / official announcements are made in the next few days
Looks like Max 2009 will be on the West Coast again, this time in Los Angeles (Oct 4-7).
For those PureMVC developers out there, Cliff Hall will be broadcasting on Tuesday afternoon from the Marriott.
If your attending Max this year, feel free to drop me a line.
Refactoring, Error #1065
Written on 23 October 2008 by JoshuaI received the following runtime error in a flex project recently:
Error #1065 Variable package::Component_inlineComponent1 is not defined.
I was refactoring away from some static MXML to a dynamically loaded module. I had commented out the static MXML to test the dynamic module. Everything worked great. When I un-commented the previously working static module the #1065 error was thrown.
Problem:
[Cache causing] Error #1065 Variable is not defined error.
Solution:
Project -> Clean
Revisiting one of my first RIAs
Written on 17 October 2008 by JoshuaI spent some time updating on of my *first* RIAs today.

The application allows special needs teachers to create IEPs (Individual Education Plans) for students. The teachers fill out various (20+) forms that compose the students’ IEPs.
During the initial interviews, it was identified that the forms would be revised annually and new forms would be added. Dynamically generated forms were *beyond* the project’s scope, so some easy-to-update forms were needed.
So back today, it’s always fun going back to revisit old code. I got a kick out of looking back at the approach taken on the RIA, hence this post. I wouldn’t necessarily recommend this “architecture” but it did make my job today extremely easy/fast to add some new forms & update some existing forms.
The Architecture
I created a Flex component based on MX:Accordian. This component exposes a function ‘getData’ that when called recursively extracts data the user had entered in the form. This includes any data entered in datagrids, combo boxes, etc. The data is returned as a loosely typed ActionScript object.
The object graph is sent to PHP via AMFPHP and persisted in MySQL via a PHP “ORM” class that can persist (& reconstruct) any PHP object graph. The object graph is not serialized rather, a modified preorder tree traversal algorithm is used. This provides for simple SQL queries, when / if needed.
On the PDF form the form field is simply set to the desired attribute name of the object graph.
So today, to add any form fields, I simply drop on an input (textbox for example), give that input an id and set the text property using databinding. (eg. id=”iep_firstName” text=”{dp.iep_firstName}”).
That’s it.
The new field will be persisted with no other work required
The field can be added to the PDF should the field need to be printed.
We have 8 Million+ records to date, and things seem to be scaling well.
Open Source ESBs - It’s Here !!!
Written on 17 October 2008 by JoshuaI was excited to find an unexpected package on my doorstep last weekend. I had enrolled in Manning’s early access to Open Source ESBs quite a while ago (last year???). Well the books in print and I’ve got my copy in hand.
I’m currently reading this book right now and loving it!!. I’ll make sure I update this post once I’ve finished the book.
For those not familiar with ESBs (Enterprise Service Bus), suffice it to say the Enterprise Integration field is one of the most rewarding areas to be in software right now, IMHO.
EI is full of architecture (which I love) so it’s a blast working in this field. Add data warehousing some RIA and you’ve got a snapshot of my past three months
The Data Warehouse Toolkit
Written on 17 October 2008 by JoshuaI’ve read some really great books the past few months and thought I’d post a review.
I’d highly recommend Ralph Kimball’s The Data Warehouse Toolkit.
I’d normally opt for an architecture book over a [dry] database book without a second thought. Well I was pleasantly surprised to find this great resource.
Kimball gives the reader a GREAT introduction to dimensional data modeling. For those ‘big picture’ developers out there, you owe to yourself to take a look at this work.
I’ll leave the lengthy reviews to those more eloquent writes out there
Two thumbs up.
Pipes Source Code
Written on 17 October 2008 by JoshuaI’ve been heads down in development the past few months. During that time I’ve had numerous requests for the full source on the dynamically loaded modules ‘Pipes’ demo,MortgageApp.
I *finally* had time to upload that source, simply use the ‘View Source’ on the demo to view the source.
I’ve implemented a few enterprise RIAs using PureMVC pipes now. They work great, but I’m working on engineering (architecting) a new approach that I’ll post on the blog when it’s ready












