mailBoy2
asked on
500 error when connecting to a http site (SipFoundry)
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/UserServi ce?wsdl
java.io.IOException: Server returned HTTP response code: 500 for URL: https://sip.xxx.co.n
z:8443/sipxconfig/services /UserServi ce?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.P honeUtils. sendTheMes sage(Phone Utils.java :25
2)
at nz.co.serendipityit.portal .service.P honeUtils. sendMessag e(PhoneUti ls.java:10 8)
at nz.co.serendipityit.portal .service.P honeUtils. getUserByN ame(PhoneU tils.java: 62)
at nz.co.serendipityit.portal .web.BuySe rvice.find UserInPhon eSystem(Bu yService.j ava
:28)
at nz.co.serendipityit.portal .web.Welco meControll er.handleR equest(Wel comeContro lle
r.java:131)
at org.springframework.web.se rvlet.mvc. SimpleCont rollerHand lerAdapter .handle(Si mpl
eControllerHandlerAdapter. java:48)
at org.springframework.web.se rvlet.Disp atcherServ let.doDisp atch(Dispa tcherServl et.
java:875)
at org.springframework.web.se rvlet.Disp atcherServ let.doServ ice(Dispat cherServle t.j
ava:809)
at org.springframework.web.se rvlet.Fram eworkServl et.process Request(Fr ameworkSer vle
t.java:523)
at org.springframework.web.se rvlet.Fram eworkServl et.doGet(F rameworkSe rvlet.java :45
3)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 689)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 802)
at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication Fil
terChain.java:237)
at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain
.java:157)
at org.apache.catalina.core.S tandardWra pperValve. invoke(Sta ndardWrapp erValve.ja va:
214)
at org.apache.catalina.core.S tandardVal veContext. invokeNext (StandardV alveContex t.j
ava:104)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:520)
at org.apache.catalina.core.S tandardCon textValve. invokeInte rnal(Stand ardContext Val
ve.java:198)
at org.apache.catalina.core.S tandardCon textValve. invoke(Sta ndardConte xtValve.ja va:
152)
at org.apache.catalina.core.S tandardVal veContext. invokeNext (StandardV alveContex t.j
ava:104)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:520)
at org.apache.catalina.core.S tandardHos tValve.inv oke(Standa rdHostValv e.java:137 )
at org.apache.catalina.core.S tandardVal veContext. invokeNext (StandardV alveContex t.j
ava:104)
at org.apache.catalina.valves .ErrorRepo rtValve.in voke(Error ReportValv e.java:118 )
at org.apache.catalina.core.S tandardVal veContext. invokeNext (StandardV alveContex t.j
ava:102)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:520)
at org.apache.catalina.core.S tandardEng ineValve.i nvoke(Stan dardEngine Valve.java :10
9)
at org.apache.catalina.core.S tandardVal veContext. invokeNext (StandardV alveContex t.j
ava:104)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:520)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 29)
at org.apache.coyote.tomcat5. CoyoteAdap ter.servic e(CoyoteAd apter.java :160)
at org.apache.coyote.http11.H ttp11Proce ssor.proce ss(Http11P rocessor.j ava:799)
at org.apache.coyote.http11.H ttp11Proto col$Http11 Connection Handler.pr ocessConne cti
on(Http11Protocol.java:705 )
at org.apache.tomcat.util.net .TcpWorker Thread.run It(PoolTcp Endpoint.j ava:577)
at org.apache.tomcat.util.thr eads.Threa dPool$Cont rolRunnabl e.run(Thre adPool.jav a:6
83)
at java.lang.Thread.run(Threa d.java:595 )
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/UserServi
java.io.IOException: Server returned HTTP response code: 500 for URL: https://sip.xxx.co.n
z:8443/sipxconfig/services
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
2)
at nz.co.serendipityit.portal
at nz.co.serendipityit.portal
at nz.co.serendipityit.portal
:28)
at nz.co.serendipityit.portal
r.java:131)
at org.springframework.web.se
eControllerHandlerAdapter.
at org.springframework.web.se
java:875)
at org.springframework.web.se
ava:809)
at org.springframework.web.se
t.java:523)
at org.springframework.web.se
3)
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at org.apache.catalina.core.A
terChain.java:237)
at org.apache.catalina.core.A
.java:157)
at org.apache.catalina.core.S
214)
at org.apache.catalina.core.S
ava:104)
at org.apache.catalina.core.S
at org.apache.catalina.core.S
ve.java:198)
at org.apache.catalina.core.S
152)
at org.apache.catalina.core.S
ava:104)
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
ava:104)
at org.apache.catalina.valves
at org.apache.catalina.core.S
ava:102)
at org.apache.catalina.core.S
at org.apache.catalina.core.S
9)
at org.apache.catalina.core.S
ava:104)
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.coyote.tomcat5.
at org.apache.coyote.http11.H
at org.apache.coyote.http11.H
on(Http11Protocol.java:705
at org.apache.tomcat.util.net
at org.apache.tomcat.util.thr
83)
at java.lang.Thread.run(Threa
//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());
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.