Descarga XML con java
Publicado por leonardo (5 intervenciones) el 13/03/2016 22:39:59
Hola quien me puede ayudar, quiero descargar cfdi de la pagina del sat estoy realizando un par de pruebas con htmlunit, si acceso por esta url https://portalcfdi.facturaelectronica.sat.gob.mx/ me manda al form de FIEL para que desde ahi puedas accesar, lo que yo quiero es ingresar por contraseña entonces ingreso por esta url https://cfdiau.sat.gob.mx/nidp/app/login?id=SATUPCFDiCon&sid=0&option=credential&sid=0 pero al accesar con htmunit,me direcciona a una paguina donde muestra el perfil del usuario y de ahi no pido pasar tal paraec que direcciona a una paguina diferente.
este es parte de mi código
este es parte de mi código
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
public void submittingForm() throws Exception {
HtmlPage page1 = null;
try (final WebClient webClient = new WebClient()) {
// Get the first page
final HtmlPage page = webClient.getPage("https://portalcfdi.facturaelectronica.sat.gob.mx/");
page1 = webClient.getPage("https://cfdiau.sat.gob.mx/nidp/app/login?id=SATUPCFDiCon&sid=0&option=credential&sid=0");
webClient.getOptions().setUseInsecureSSL(true);
// WebResponse response = page1.getWebResponse();
// String content = response.getContentAsString();
// System.out.println(" Resultados :::: "+content);
System.out.println(" Resultados :::: "+page);
// Get the form that we are dealing with and within that form,
// find the submit button and the field that we want to change.
final HtmlForm form = page1.getFormByName("IDPLogin");
form.getInputByName("Ecom_User_ID").setValueAttribute("GCN110322GLA");
form.getInputByName("Ecom_Password").setValueAttribute("Andher86");
//final HtmlTextInput textField = form.getInputByName("userid");
// Change the value of the text field
// textField.setValueAttribute("root");
final HtmlSubmitInput button = form.getInputByName("submit");
// Now submit the form by clicking the button and get back the second page.
page1 = button.click();
//WebResponse response = page1.getWebResponse();
//List<NameValuePair> content = response.getResponseHeaders();
System.out.println(""+page1.asXml());
// System.out.println(page2.getBaseURL());
// System.out.println(page2.getBody().getIndex());
// System.out.println(page2.isHtmlPage());
}
}
Valora esta pregunta


0