I’ve been recently trying to set up WS-Security on a web-service implementation I’m working on. To that end, I’ve been trying to find out how to actually implement it. I won’t say that the standard has failed me (yet), or that the internet has failed me. I’ve actually found much useful information . . . and maybe I’m almost there.
But . . . there are roadblocks along the way. There are surprisingly few actually useful resources available on these topics, despite the fact that WS-Security is supposed to be the standard way of securing SOAP web services. No wonder everyone just adds a username and password to the WSDL data and leaves it at that. Start with the WS-Security standards themselves. They say things like (and I quote):
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, ”RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
To which I have to say . . . really?!!! Do I really need to read RFC 2119 to know what those words mean? And if that’s the case (because you don’t use the words in a way a normal person can just understand), how do you expect anyone to actually use your standard?
Then there’s the tutorials (of which there are precious few). To start with, Oracle has manged to make the java.net sites basically unavailable. (Which is why there’s no quote for this assertion.) But when you can access them, you find tutorials for using the standard Java JAX-WS framework to do WS-Security that say:
- You can’t, so replace the entire JVM’s JAX-WS implementation with the Metro one, for which it’s impossible to find the right JAR’s.
- Once you do that, we can’t explain how to configure it, or what the schema is for the configuration language, or how it works.
- Instead, use Netbeans to generate the boring, complex XML documents for you.
- And, by the way, if you do, your application will only work in Glassfish, so good luck if you’re using a different application server.
So I’m stuck reading tutorials written by Glen Mazza, mostly around Apache CXF. Amazingly, after my experiences so far, these are actually useful. But . . . they’re only so useful. I’m staring here, and my experience has been frustrating in various ways.
First, that tutorial actually says to look at two other tutorials he’s written, both of which reference other tutorials, and replace Step X sub-step Y with XYZ, etc. A more frustrating experience of cut-and-paste I haven’t had in a while. And when I’m done, things don’t quite work, either because of software version changes between the tutorial post’s writing and now, or environment changes, or because the author got somewhat confused in his writing, as I’ve been in reading.
Be that as it may, I think I’ve finally succeeded in making it work, so I have to hand it to Glen Mazza, since he’s the only one that presented something I could find that was actually useful.