Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help required! I am new to this area (Java to Web Services)

 
prasanna kanth
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me explain the scenario first, (May be I don�t use the exact terminology, but I hope I can make out what I need)

I have some applications which is running as standalone Swing component
Now for some validation purpose, I have to interact with Web services.
I am nothing to do with web service end, as the service(or wsdl) is already exists in the server, I just need to invoke with some values and should get the response from it.

I hope I explained what I need.

1. How is it possible to talk from standalone java swings component to Web services
2. Is there is any special API will help to do, if yes what is that.
3. Can someone help me to provide some piece of code how to interact?
4. What are the things I should know before I start.

Really appreciate your kind advice, I am desperately waiting for the feedback as its very urgent from my end.

Thanks in advance.
Prasanna T :roll:
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should start by getting a SOAP toolkit like Axis. Those generally come with a tool that creates java classes that can access a WS defined by a WSDL; Axis' tool for doing this is called wsdl2java. There are several ways to use it to generate client code, one is by using XMLBeans. That web page also explains the other ways, although for your purposes it probably doesn't matter which one you use. (You'll need to save the WSDL as a file so that wsdl2java can use it.) The client code that gets generated will have the URL of the WS hardcoded; obviously, you'll have to adapt that to your circumstances.
 
prasanna kanth
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Ulf Dittmer

Now I manage to generate the Stubs, service, ServiceLocator and portType files from the wsdl. But not sure how to implement these with my exiting code.
My code has the required data to be passed, but i didn't get much idea on how to do this

Need advise, on how to use these files...!

Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Quick Start Guide I linked to has an example client that shows how to make use of the generated classes. It will be a bot different in your case, because you will have different method names and parameters, but by and large, you should be able to adapt that client without too many problems.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic