File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Connect to UPS HTTPS/ssl server for Rates Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Connect to UPS HTTPS/ssl server for Rates Web Service" Watch "Connect to UPS HTTPS/ssl server for Rates Web Service" New topic

Connect to UPS HTTPS/ssl server for Rates Web Service

srinivas sosale

Joined: Dec 10, 2009
Posts: 1
Java Gurus:
I'm trying to connect to UPS's https server in order to obtain the rates information. They need the file in xml format, so i have it ready, now the problem is connecting to their https server. It keeps throwing " Unrecognized SSL message, plaintext connection?"
I'm fighting this issue for more than a week. I have attached code snippet of the connection string information,(BTW) this info was supplied to by UPS, but they do not want to assist unless we are ready for production. Go figure....Any help would be appreciated.
try {
fName = fPath + ".xml";
XMLWriter writer = new XMLWriter(new FileWriter(fName));
writer.write(accessRequest().toString() + rateRequest().toString());
//HTTPS Connection
System.setProperty( "", "SSL");// found on the internet for additional notes on error
System.setProperty("java.protocol.handler.pkgs", "");//found this on javaworld for ssl connections
Security.addProvider(new;//found this on javaworld for ssl connections
URL url = new URL("");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//SSLException thrown here if server certificate is invalid
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.println(accessRequest().toString() + rateRequest().toString());
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//HTTPS Connection

} catch (Exception ex) {
System.out.println("exception " + ex);

Thanks, Srini
I agree. Here's the link:
subject: Connect to UPS HTTPS/ssl server for Rates Web Service
Similar Threads
HttpURLConnection.connect() takes long time (3 minutes)
UPS XML Tracking problem
Problems connecting to LDAP from Weblogic Server: BAD_CERTIFICATE error!
X509CertificateImpl CastException in JSP