I have an API which I want to use to fetch data. For fetching data I have to send a request in XML format and response will be sent in XML. Does anyone have any example how to send a request using Java and how to decode the response in java.
Share
Well i have just what you wanted… but i would ask you to use the following APIs …
JAXPandJAXBCastor– The below code snippet method accepts the
urlof the web-server and thexmlQuery– I have used the
NameValuePairto send the XML request– Please replace the
MySSLSocketFactory.getNewHttpClient();with anHttpClient, i have used this it needs a custom certificate to access this site.`Here is the code from my Project, that sends an XML req and gets back an XML resp :