Posts tagged as:

aws

Daily del.icio.us for April 20th through April 22nd

by Vinny Carpenter on April 22, 2008

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

{ 0 comments }

Daily del.icio.us for April 17th through April 19th

by Vinny Carpenter on April 19, 2008

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

{ 0 comments }

Daily del.icio.us for April 14th through April 16th

by Vinny Carpenter on April 17, 2008

Daily del.icio.us for April 6th through April 12th

by Vinny Carpenter on April 12, 2008

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

{ 0 comments }

Daily del.icio.us for January 27th through January 28th

by Vinny Carpenter on January 28, 2008

  • Peter Ent: DataCalendar - The DataCalendar is a combination of DateChooser and DataGrid. Like the DateChooser, the DataCalendar displays a standard calendar with controls to navigate to another month and year. And like the DataGrid, the cells of the DataCalendar display data.
  • Khomsan Ph. - VisualWget - Home - VisualWget is a download manager that use Wget as a core retriever to retrieve files from the web. You can think of VisualWget as a GUI front-end for Wget that give you all of Wget functionalities plus little management features such as download queue
  • Wall $treet Week with FORTUNE . In the News | PBS - America's growing trade deficit is selling the nation out from under us. Here's a way to fix the problem — and we need to do it now. By Warren E. Buffett,
  • Ext JS Blog - » Ext continues expansion, Now offers training and consulting services - Ext has been quietly offering services for some time now, basically working towards getting certain pieces in place before formalizing the Ext Professional Services division
  • Ext JS Blog - » Ext continues expansion, Now offers training and consulting services - Ext has been quietly offering services for some time now, basically working towards getting certain pieces in place before formalizing the Ext Professional Services division
  • CSS Reference - Welcome to the SitePoint CSS Reference! We?ve worked hard to make this the most detailed and up-to-date reference on the subject available. To get started, try our handy search box, or click on one of the headings to browse that section of the reference
  • InfoQ: Amazon EC2 Gains Favor with JEE and Groovy Developers - Using the EC2 API is straightforward, but to make life even simpler Chris Richardson has posted a Groovy framework that can launch MySQL, Apache HTTP Server, a set of Tomcat instances and JMeter, as well as deploying web applications to Amazon's EC2.
  • Seth's Blog: Nickel and diming - Offering low marginal cost items for free is a shortcut to generating word of mouth, which is a lot cheaper than buying ads.
  • Mastering Grails: Build your first Grails application - In the first installment of his new monthly series Mastering Grails, Java expert Scott Davis introduces Grails and demonstrates how to build your first Grails application.
  • The busy Java developer's guide to Scala: Functional programming for the object oriented - In this new series, Ted Neward introduces Scala, a programming language that combines functional and object-oriented techniques for the JVM. Along the way, Ted makes the case for why you should take the time to learn Scala ? concurrency, for one ? and
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

Daily del.icio.us for January 6th

by Vinny Carpenter on January 7, 2008

  • Official Google Docs Blog: New features for 2008! - It's been two months since we launched Google Presentations and already we've got new toys! We've been listening to your feedback and working hard to get you new features as quickly as possible
  • Amazon Web Services Blog: Increasing Amazon S3 Data Transfer Performance - The Amazon S3 team is now beta-testing support for an important low-level networking feature which has the potential to significantly increase the performance of large data transfers to and from S3, particularly (but not limited to) for long distance data
  • Blueprint Grid CSS Generator - This tool will help you generate more flexible versions of Blueprint's grid.css and compressed.css and grid.png files. Whether you prefer 8, 10,16 or 24 columns in your design, this generator now enables you that flexibility with Blueprint.
  • The Most Hated Company In the PC Industry - Asustek is the most hated company in the industry. Microsoft, Apple, Dell and Palm hate Asustek because the company can give us something they can't: A super cheap, flexible, powerful mobile computer. At $299, why would anyone not buy one?
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

Daily del.icio.us for Dec 23, 2007

by Vinny Carpenter on December 23, 2007

  • BitNami :: BitNami Stacks - BitNami stacks make it incredibly easy to install your favorite open source software. Application stacks include an open source application and all the dependencies necessary to run it, such as Apache, MySQL and PHP or Ruby. All you need to do is download
  • Sriram Krishnan: Amazon SimpleDB - Technical Overview - Structured storage was one of the missing pieces in Amazon's cloud services jigsaw puzzle (the other has to be the ability to host a site completely on EC2 without using dynamic DNS hacks) and Amazon is plugging that hole today with the launch of SimpleDB
  • Remember The Milk - Services / Remember The Milk for Gmail - Remember The Milk for Gmail is a Firefox extension that allows you to manage your tasks in Gmail (complete, postpone, and edit tasks), add new tasks (and connect them with your emails, contacts, and Google Calendar events), automatically add tasks for sta
  • Eventually Consistent - All Things Distributed - Recently there has been a lot of discussion about the concept of eventual consistency in the context of data replication. In this positing I would like to try to collect some of the principles and abstractions related to large scale data replication and t
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

