Persona.jws :
Código:
Alumno.jws :public class Persona { public String id; public String nombre; public String edad; public String domicilio; //public Persona(){} public String Persona(String id, String dom, String nom, String edad){ this.id=id; this.domicilio=dom; this.nombre=nom; this.edad=edad; return id+" "+domicilio+" "+nombre+" "+edad; } public String getID(){ return this.id; } public String getDom(){ return this.domicilio; } public String getNom(){ return this.nombre; } public String getEdad(){ return this.edad; } public String identifica(){ return this.id; } public String setDatos(String ide, String domi,String nomb,String eda){ this.id=ide; this.domicilio=domi; this.nombre=nomb; this.edad=eda; return id+" "+domicilio+" "+nombre+" "+edad; } public void updateDomicilio(String Dom){ this.domicilio=Dom; } public void updateEdad(String Edad){ this.edad=Edad; } // public String InstantiationException(){return this.nombre;} }
Código:
Clase Dummy.jws :public class Alumno extends Persona{ public Alumno(String ide,String domi,String nomb,String eda){ super(ide,domi,nomb,eda); } public String invocaSetDatos(String identifica,String domicilion,String nombres,String edadd) { String cadena = setDatos(identifica,domicilion,nombres,edadd); return cadena; } }
Código:
Cliente:public class Dummy{ public String invocaAlumno(Strin a1,String a2,String a3,String a4) { Alumno alumni = new Alumno(a1,a2,a3,a4); String cadResultante = alumni.invocaSetDatos(a1,a2,a3,a4); return cadResultante; } }
Código:
Error: import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import javax.xml.rpc.ParameterMode; //class InstantiationExceptionDemo { public class ClienteAgenda { public static void main(String[] args){ String method= "invocaAlumno"; String id= new String("9876"); String dom= new String("Conocido"); String nom=new String("Juanita"); String edad=new String("30"); try{ Service service= new Service(); Call call=(Call) service.createCall(); String endpoint= "http://localhost:8080/axis/Dummy.jws"; call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(method); call.addParameter("op1",XMLType.XSD_STRING,ParameterMode.IN); call.addParameter("op2",XMLType.XSD_STRING,ParameterMode.IN); call.addParameter("op3",XMLType.XSD_STRING,ParameterMode.IN); call.addParameter("op4",XMLType.XSD_STRING,ParameterMode.IN); call.setReturnType(XMLType.XSD_ANY); String ret= (String)(call.invoke(new Object[]{id,dom,nom,edad})); System.out.println("DATOS:"+ret); } catch (Exception e) { System.out.println(e.toString()); } } }
Código:
Fault - Error while compiling: /usr/local/apache-tomcat-7.0.35/webapps/axis/WEB-INF/jwsClasses/Alumno.java AxisFault faultCode: {http://xml.apache.org/axis/}Server.compileError faultSubcode: faultString: Error while compiling: /usr/local/apache-tomcat-7.0.35/webapps/axis/WEB-INF/jwsClasses/Alumno.java faultActor: faultNode: faultDetail: {}Errors:Error compiling /usr/local/apache-tomcat-7.0.35/webapps/axis/WEB-INF/jwsClasses/Alumno.java: Line 1, column 28: error: cannot find symbol Line 0, column 0: could not parse error message: symbol: class Persona /usr/local/apache-tomcat-7.0.35/webapps/axis/WEB-INF/jwsClasses/Alumno.java:9: error: cannot find symbol String cadena = setDatos(identifica,domicilion,nombres,edadd); ^ Line 0, column 0: symbol: method setDatos(String,String,String,String) location: class Alumno 2 errors