Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to call a webservice with basic authentication

Posted on 2009-07-16
6
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

704 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