Solved

How to call a webservice with basic authentication

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Woocommerce Webservice 2 65
post4 challenge 28 83
Can I download Google sheets program to my PC? 13 69
recursion example 16 69
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.
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

758 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

22 Experts available now in Live!

Get 1:1 Help Now