From: Andre C. <car...@gm...> - 2014-09-27 14:36:01
|
Hello, I am a beginner in htmlunit. I succeeded in accessing websites (http protocol) according to HtmlUnit Get Started page. However, when I try to access the page https://siproquim.dpf.gov.br/smp/clf/EstadoHabilitacaoEmpresa.do I get the exception javax.net.ssl.SSLException: Received fatal alert: illegal_parameter Can guide me how to proceed when I need to access websites with https protocol? Thanks a lot. My source is below, followed by the exception: public class AccessWebsite { public void getPfInfoByCnpj(String cnpj) throws Exception{ final WebClient webClient = new WebClient(); final HtmlPage RequestPage = webClient.getPage(" https://siproquim.dpf.gov.br/smp/clf/EstadoHabilitacaoEmpresa.do"); final HtmlForm form = RequestPage.getFormByName("informacoesClfForm"); final HtmlTextInput textField = form.getInputByName("cnpj"); textField.setValueAttribute("02931883000189"); final HtmlSubmitInput button = form.getInputByValue("Consulta por CPF/CNPJ"); final HtmlPage resultPage = button.click(); System.out.println(resultPage.getTextContent()); webClient.closeAllWindows(); } } javax.net.ssl.SSLException: Received fatal alert: illegal_parameter at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254) at com.gargoylesoftware.htmlunit.HtmlUnitSSLConnectionSocketFactory.connectSocket(HtmlUnitSSLConnectionSocketFactory.java:155) at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:117) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:178) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1313) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1230) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:338) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:407) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:392) at br.com.cpqservice.utilities.AccessWebsite.getPfInfoByCnpj(AccessWebsite.java:25) at br.com.cpqservice.utilities.AccessWebsite.main(AccessWebsite.java:55) |