public string SendXML (string Sendurl, String senddata) throws Exception {
File Trustedkeystorefile = new file (Ssltruststore);
BufferedReader reader = null;
Closeablehttpresponse resp = null;
String resultuestStr1 = null;
try {
Sslcontext Sslcontext = Sslcontexts.custom (). loadtrustmaterial (NULL, New Trustselfsignedstrategy ())
. loadkeymaterial (Trustedkeystorefile, Ssltruststorepassword.tochararray (),
Ssltruststorepassword.tochararray ())
. build ();
Sslconnectionsocketfactory sslsocketfactory = new Sslconnectionsocketfactory (Sslcontext,
New string[] {"TLSv1.2", "TLSv1.1", "TLSV1"}, NULL, New Noophostnameverifier ());
Closeablehttpclient client = Httpclients.custom (). Setsslsocketfactory (Sslsocketfactory). build ();
HttpPost post = new HttpPost (Sendurl);
httpentity entity = new Stringentity (SendData, "utf-8");
Post.setheader ("Content-type", "Text/xml");
Post.setentity (entity);
RESP = Client.execute (POST);
reader = new BufferedReader (New InputStreamReader (Resp.getentity (). GetContent ()));
StringBuilder datastring = new StringBuilder ();
String Inputline;
while ((Inputline = Reader.readline ()) = null) {
Datastring.append (Inputline). Append ("\ n");
}
RESULTUESTSTR1 = datastring.tostring (). Replace ("<", "<");
} catch (Keymanagementexception E1) {
E1.printstacktrace ();
} catch (Unrecoverablekeyexception E1) {
E1.printstacktrace ();
} catch (NoSuchAlgorithmException E1) {
E1.printstacktrace ();
} catch (Keystoreexception E1) {
E1.printstacktrace ();
} catch (Certificateexception E1) {
E1.printstacktrace ();
} catch (IOException E1) {
E1.printstacktrace ();
}
return RESULTUESTSTR1;
}
HTTPS request with certificate sending message