Recently I was forced to integrate with a WS Security enabled endpoint using Secure Conversations.
The project in question was written in Ruby and Javascript, but after spending a couple of days trying to integrate
with the WebService I had to throw in the towel. I spent some time using Savon and Signer
combined with my own implementation of p_sha1, but that is food for a whole nother blog post.

After accepting defeat and deciding to create a client with Metro I looked for some writeups. Most I found were dated, or not a good fit.
There are probably several good posts on this, but I could not seem to find them. So I started from scratch, using the Metro docs

What follows is a step by step for creating an executable jar with bundled metro dependencies that will be able to communicate with a WSIT endpoint.

Step 2

Step 3

Download wsdl and place it in src/main/resources/wsdl and wsimport via jaxws-maven-plugin:
Make note of the extension=true configuration option. Without this some classes may be skipped if
they are found to be non standard. Also note the options to fetch external DTD and schema. In my case
the wsdl has external references, and without these options the client code is a mismatch.

Step 4

At this point we can create the main client class, and setup authentication and endpoint address:
In my case I want to consume stdin, but you could also pass a file as argument or even the payload itself.
Using stdin is a nice way to separate payload from options to the program among other things.

Step 5

Now we can create the executable jar. I want the dependencies to be a part of the jar itself. We could also use
a lib directory outside the jar (as I describe here),
but for this use case I prefer to bundle the dependencies inside the client jar file.

Configure the maven-assembly-plugin to build a single distributable jar: