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.
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.