wood burning stoves 2.0*
The moose likes Web Services and the fly likes How do I consume Web Services in Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How do I consume Web Services in Swing" Watch "How do I consume Web Services in Swing" New topic
Author

How do I consume Web Services in Swing

Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
Hi, I've deployed a web service using Eclipse WTP. What libraries should I choose in order to write a Swing Application to consume those web services. I have been trying this for a couple of days and came across a few code samples that use SOAP and Glue. But they don't seem very clear and I suppose they are out date. Could someone give me a rough idea on this.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Hi Ragunath,

Please Use A Meaningful Subject Line. 'Newbie' does not tell what the question is about.
We have updated this one for you.


OCUP UML fundamental and ITIL foundation
youtube channel
Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
@Jan Cumps thank you. I'll be careful next time.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Consuming a web service has nothing to do with the kind of GUI that the consuming application might have. So you could use java.net.URLConnection, or Apache HttpClient, or the client-side libraries of Jersey or Axis2 or Metro - whichever suits your service best.


Ping & DNS - my free Android networking tools app
Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
@Ulf Dittmer

I'm sorry I think I should rephrase the question. How do I construct a SOAP request for a web service using java. I have posted the WSDL generated using WTP.

Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
Say for example, how do I construct a SOAP request for verifyLogin.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
The usual approach would be to have whatever SOAP toolkit you're using to generate code that accesses the service from the WSDL. All major toolkits have tools for that; for example, Axis2 has wsdl2java.

I would advise against generating the SOAP sort of "manually" in your code.
Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
I am using Axis 1. I'd like to do the following using java.

1. Discover all available services at the endpoint using java.
2. Construct request messages for each service with the information obtained form WSDL.

Could you enumerate it as sequences of steps for accomplishing my task.
Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
Yup I found the tool. I've also generated the code using wsdl2java. What next?

Thanks in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Have you worked through the samples that come with Axis, particularly the ones in the user guide? They show all aspects of getting a WS up and running.
Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
Thank you very much. I just got through it. I generated the client rmi stub using Wsdl2java utility and used the service locator to access the services.
 
jQuery in Action, 2nd edition
 
subject: How do I consume Web Services in Swing