Apache CXF and Glassfish Metro for consuming web services

September 6, 2007

For a project I need to call some web services for which there is a WSDL schema. I have briefly looked at some contenders and only took consuming of web services into account and not the producing of web services,

I decided to go the JAX-WS route, since this appears to become a standard: JSR 224. Java 6 will have it as a feature.

The JAX-WS choice does mean that Axis2 cannot be used. I don’t really mind since I’ve experienced some real pain there in previous projects. I’m not the only one. Hani sums it up nicely.

JAX-WS contenders

A bit of googling looked like the contenders are:

  • JBossWS
  • CXF
  • Metro

Because it seemed I was the first one using the here unnamed web services, I first decided to play with Amazon web services, because documentation and examples for Amazon web services are widely available.
This excellent article explains how to use AWS ECS with Metro and with CXF. I did not go for the ANT route and used wsdl2java and wsimport.sh. to generate the Java code.

JBossWS

JBossWS seems a bit tied to JBoss 5 and because I need to work with JBoss 4.0.5, I ignored that option.

Since I will consume a webservice, I feel that JBossWS could still be viable. However the pain I had converting the CXF Geronimo stuff to JBoss stuff (more on that later), confirmed my suspicion that JBossWS would not be an easy route in my environment. This is not to say that when using JBoss 5, you cannot have total bliss with JBossWS.

CXF

CXF is still an Apache incubator project. It is a merge of XFire and Celtix. The wsdl2java script did run without problems. When you want to use the generated code you need the following jars, according to the documentation:

  • cxf.jar
  • commons-logging.jar
  • geronimo-activation.jar (Or the Sun equivalent)
  • geronimo-annotation.jar (Or the Sun equivalent)
  • geronimo-javamail.jar (Or the Sun equivalent)
  • neethi.jar
  • jaxb-api.jarv
  • jaxb-impl.jar
  • stax-api.jar
  • XmlSchema.jar
  • wstx-asl.jar
  • xml-resolver.jar
  • jaxws-api.jar
  • saaj-api.jar
  • saaj-impl.jar

I could call ECS without any problems, however the Geronimo jars were a thorn in my eye, I tried to replace them with a JBoss equivalent. I entered a world of pain. With jboss.org.lang.Annotation problems (update JBossWS) and then javax.annotation.PostConstruct problems.
So I concluded that it was not possible to remove the Geronimo jars. Upgrading to the latest JBossWS implementation got me dependent on JBoss 5 it seemed, which is no option.
So if you can live with Geronimo jars and 15 jars in total, give or take a few (removing 1 or 2 seems not to break anything) then you are good to go.

Although I ran into the same observation as Glen Mazza. jaxws:enableWrapperStyle not working in CXF

Metro

I downloaded the standalone version instead of a complete Glassfish distribution.
I had to alter the wsimport.sh script, because WSImport needs JAF. I added the activation.jar from the JBoss distribution to the classpath in the wsimport.sh script. The generated code enabled me to call ECS without any problems.
I needed the following jars:

  • webservices-extra.jar
  • webservices-rt.jar
  • webservcies-api.jar

Compared to CXF, Metro just seems more environment friendly. Of course this could be complete rubbish, since those three jars can be completely bloated with everything but the kitchen sink.

For now I will use Metro and see how this will go.


Amazon Flexible Payment Service

August 3, 2007

I just got a mail from Amazon saying:

This is a brief note to a select group of AWS customers to let you know that we are beginning a limited beta of Amazon Flexible Payments Service (Amazon FPS).

Amazon is at it again!
So naturally I tried to sign up…
US-based credit card only… Bummer.

Just like the Amazon Visa card they keep pushing in my face which is US only.
Rewards Card 77. V47075815

Or the electronics merchandising rules which do not apply to us Europeans.

They need to tweak their merchandising rules…


Amazon S3 reports

August 1, 2007

I just got the latest Billing Statement of my Amazon Webservices Account (AWS) for the storage service S3.

Unlike the previous statements which were like $1.50 this one was $7.87 (with taxes). A 5 fold increase! So naturally I looked at a more detailed Billing statement. It seems that I downloaded 24Gb from S3.
AWS Billling Statement

I eventually found out what caused this, so no foul play or something. I toyed a bit with the handy S3Browse, when I ran a couple of times in the maximum AWS transfer size (5 GB). I was trying to download photos stored with the excellent JungleDisk.

The billing statement does not give any real insight into where your data is going to, but fortunately you can download a usage report.

AWS usage report

The AWS usage report can be a xml file containing a bunch of OperationUsage tags.

I have a hard time understanding what it means. If anybody can give me some documentation about that I would be grateful. I can not find it here Webservices Developer Connection. The format is:

    1    <OperationUsage>
    2         <ServiceName></ServiceName>
    3         <OperationName></OperationName>
    4         <UsageType></UsageType>
    5         <Resource></Resource>
    6         <StartTime></StartTime>
    7         <EndTime></EndTime>
    8         <UsageValue></UsageValue>
    9     </OperationUsage>

ServiceName

In my case this is always AmazonS3. So this seems the Amazon service. if you use Electric Compute Cloud it will be AmazonEC2??

OperationName

Does not seem to important. My log contains:

  • ListBucket
  • StandardStorage
  • ListAllMyBuckets
  • HeadObject
  • PutObject
  • GetObject
  • UnknownAction

With the exception of HeadObject, UnknownAction I have some idea of what this means.

Usage type

The best I could find was Usage tracking
However that document states that the following usage types are possible:

  • TimedStorage-ByteHrs
  • AverageStorage-Bytes
  • Network-Bytes
  • Request

However my report contains also DataTransfer-In-Bytes or DataTransfer-Out-Bytes is this the Network-Bytes renamed??? Request is now a Requests-Tier1 or Requests-Tier2. No idea what this means.

Resource

The once listed in my case are the buckets. Is this always the case?

Usage Value

What’s this? I assumed it was the number of bytes. However:

    1    <OperationUsage>
    2         <ServiceName>AmazonS3</ServiceName>
    3         <OperationName>StandardStorage</OperationName>
    4         <UsageType>TimedStorage-ByteHrs</UsageType>
    5         <Resource>476de2a71aa5a476f84d48e4d61c980-default</Resource>
    6         <StartTime>07/04/07 00:00:00</StartTime>
    7         <EndTime>07/05/07 00:00:00</EndTime>
    8         <UsageValue>228990865824</UsageValue>
    9     </OperationUsage>

Noticing line 8 it states 228990865824 bytes(?). How this relates to the about 9.1 GB in that bucket is beyond me.

Final remarks

I understand that S3 is for developers and not for end users like me. However if you are giving reports, some documentation would have been nice. It seems that developer information is missing as well. Perhaps my search capabilities (I looked in the AWS forums) was lacking. If there is some information about the OperationUsage I would like to know.