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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39541
    
  27
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 - updated with new look and Ping home screen widget
Vijay Chandran
Ranch Hand

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


Thank you very much for your help.


Regards,
Vijay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web service using HttpURLConnection
 
Similar Threads
Servlet design - static methods
Problems connecting to LDAP from Weblogic Server: BAD_CERTIFICATE error!
ASP.net web service + java Client
Calling a web service using https post
Invoking webservice- Server returned HTTP response code: 500