Posted by kohsuke on October 31, 2008 at 2:32 PM PDT
Amazon EC2 has a SOAP web service, and I wanted to talk to EC2 from Hudson, so I decided to use Metro for this. The end result is the JAX-WS commons EC2 module, which is a library you can put in your classpath with Metro 1.4 when you need to talk to EC2.
EC2 SOAP API is pretty straight-forward except one caveat — you need to sign the whole request, but their WSDL doesn't say so in a machine readable way (that is, by using WS-Policy.) Had they put a proper policy declaration, tools like Metro would be able to hide the whole thing behind the scene, but because they didn't, I had to manually configure Metro a bit to get this working. Basically, this amounts to manually putting the corresponding policy element in WSDL (which is not a very pleasant experience, I have to say, unless you use NetBeans to have it generated for you.)
I also added JAXB fluent API plugin when compiling WSDL, so that the calling application has an easier type building a tree of JAXB objects when sending a request. I think this is very useful with almost any JAX-WS compilation, so here's the POM snippet you can copy into your POM to do this in any other JAX-WS compilation:
... org.codehaus.mojo jaxws-maven-plugin wsimport
true ... 2.1 ec2.wsdl
com.sun.xml.ws jaxws-tools 2.1.3
net.java.dev.jaxb2-commons jaxb-fluent-api 2.1.8
java.net http://download.java.net/maven/1 legacy
In any case, all these work is done by me and the generated interfaces and JAXB beans are packaged up in a jar file, so you just need to depend on this from your Maven POM or download the jar and put it in your classpath to use this.