Post XML over HTTPS
We are trying to do the following. Can anyone help by providing any pointers as how to do it.
1. A java client will be posting XML over http(s) to the Tomcat server.
2. The Tomcat server has to do the following:
- Validate the user credentails and verify that it is an valid user on IDM
- Do some DB operations and return back a response XML
We are trying to do this by having the Java client post XML over http to a jsp hosted on the Tomcat server
How do i retrieve the XML data from the HTTP post (from the HTTP body) ?
Thanks
[577 byte] By [
simusera] at [2007-11-27 5:53:40]

# 1
try the below example to read data over https,
import java.net.*;
import java.io.*;
import javax.net.ssl.*;
public class SSLSocketClient {
public static void main(String[] args) throws Exception {
String url="https://secure.com";
try {
SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket(url, 443);
socket.startHandshake();
/* read response */
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
socket.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}