9/11

It’s September 11. A day that lives in infamy. And here I am in NYC (across the water at Jersey City actually). Outside my hotel room window, I can see twin beams of light shooting upward to the sky, part of the city’s memorial activities. May we always remember this day, may we always remember that the enemy is still out there, and will always be there for as long as intolerance exists in this world.

Flex: Security Error Accessing URL

While playing around with Flex and Web Services, I encounter the following error while trying to access my web service: Security Error Accessing URL.

One solution around this error is to add a crossdomain.xml file in your root directory:

<?xml version="1.0"?>
<cross-domain-policy>
    <allow-access-from domain="*"/>
</cross-domain-policy>

But in my case I simply changed my web service definition in Flex from:

<mx:WebService id="employeeService"
 wsdl="http://localhost:8080/EmployeeService/services/EmployeeService?wsdl"
 useProxy="false" showBusyCursor="true" fault="mx.controls.Alert.show(event.fault.faultString)">

To:

<mx:WebService id="employeeService"
 wsdl="http://127.0.0.1:8080/EmployeeService/services/EmployeeService?wsdl"
 useProxy="false" showBusyCursor="true" fault="mx.controls.Alert.show(event.fault.faultString)">

That got it working.

Downloading Adobe’s “Flex In A Week” Videos

Adobe, in it’s arguably self-serving pursuit to make Flex more popular offered an online training module called Flex In A Week. Admittedly, it’s quite good. I’ve been using it but watching it online just doesn’t work for me since I don’t have continuous Internet access.

I tried their suggestion for watching the videos online. Unfortunately, it means installing Adobe Media Player (which is yet another sucky media player) and adding the RSS feed http://sessions.adobe.com/FlexInAWeek/feed.xml to My Favorites. Problem is that AMP sucks and it can cache only a few videos at a time.

Fortunately, there is a better solution. Simply go to the RSS feed in Firefox (click the link or copy-and-paste it into the address box) and download the media files from the links on the resulting page. You can now watch it with your favorite media player such as VLC. That’s it!

Web Services with Apache Axis2

Since my new project would require me to use web services, I decided to get my hands at it.

Bottom-Up Approach To Writing Web Services

The logical place to start would be take your plain old Java classes (POJOs, I love them) and expose their methods to to the web. Since you already have the implementation, this is called a bottom-up approach. And with Eclipse Ganymede and Apache Axis2 1.4.1, it was all a breeze. Just create a dynamic web project, create your POJO(s), create Web Service, choose bottom-up. The Axis2 plug-in  then creates a web service complete with WSDL (web service definition language) file and all. Here are the details.

With some groping and googling, I was able to successfully connect my test Adobe Flex application to my web service with no problems.

Top-Down Approach To Writing Web Services

The next step was to do it the other way around, given a WSDL file which describes your web service in great detail, and implement your service. Since you start with just the web service description, it’s called a top-down approach. It was also a breeze. Create a dynamic web project, create a web service, choose top-down, give the location of the WSDL file (I used the WSDL generated earlier), and generate all the necessary classes along with TODO tags where you’re supposed to add your code. Put it in your implementation, compile, deploy, and you’re good to go. Here are the details.

With just a small adjustment in the WSDL URI, I was again able to successfully connect my test Adobe Flex application to my web service with no problems.

All this with no need to mess around with HTTP (it’s just the transport), SOAP (it’s just the protocol), or WSDL (it is generated). Java tooling sure makes web services easy.

Nokia USB Charger

I have no computer, much more a network connection, at the new office I’m deployed to so I’m forced to use my netbook and phone for surfing and downloading. Needless to say, having both WiFi and HSDPA activated is a huge drain on the battery. So I looked around for a USB charger.

The first logical place to go to is of course your friendly neighborhood Nokia service center. They had some but at a staggering P1,200. Next stop, was CD-R King, purveyor of cheap electronica where I endured a somewhat slow queue only to be told that they sell them for P90 but are currently out of stock. I finally found it at Games and Gadget for P220. Not as cheap as CD-R King but it sure beats out-of-stock.

Now I can extend my surfing to as long as my netbook has power and as long as I can stomach the expensive telco charges.