String testUrl = " https://******";
// String reqXml = XmlJaxbUtil.marshal(jc, masMessage);
String reqXml = "<?xml ****MasMessage>";
PostMethod postMethod = new PostMethod(testUrl);
System.out.println(reqXml);
StringRequestEntity isre = new StringRequestEntity(reqXml);
postMethod.setRequestEntity(isre);
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(new AuthScope("192.168.88.88", 8443),
new UsernamePasswordCredentials("2009000000***", "123456"));
Protocol authhttps = new Protocol("https",
(ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(
new URL("file:E: \\cnphttpinterface\\*****"), "123456",
new URL("file:E: \\cnphttpinterface\\****"), "***"), ***);
Protocol.registerProtocol("https", authhttps);
client.getParams().setSoTimeout(60 * 1000);
postMethod.setDoAuthentication(true);
int status = client.executeMethod(postMethod);
System.out.println(status);
String respXml = null;
if (status == 200){
respXml = new String(postMethod.getResponseBody(), "UTF8");
}
System.out.println(respXml);
}
}