aspose file tools*
The moose likes Java in General and the fly likes Web service using HttpURLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Web service using HttpURLConnection" Watch "Web service using HttpURLConnection" New topic
Author

Web service using HttpURLConnection

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
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
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
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.


Ping & DNS - my free Android networking tools app
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear Ulf,


Thank you very much for your help.


Regards,
Vijay
 
Don't get me started about those stupid light bulbs.
 
subject: Web service using HttpURLConnection