Solved

How to call a webservice with basic authentication

Posted on 2009-07-16
6
255 Views
Last Modified: 2014-10-18
My client app is calling a webservice which has basic authentication. How should i approach using java. I used wsdl2java to generate the stubs etc. But when i am actually calling the methos in the service, i am getting 401 unauthOrised..
0
Comment
Question by:Subhachandu
  • 2
6 Comments
 
LVL 14

Expert Comment

by:flob9
ID: 24868697
0
 

Author Comment

by:Subhachandu
ID: 24869668
I used RAD6 tool to generate the client stubs. In that case, how should i be able to programmitcally pass the username/pwd for basic authentication.  Any help
0
 

Author Comment

by:Subhachandu
ID: 24869691
I want to pass username/pwd prammatically with out enabling the global security on the admin console
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 total points
ID: 24871078
Yes its easy RAD 6 also uses axis for creating the stubs, hence you can follow this link, I am assuming you are taking about HTTP Basic authentication and not username token.
http://www.nsftools.com/stubby/ApacheAxisClientTips.htm

all you need to do is ass these lines before invoking the operation.

// to use Basic HTTP Authentication:
((Stub) service)._setProperty(Call.USERNAME_PROPERTY, "user name");
((Stub) service)._setProperty(Call.PASSWORD_PROPERTY, "password");


if you were looking for username token you can still follow my tutorial here as axis was implementaion of Jax-RPC

http://soa2world.blogspot.com/2009/05/direct-web-service-client-using-java.html
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question