Hola buenas tardes, me ha surgido un problema y agradecería mucho una ayuda.
Estoy desarrollando una aplicación web con jsp, los jsp acceden a un servicio web en java que comunica con una base de datos en MySQL. El problema le tengo al llamar a un método del servicio web que devuelve objetos Vector
<%@page import="org.apache.axis.client.Call"%>
<%@page import="org.apache.axis.client.Service"%>
<%@page import="org.apache.axis.encoding.XMLType"%>
<%@page import="java.util.Vector"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.*"%>
<%@page import="javax.xml.rpc.ParameterMode"%>
<%@page import="servidor.Descripcion"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<table>
<%
try {
String sql="aqui va la sentencia sql";
String endpoint="url del servicio web con extensión .jws ";
Service service = new Service ();
Call call = (Call) service.createCall ();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("obtenerBreveDescripcionVector");
call.addParameter( "sql", XMLType.XSD_STRING, ParameterMode.IN );
call.setReturnType (XMLType.SOAP_VECTOR);
Vector<Descripcion> ret = (Vector<Descripcion>) call.invoke (new Object [] {sql});
for(int i=0; i<ret.size(); i++){
String id=ret.get(i).getId();
String curso = (String)ret.get(i).getCurso();
String creditos = ret.get(i).getCreditos();
String semestre = ret.get(i).getSemestre();
String horas = ret.get(i).getHorasSemana();
String horario = ret.get(i).getHorario();
String grupo = ret.get(i).getGrupo();
String aulaT = ret.get(i).getAulaT();
String aulaP = ret.get(i).getAulaP();
String profesores = ret.get(i).getProfesores();
out.println("<tr><td>Curso</td><td>"+curso+"</td></tr><tr><td>Créditos</td><td>"+creditos+"</td></tr><tr><td>Semestre</td><td>"+semestre+"</td></tr><tr><td>Horas/Semana</td><td>"+horas+"</td></tr><tr><td>Horario</td><td>"+horario+"</td></tr><tr><td>Grupo</td><td>"+grupo+"</td></tr><tr><td>Aula de teoría</td><td>"+aulaT+"</td></tr><tr><td>Aula de prácticas</td><td>"+aulaP+"</td></tr><tr><td>Profesores</td><td>"+profesores+"</td></tr>");
}
catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
<br>
<br>
<br>
</table>
</body>
</html>
Basicamente la duda que tengo debería estar en las siguientes lineas:
call.setReturnType (XMLType.SOAP_VECTOR);
Vector
No se si es correcta la invocación para un Vector de objetos de una clase propia, no me da ningun error simplemente me muestra la jsp en blanco. El acceso del servicio web a la base de datos es correcto, el problema debería estar en este código.
Muchisimas gracias,
Un saludo.
Comentarios (4)
catch (Exception ex) { out.print(ex.getStackTrace()); }