aspose file tools*
The moose likes Web Services and the fly likes HttpClient and Webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "HttpClient and Webservice" Watch "HttpClient and Webservice" New topic
Author

HttpClient and Webservice

Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
Hi ,

Hi all,

i am trying to acheive SSO where in a user logs into 1 application and when he clicks a link to other application he should be logged in automatically, without second authentication. I have been asked to use via HttpClient ?

however I have been having the following questions in my mind.. i have tried googling but not able to join all the dots...

1. difference betwwen axis and httpclient
2. An example where in httpclient can be used to access the webservice for authentication

how do i communicate between these 2 applications..

any help will be appreciated.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
HttpClient is something completely different than Axis. If you read their respective home pages you'll understand why. Why don't you use a proper SSO solution? The http://faq.javaranch.com/java/SecurityFaq lists several open source Java SSO libraries.


Ping & DNS - updated with new look and Ping home screen widget
Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
Hi Dittmer,

thanks for the reply. I had gone through axis and have worked on that... however what i am not able to visuallise it is using httpclient and web service how are you going to provide SSO ?

COuld you please help me with tht !

thanks !
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
There's no connection between Axis and HttpClient; what makes you think there is (unless you were thinking of using HttpClient as a WS client for Axis, but it doesn't sound as if you are) ?

SSO is provided by using an SSO library, not through Axis or HttpClient.
Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
thanks dittmer,

If i could put it in other way, can httpclient be used to invoke a webservice ?
and what is the need for having an httpclient, i could direclty call a webservice .. am i correct ?

thanks !
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
can httpclient be used to invoke a webservice ?

Yes.
what is the need for having an httpclient, i could direclty call a webservice .. am i correct ?


If by "direct" you mean from within some Java client code, then you're correct. Most (probably all) SOAP stacks have a tool that can generate Java client code to access a WS; generally it works by looking at the WSDL of the target WS. That generated client code would be much easier to work with than to use HttpClient. (The tool that ships with Axis is called "wsdl2java".)
Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
Thanks Dittmer,

so httpclient is another way by invoking a webservice.. I was not aware of that.. thanks for clarifying...

Do you have any idea how we could use httpclient to invoke a webservice.. ie if I have to use httpclient - how my request is going to be converted to xml.. and how abt the destination ?

Is this correct ---
1. Make an httpclient request.
2. In the request I would be have a destination url
3. This request is in the xml format ( for soap to undustand)
4. At the server I read the request and process it ..

If you could please light up your thoughts on this.. it would be of great help.. truely speaking i need to have a bigger picture in mind how I would be going about using httpclient to request a webservice for authentication..

I hope you undustand my problem.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
I think you profoundly misunderstand what HttpClient is and does. It's a library for making HTTP requests programmatically; it has no WS capabilities. If you want to use it for making WS requests (why?), then you have to create all the SOAP involved in your own code - not a trivial undertaking.

Maybe it's time to take a step back and ask WHY you want to use HttpClient. You keep talking about authentication and SSO, but you have not said why you wish to avoid implementing a proper SSO solution.

The initial question also mentions "applications", not "web services" - what's the connection between the two?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: HttpClient and Webservice
 
Similar Threads
Looking for advices
Authenticate and authorise access to webservices
Web Page query
Invoking HTTPS webservice
Dilemma