Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web service using HttpURLConnection

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

I am connecting to a java web service from a java client program. Both developed by me for learning purpose. I created the WSDL from the java web service class and i generated the ServiceLocator and stub classes using Eclipse lomboz tool. Now i am trying to connect to the web service using HttpUrlConnection. I developed the following code for that:



My problem is, if i used the generated stub and service locator classes generated from the WSDL i can directly call the web service method from the java client. But if i use this HttpURLConnection API for web service access how can i call the web service method i need?

Please provide your help and suggestions for this problem.

Thanks & Regards,
Vijay

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd need to send and receive SOAP messages. While SOAP is not a complicated protocol, assembling a request correctly (and later parsing the response) isn't trivial, either. I wouldn't advise to code that yourself.

If you want something that works on a lower level than using the generated code, you might look into writing a SAAJ client.
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ulf,


Thank you very much for your help.


Regards,
Vijay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic