Solved

How to call a webservice with basic authentication

Posted on 2009-07-16
6
237 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now