0
I am trying to consume the web service of the Post Office - Tracking. On the net Benas imported the WSDL in new->client to Webservice. The problem is that Webservice is returning the empty list, I’m not getting it.
public static void main(String[] args) {
Sroxml result = buscaEventos("ECT", "SRO", "L", "T", "101", "OC013972795BR");
System.out.println("qtd "+result.getQtd());
System.out.println("Objeto "+result.getObjeto());
System.out.println(result.getObjeto().get(0).getNumero());
System.out.println(result.getObjeto().get(0).getEvento().get(0).getDescricao());
}
private static Sroxml buscaEventos(java.lang.String usuario, java.lang.String senha, java.lang.String tipo, java.lang.String resultado, java.lang.String lingua, java.lang.String objetos) {
br.com.correios.webservice.resource.Rastro service = new br.com.correios.webservice.resource.Rastro();
br.com.correios.webservice.resource.Service port = service.getServicePort();
return port.buscaEventos(usuario, senha, tipo, resultado, lingua, objetos);
}
}
And you’re making this mistake:
run: Qtd 1
Object []
Exception in thread "main" java.lang.Indexoutofboundsexception: Index: 0, Size: 0 at java.util.Arraylist.rangeCheck(Arraylist.java:653) at java.util.Arraylist.get(Arraylist.java:429) at javaapplication3.Javaapplication3.main(Javaapplication3.java:11) C: Users Lorena Documents Netbeansprojects Javaapplication3 nbproject build-impl.xml:1041: The following error occurred while executing this line: C: Users Lorena Documents Netbeansprojects Javaapplication3 nbproject build-impl.xml:806: Java returned: 1 BUILD FAILURE (total time: 5 seconds)
I am implementing the same thing, if you want to put my code as I search the information.
– Roknauta
Douglas, I would really appreciate it if you would post.
– Guilherme kreusch