StrikeIron RESTful Web Services Are Cool!
By Geertjan-Oracle on Dec 20, 2013
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:
- The NorthAmericanAddressVerification operation is called to perform address verification on an address. The URL for that operation with specific parameters is as follows:
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.