Do not use on any
shared computer
September 7, 2008 01:14am pdt
 
[x]
Attachment Details

500 error when connecting to a http site (SipFoundry)

Tags: SipFoundry / Sun, SipXecs / Java
I get the error below when trying to conenct to a WSDL for my SipFoundry (application) installation.
I've attached in the code that requests the page, the stuff I've added in to get around the SSL issues and also pasted the the error below.
This is all running in Tomcat & Spring and is trying to call the WSDL on the "SipFoundry" server (sip.xxx.co.nz - NOTE THIS IS NOT REAL) - I can get to this HTTPS url in a browser no problems.
- So points will be given out to who ever offers the solution!!!


IOExceptionServer returned HTTP response code: 500 for URL: https://sip.xxx.co.nz:8443/sip
xconfig/services/UserService?wsdl
java.io.IOException: Server returned HTTP response code: 500 for URL: https://sip.xxx.co.n
z:8443/sipxconfig/services/UserService?wsdl
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.ja
va:1174)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnec
tionImpl.java:234)
        at nz.co.serendipityit.portal.service.PhoneUtils.sendTheMessage(PhoneUtils.java:25
2)
        at nz.co.serendipityit.portal.service.PhoneUtils.sendMessage(PhoneUtils.java:108)
        at nz.co.serendipityit.portal.service.PhoneUtils.getUserByName(PhoneUtils.java:62)

        at nz.co.serendipityit.portal.web.BuyService.findUserInPhoneSystem(BuyService.java
:28)
        at nz.co.serendipityit.portal.web.WelcomeController.handleRequest(WelcomeControlle
r.java:131)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(Simpl
eControllerHandlerAdapter.java:48)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.
java:875)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.j
ava:809)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServle
t.java:523)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:45
3)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:157)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
214)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.j
ava:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextVal
ve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
152)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.j
ava:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.j
ava:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.j
ava:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:10
9)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.j
ava:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti
on(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:6
83)
        at java.lang.Thread.run(Thread.java:595)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
//Code that requests the page:
HttpsURLConnection httpUrlConn = (HttpsURLConnection)phone_url.openConnection();
			
			httpUrlConn.setRequestMethod("POST");
			httpUrlConn.setRequestProperty("Content-Type", "text/xml");
			httpUrlConn.setRequestProperty("Accept", "text/xml");
			httpUrlConn.setRequestProperty("axis.transport.version","HTTP/1.1");
			httpUrlConn.setRequestProperty("User-Agent","Axis/1.4");
			httpUrlConn.setRequestProperty("Content-Length",""+message.length());
			httpUrlConn.setRequestProperty("SOAPAction", "\"\"");
			httpUrlConn.setDoOutput(true);
			httpUrlConn.setFollowRedirects(true);
 
			System.out.println("SENDING!!!!!!!!!!!!!!!!!!!!!!\n"+message);
			
			java.io.OutputStream out = httpUrlConn.getOutputStream();
			java.io.OutputStreamWriter wout = new java.io.OutputStreamWriter(out);
 
 
 
 
//I have  the following in my Java class to get arround SSL issues:
//FIX HTTPS ISSUES
 
			javax.net.ssl.HostnameVerifier hv = new javax.net.ssl.HostnameVerifier() {
			    public boolean verify(String urlHostName, javax.net.ssl.SSLSession session) {
			        System.out.println("Warning: URL Host: "+urlHostName+" vs. "+session.getPeerHost());
			        return true;
			    }
			};
			 
			HttpsURLConnection.setDefaultHostnameVerifier(hv);
			
	    // Create a trust manager that does not validate certificate chains
	       javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[]{
	           new javax.net.ssl.X509TrustManager() {
	               public java.security.cert.X509Certificate[] getAcceptedIssuers() {
	                   return null;
	               }
	               public void checkClientTrusted(
	                   java.security.cert.X509Certificate[] certs, String authType) {
	               }
	               public void checkServerTrusted(
	                   java.security.cert.X509Certificate[] certs, String authType) {
	               }
	           }
	       };
	       
	       // Install the all-trusting trust manager
	       try {
	    	   javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
	           sc.init(null, trustAllCerts, new java.security.SecureRandom());
	           HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
	       } catch (Exception e) {
	       }
	       
	       java.net.Authenticator.setDefault(new PhoneAuthenticator());
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: mailBoy2
Solution Provided By: mailBoy2
Participating Experts: 0
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Accepted Solution by mailBoy2
Accepted Solution by mailBoy2:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628