Friday Dec 20, 2013

StrikeIron RESTful Web Services Are Cool!

You have some kind of order entry form in your application where you enter customer details. Name, address, e-mail, etc. Wouldn't it be handy to know whether those details are valid? For example, the e-mail address you've been given could be wrong or the employee keying it in makes typos. Or the e-mail address was once right but has now been removed.

Enter StrikeIron! StrikeIron lets you instantly validate all customer contact information. Below you see a simple example. I have a text field where I entered my own e-mail address and via a StrikeIron service I get back a bunch of XML. The complete UI for this would show GUI components, probably checkboxes, with values filled in from the parsed XML, but for the moment I'm simply showing the XML payload in an editor pane:

In the context of NetBeans IDE, this doesn't make much sense since you're not going to be validating e-mail addresses while coding, most of the time. But imagine you have a business application on the NetBeans Platform, or a web application or any other business application on whatever framework, where customer details need to be entered. That's when the StrikeIron services become very interesting. 

How does it work? Well, aside from the StrikeIron SOAP services that are part of NetBeans IDE, and that have been there for several years already as this 2009 blog entry by StrikeIron CTO and co-founder Bob Brauer shows, there are also REST endpoints that you can use:

  • The VerifyEmail operation is called to perform email verification and hygiene on an email address. The URL for that operation with specific parameters is as follows:
    VerifyEmail.Option alSourceId=

    More details here (PDF)

  • The NorthAmericanAddressVerification operation is called to perform address verification on an address. The URL for that operation with specific parameters is as follows:
    NorthAmericanAddre ssVerificationService/NorthAmericanAddressVerification?
    LicenseInfo.Registered User.UserID=&
    NorthAmeric anAddressVerification.AddressLine1=&
    NorthAmericanAddressVerification. AddressLine2=&
    NorthAmericanAddressVerification.CityStateOrProvinceZIP OrPostalCode=&
    North AmericanAddressVerification.Firm=&
    NorthAmericanAddressVerification.Ur banization=&

    More details here (PDF)

There's other services too, such as an SMS service, which is pretty cool. 

Finally, how did I integrate the REST service into a NetBeans Platform TopComponent? Using HttpClient, exactly as I did recently with the TestFairy REST service, as documented here. I literally copied all the code from there and then just changed the URL and the variables.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« December 2013 »