This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Services and the fly likes WSSecurity headers programmatically Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "WSSecurity headers programmatically" Watch "WSSecurity headers programmatically" New topic
Author

WSSecurity headers programmatically

Rasheem Rashi
Greenhorn

Joined: Jun 16, 2008
Posts: 3
Hello,

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



I'm trying to accomplish this with:

stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,"wasadmin");
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,"wasadmin");

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.

RR
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35247
    
    7
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.


Android appsImageJ pluginsJava web charts
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.
http://ws.apache.org/wss4j/


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

Joined: Jun 16, 2008
Posts: 3
Thanks! I'll look into it.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: WSSecurity headers programmatically
 
Similar Threads
WS-Security Token Passing implementation
Axis2 and mustUnderstand
can't run rampart client
digest authentication on client side implementation.
Basic authentication soap header values?