HI can any one help me out to slove this problem. I need to invoke a webservice i have a wsdl file Stockquotes.wsdl file based on this i have constructed an input SOAP msg like this <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/"> <soapenv:Header/> <soapenv:Body> <web:GetQuote> <!--Optional:--> <web:symbol>GOOG</web:symbol> </web:GetQuote> </soapenv:Body> </soapenv:Envelope>
from java i will construct a String with this SOAP.
now my Doubt is how to send this SOAP msg to hit that wsdl and to get responce. please address me how to create a stand alone java class with this soap msg to get the responce.
If you have a complete template for the SOAP message there is no need to build a SOAP client. See the HttpURLConnection in java.net package for how to POST a message to the service.
I did this for a client who didn't want to get all tangled up in SOAP toolkits. It can be very simple if the SOAP response is not too complex and is MUCH faster than building a SOAP request from scratch. SOAP is just about messaging - no need to get more complex than you have to.
Joined: Nov 15, 2007
HI here is the class I writen,i am able to get the connection and constructed SOAP msg too this is publically available webservice can you please tell how to proceed further..it will great help.
Author and all-around good cowpoke
Joined: Mar 22, 2000
You need to do a bit more with the HttpURLConnection. Here is the complete method I used.
It is important to note that if the URL starts "http://" you get a HttpURLConnection - an extension of URLConnection with methods specific to HTTp. Bill [ July 01, 2008: Message edited by: William Brogden ]