Daily del.icio.us for Jun 27, 2007 through Jul 06, 2007

by Vinny Carpenter on July 6, 2007

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Related posts

Daily del.icio.us for Mar 28, 2007 through Mar 29, 2007

by Vinny Carpenter on March 29, 2007

Tags: , , , , , , , , , , , , , , , , ,

Related posts

Life is beautiful with XMLBeans and XStream

by Vinny Carpenter on January 30, 2006

XML creation, parsing and processing with Java has gotten so much easier with tools like XMLBeans, XStream and many other such tools. I personally love XMLBeans and XStream and I try to use them for all of my XML processing needs. While they both consume XML, they solve different problems. XMLBeans allows you to process XML by binding it to Java types using XML schema that has been compiled to generate Java types that represent schema types. XStream on the other hand allows you to serialize objects to XML and back again using special reflective secret sauce.

I've been using these tools for many years now and so you tend to forget just how useful and powerful they are and how productive they make you. Case in point – A friend of mine came to me for help. He was building an application that would allow him to resale items from Amazon on his site and he wanted to use the Amazon eCommerce Web Services to search for products programmatically and update a local database that housed his content. Having played with Amazon E-Commerce Service (ECS) before, I offered to write up a simple application that would make the Web Services call, process the results and present them back to you.

Amazon's ECS is an API that allows you to access Amazon data and functionality through a Web site or Web-enabled application. ECS follows the standard Web services model: users of the service request data through XML over HTTP (REST) or SOAP and data is returned by the service as an XML-formatted stream of text. In addition to the WSDL, ECS also provides XML schemas for validating the XML output of REST requests. So I decide to use XMLBeans to create my type system using the XML Schema provided by Amazon. XMLBeans provides you with a utility (scomp) to compile your schema into Java XMLBeans classes and metadata. To generate the Java code, use the following command:

scomp –jar amznws.jar AWSECommerceService.xsd

This generates a jar file named amznws.jar, which will contain all of the code needed to bind an XML instance to the Java types representing your schema. In my application, I use HttpClient to make my REST request and then use the XMLBeans generated jar file to process the result. Here's a snippet of code from my sample class:

[code lang="java"]

if (StringUtils.isNotBlank(searchCriteria)) {
String url = "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&" +
"AWSAccessKeyId=*YOUR_KEY*&AssociateTag=*YOUR_TAG*&Operation=ItemSearch&SearchIndex=Books&" +
"Keywords=" + searchCriteria + "&ResponseGroup=Large,Images";

GetMethod method = new GetMethod(url);
List results = new ArrayList();

try {
int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
log.error("Method failed: " + method.getStatusLine());
}

// Read the response body.
InputStream in = method.getResponseBodyAsStream();
String xmlPayload = parseISToString(in);

// Set up the validation error listener.
ArrayList validationErrors = new ArrayList();
XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(validationErrors);

ItemSearchResponseDocument items = ItemSearchResponseDocument.Factory.parse(xmlPayload);

if (items != null) {

ItemsDocument.Items[] itemsArray = items.getItemSearchResponse().getItemsArray();
for (int i = 0; i < itemsArray.length; i++) {
AmazonWSObject amzn = processResults(itemsArray, i);
results.add(i, amzn);
}

// During validation, errors are added to the ArrayList
boolean isValid = items.validate(validationOptions);

// Print the errors if the XML is invalid.
if (!isValid) {
for (Object validationError : validationErrors) {
log.error(">> " + validationError + "\n");
}
}
} else {
log.error("Search returned no results");
}
} catch (HttpException e) {
log.error("Fatal protocol violation: " + e.getMessage());
} catch (IOException e) {
log.error("Fatal transport error: " + e.getMessage());
log.error(e.toString());
} catch (XmlException e) {
log.error(e.toString());
} finally {
method.releaseConnection();
}

return results;
} else {
return null;
}

[/code]

As you can tell, HttpClient makes the REST call a snap and XMLBeans makes processing the results easy as well. In total, I spent 3-4 hours getting the application working and a lot of the time was spent figuring out the data set returned from Amazon and trying to come up with a meaningful example. Here is a zip file with the IDEA project that has all the stuff needed to make this work including a simple JSP and a JUnit test class.

Links of Interest:

Tags: , , , , , , , , , , , ,

Related posts

ladies running on a picturesque beach