Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes https problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "https problem" Watch "https problem" New topic
Author

https problem

Faxin Zhao
Greenhorn

Joined: Jul 18, 2003
Posts: 16
Hi,
I want to get the XML output from a URL and transfer to a HTML page.
When I tyied my http web app, is OK.
But, when I tried my https web app, no rusult, only the message showed in the log file:
###########################
Error occurs here:
https://myTestSvr/myApp/servlet/myDocList?myAccountNo=321456&myTeamNo=2&myAccessCode=A
Any ideas?
Thanks in advance.

Here are some lines from my servlet:
//********** Step 1: set property ***********************//
try
{
// set the default security protocol (shipped with JSSE1.0.2)
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
// add the default security provider (again, in JSSE1.0.2)
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
}
catch (Exception e)
{
return;
}
//********** Step 3: do transform ***********************//
try
{
TransformerFactory tFactory = TransformerFactory.newInstance();

String url = "https://myTestSvr/myApp/servlet/myDocList?" +
"myAccountNo=" + myAccountNo +
"&myTeamNo=" + myTeamNo +
"&myAccessCode=" + myAccessCode ;
Source xmlSource = new StreamSource(new URL(url).openStream());
Source xslSource = new StreamSource (new FileInputStream ("D:\\myDoc.xsl"));
Transformer transformer = tFactory.newTransformer(xslSource);
transformer.transform(xmlSource, new StreamResult(out));
}
catch (Exception e)
{
System.out.println("###########################");
System.out.println("Error occurs here:");
System.out.println(e.getMessage());
return;
}
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
You have 4 possible locations for throwing an exception, do you know where it is happening? Perhaps a couple of debug print statements could narrow this down.
So something like:
That will help determine the actual cause of the error.
Faxin Zhao
Greenhorn

Joined: Jul 18, 2003
Posts: 16
Hi Jason,
Thanks for your reply.
I knew the problem was caught by this line:
Source xmlSource = new StreamSource(new URL(url).openStream());
That means I couldn't get the input stream from url.openStream
And I got more error messages as following:
java.io.FileNotFoundException: https://myTestSvr/myApp/servlet/myDocList?myAccountNo=321456&myTeamNo=2&myAccessCode=A
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at myDocList.doPost(myDocList.java:143)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:749)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:842)
at com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java)
at com.gefionsoftware.server.NamedDispatcherImpl.forward(NamedDispatcherImpl.java)
at com.gefionsoftware.server.servlets.InvokerServlet.service(InvokerServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:842)
at com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.execute(ServletContextImpl.java)
at com.gefionsoftware.server.GenericServer.execute(GenericServer.java)
at com.gefionsoftware.server.lws.LiteWebServer$RequestHandler.run(LiteWebServer.java)
at se.pureit.util.ThreadPool$WorkThread.startRunnable(ThreadPool.java)
at se.pureit.util.ThreadPool$WorkThread.run(ThreadPool.java)

Some advices?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Well, the reason I asked was that my initial response is that this doesn't seem to be an XML related question, and seeing the error that pretty much defines it.
Going to find out if it would best be answered in the I/O and Streams forum, or the one for Servlets. There might be people in either one of those that have experienced something similar.
Pankaj Kr
Author
Ranch Hand

Joined: Sep 09, 2003
Posts: 80
As the previous post stated -- the problem doesn't seem to be XML related.
Most likely, it is SSL related. So, you need to verify a number of things:
1. Does server support HTTPS?
2. If yes, then does the client has environment variables for truststore setup?
3. Do both client and server support common cipher-suite?
....


Pankaj Kumar
Home - WebLog - J2EE Security
Faxin Zhao
Greenhorn

Joined: Jul 18, 2003
Posts: 16
Hi Jason & Pankaj,
Thanks for your suggestion, I'll post my question to IO/Stream.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: https problem
 
Similar Threads
Servlet, XML response and XSL
Apply XSL to XML (Java)
Using FOP
Error running Xalan sample: servlet.SimpleXSLTServlet
For HTTPS, couln't get url.openStream