• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call web service from java code

 
bhushan devare
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All
I have to create UI which will work as follows:
1) By giving wsdl file link ,it will show all operations(methods) exposed
2) After selecting any method & giving proper request , it will give me response
I am using wsdl4j. I have completed first one. Can anyone tell me how to call web service method & get response.
I know we have SOAP UI & other tools, but for some requirements I have to create my own.
Please help me. Steps to do that, any document related to that also appriciated.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Section 9.4 of my electronic book (freely downloadable here http://www.slideshare.net/krizsan/scdjws-5-study-notes-3085287) shows an example on how to implement an XML web service and client.
You should be able to adapt this example to suit your needs. Instead of using JAXB to create the request and interpret the response XML data, you will probably want to use the SAAJ API to create requests and process responses. See the Java SE 6 API documentation of the class javax.xml.soap.MessageFactory for details.
There are examples using this API in my book as well.
I would consider using Groovy for, at least, the XML processing part.
Best wishes!
 
bhushan devare
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan, its really helpful for me. It solved my problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!