hchandran krishnan

Greenhorn
+ Follow
since Sep 06, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by hchandran krishnan

Hi all,

I am using axis client for accessing webservice. I need to add authentication information in SOAP header.

using wsdl2Java i have generated the stub, skelaton stuff....

From the testClient i am trying the following codes.. But i am not able to view the SOAP Header in the SOAP request..

Way 1.)
******
TpsLocator locator = new TpsLocator();
org.apache.axis.client.Stub s=(org.apache.axis.client.Stub) locator.gettpsSoapDocPort();
s.setHeader("http://my.name.space/headers", "mysecurityheader", "This guy is OK");


Way 2.)
*******
s._setProperty( javax.xml.rpc.Call.USERNAME_PROPERTY, "TPS" );
s._setProperty( javax.xml.rpc.Call.PASSWORD_PROPERTY, "TPSPASS" );

way 3.)
*******

s.setUsername("TPS");
s.setPassword("TPSPASS");


Way 4.)
*******
SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new PrefixedQName("http://schemas.xmlsoap.org/ws/2002/07/secext", "Security","wsse"));
MessageElement usernameToken = new MessageElement("","wsse:UsernameToken");
MessageElement username = new MessageElement("", "wsse:Username");
MessageElement password = new MessageElement("", "wsse assword");

username.setObjectValue("johnsmith");
usernameToken.addChild(username);
password.setObjectValue("johns_passwd");
password.addAttribute("","Type", "wsse asswordText");
usernameToken.addChild(password);
wsseSecurity.addChild(usernameToken);
s.setHeader(wsseSecurity);



Is there any other way to add header ?

Requesting your help..

Regards
Harikrishnan
18 years ago