File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes WSSecurity headers programmatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSSecurity headers programmatically" Watch "WSSecurity headers programmatically" New topic

WSSecurity headers programmatically

Rasheem Rashi

Joined: Jun 16, 2008
Posts: 3

I'm trying to create SOAP Security Header programmatically, like here:

I'm trying to accomplish this with:


Needless to say, I'm not succeeding. I'm using WebSphere 6.0. Would someone please post the code for this. Thanks a bunch already.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The setProperty calls you mention are used for HTTP authentication, not WS-Sec authentication.

I've never tried to use WS-Sec programmatically; obviously, you could create those elements "by hand", and inject them into the message using SAAJ.

There's some (very short) mentioning of how to use WSS4J (the library most commonly used for WS-Sec) programmatically here.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Like what Ulf has said, you should consider of using WSS4J. The documentation isn't very good, but it shouldn't be too difficult to do it.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Rasheem Rashi

Joined: Jun 16, 2008
Posts: 3
Thanks! I'll look into it.
I agree. Here's the link:
subject: WSSecurity headers programmatically
It's not a secret anymore!