Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamu <samurey@gmail.com>2013-02-13 22:31:04 (GMT)
committer Samu <samurey@gmail.com>2013-02-13 22:31:04 (GMT)
commite702d72f377d29622ffad1461561c4d7272d68d3 (patch)
tree30349c98be6805ec4e9addc7800cfa716f1699c5
parentff58fe7e572d30e87f4c3e336e7619ace0fa0027 (diff)
Webservices de prueba
-rw-r--r--EjercitarClient/.pydevproject3
-rw-r--r--EjercitarClient/gui/ContenedorTemas.py5
-rw-r--r--EjercitarClient/gui/ContenedorTemas.pycbin1343 -> 1377 bytes
-rw-r--r--EjercitarClient/gui/Ejercitario.py27
-rw-r--r--EjercitarClient/gui/Ejercitario.pycbin2611 -> 2848 bytes
-rw-r--r--EjercitarClient/gui/Temas.py36
-rw-r--r--EjercitarClient/gui/Temas.pycbin1749 -> 1982 bytes
-rw-r--r--EjercitarServer/ejbModule/beans/EjercitarWS.java37
-rw-r--r--EjercitarServer/ejbModule/beans/EjercitarWSBean.java63
9 files changed, 110 insertions, 61 deletions
diff --git a/EjercitarClient/.pydevproject b/EjercitarClient/.pydevproject
index a69582a..0b0da7e 100644
--- a/EjercitarClient/.pydevproject
+++ b/EjercitarClient/.pydevproject
@@ -7,4 +7,7 @@
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH">
+<path>C:\Users\Samu\Downloads\suds-0.4-py2.6.egg</path>
+</pydev_pathproperty>
</pydev_project>
diff --git a/EjercitarClient/gui/ContenedorTemas.py b/EjercitarClient/gui/ContenedorTemas.py
index 279a31b..fd0d81c 100644
--- a/EjercitarClient/gui/ContenedorTemas.py
+++ b/EjercitarClient/gui/ContenedorTemas.py
@@ -12,11 +12,12 @@ class ContenedorTemas(gtk.HBox):
# in this example. More on callbacks below.
- def __init__(self, id_tema, descripcion, ventana_padre, vista_temas):
+ def __init__(self, id_tema, descripcion, ventana_padre, vista_temas, cliente_WS):
# create a new window
super(ContenedorTemas, self).__init__()
self.ventana_padre = ventana_padre
self.vista_temas = vista_temas
+ self.cliente_WS = cliente_WS
label_descripcion = gtk.Label(descripcion)
@@ -28,6 +29,6 @@ class ContenedorTemas(gtk.HBox):
def __comenzar_cb(self, boton):
self.ventana_padre.remove(self.vista_temas)
- ejercitario = Ejercitario()
+ ejercitario = Ejercitario(self.cliente_WS)
self.ventana_padre.add (ejercitario)
\ No newline at end of file
diff --git a/EjercitarClient/gui/ContenedorTemas.pyc b/EjercitarClient/gui/ContenedorTemas.pyc
index 3d549fb..2e3c80f 100644
--- a/EjercitarClient/gui/ContenedorTemas.pyc
+++ b/EjercitarClient/gui/ContenedorTemas.pyc
Binary files differ
diff --git a/EjercitarClient/gui/Ejercitario.py b/EjercitarClient/gui/Ejercitario.py
index 5488c30..16d3c44 100644
--- a/EjercitarClient/gui/Ejercitario.py
+++ b/EjercitarClient/gui/Ejercitario.py
@@ -6,23 +6,26 @@ Created on Feb 4, 2013
import gtk
+import suds
+from suds.client import Client
+
class Ejercitario(gtk.VBox):
# This is a callback function. The data arguments are ignored
# in this example. More on callbacks below.
- def __init__(self):
+ def __init__(self, cliente_WS):
# create a new window
super(Ejercitario, self).__init__()
self.__inicializar_componentes()
- self.__calcular_siguiente_ejercicio()
- self.__organizar_gui()
+ siguiente_ejercicio = self.__obtener_siguiente_ejercicio(cliente_WS)
+ self.__organizar_gui(siguiente_ejercicio)
#self.__sincronizar_temas()
self.show_all()
def __inicializar_componentes(self):
- self.label_planteamiento = gtk.Label()
+ self.label_enunciado = gtk.Label()
self.solucion1 = gtk.RadioButton()
self.solucion2 = gtk.RadioButton()
self.solucion3 = gtk.RadioButton()
@@ -35,14 +38,14 @@ class Ejercitario(gtk.VBox):
self.boton_responder = gtk.Button("Responder")
self.boton_responder.connect("clicked", self.__responder_cb)
- def __organizar_gui(self):
+ def __organizar_gui(self, siguiente_ejercicio):
#prueba
self.solucion1.set_label("prueba1")
self.solucion2.set_label("prueba2")
self.solucion3.set_label("prueba3")
self.solucion4.set_label("prueba4")
- self.label_planteamiento.set_label("Descripcion de prueba")
+ self.label_enunciado.set_label(siguiente_ejercicio.enunciado)
#prueba
contenedor_soluciones = gtk.HBox()
@@ -51,7 +54,7 @@ class Ejercitario(gtk.VBox):
contenedor_soluciones.add(self.solucion3)
contenedor_soluciones.add(self.solucion4)
- self.add(self.label_planteamiento)
+ self.add(self.label_enunciado)
self.add(contenedor_soluciones)
self.add(self.boton_responder)
self.show_all()
@@ -59,8 +62,14 @@ class Ejercitario(gtk.VBox):
def __sincronizar_temas(self):
pass
- def __calcular_siguiente_ejercicio(self):
- pass
+ def __obtener_siguiente_ejercicio(self, cliente_WS):
+ try:
+ #cliente_WS = Client(self.WSDL_URL)
+ siguiente_ejercicio = cliente_WS.service.getSiguienteEjercicio()
+ except:
+ print "\n\nERROR al instanciar el SINCRONIZAR PROXY:"
+
+ return siguiente_ejercicio
def __responder_cb(self, boton):
pass
diff --git a/EjercitarClient/gui/Ejercitario.pyc b/EjercitarClient/gui/Ejercitario.pyc
index 4a49404..8109dfb 100644
--- a/EjercitarClient/gui/Ejercitario.pyc
+++ b/EjercitarClient/gui/Ejercitario.pyc
Binary files differ
diff --git a/EjercitarClient/gui/Temas.py b/EjercitarClient/gui/Temas.py
index 679324f..db18821 100644
--- a/EjercitarClient/gui/Temas.py
+++ b/EjercitarClient/gui/Temas.py
@@ -11,36 +11,46 @@ Created on Feb 2, 2013
import gtk
from gui.ContenedorTemas import ContenedorTemas
+import suds
+from suds.client import Client
+
class Temas(gtk.VBox):
# This is a callback function. The data arguments are ignored
# in this example. More on callbacks below.
-
+
+ WSDL_URL = 'http://localhost:8080/EjercitarServer/EjercitarWSBean?wsdl'
def __init__(self, ventana_padre):
# create a new window
super(Temas, self).__init__()
self.ventana_padre = ventana_padre
- self.__inicializar_componentes()
- self.__organizar_gui()
- self.__sincronizar_temas()
+ self.__inicializar_componentes()
+ self.cliente_WS = self.__sincronizar_temas()
+ self.__organizar_gui(self.cliente_WS)
self.show_all()
def __inicializar_componentes(self):
- self.prueba1 = ContenedorTemas(1, "prueba 1", self.ventana_padre, self)
- self.prueba2 = ContenedorTemas(1, "prueba 2", self.ventana_padre, self)
- self.prueba3 = ContenedorTemas(1, "prueba 3", self.ventana_padre, self)
-
- def __organizar_gui(self):
+ pass
+
+ def __organizar_gui(self, cliente_WS):
contenedor_lista = gtk.VBox()
- contenedor_lista.add(self.prueba1)
- contenedor_lista.add(self.prueba2)
- contenedor_lista.add(self.prueba3)
+ lista_temas = cliente_WS.service.getTemas()
+ for tema in lista_temas:
+ nuevo_tema = ContenedorTemas(tema.idTema, tema.nombre, self.ventana_padre, self, self.cliente_WS)
+ contenedor_lista.add(nuevo_tema)
+
+
self.add(contenedor_lista)
self.show_all()
def __sincronizar_temas(self):
- pass
+ try:
+ cliente_WS = Client(self.WSDL_URL)
+
+ except:
+ print "\n\nERROR al instanciar el SINCRONIZAR PROXY:"
+ return cliente_WS
diff --git a/EjercitarClient/gui/Temas.pyc b/EjercitarClient/gui/Temas.pyc
index a35fa82..f31e2e3 100644
--- a/EjercitarClient/gui/Temas.pyc
+++ b/EjercitarClient/gui/Temas.pyc
Binary files differ
diff --git a/EjercitarServer/ejbModule/beans/EjercitarWS.java b/EjercitarServer/ejbModule/beans/EjercitarWS.java
deleted file mode 100644
index 97c75a1..0000000
--- a/EjercitarServer/ejbModule/beans/EjercitarWS.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package beans;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-
-import model.Tema;
-
-/**
- * Session Bean implementation class EjercitarWS
- */
-@Stateless
-@WebService
-public class EjercitarWS {
-
- @PersistenceContext
- EntityManager em;
- /**
- * Default constructor.
- */
- public EjercitarWS() {
- // TODO Auto-generated constructor stub
- }
-
- @WebMethod
- public Collection<Tema> getTemas() {
- // TODO Auto-generated method stub
- Query query = em.createQuery("SELECT e FROM Tema e");
- return (Collection<Tema>) query.getResultList();
-
- }
-
-}
diff --git a/EjercitarServer/ejbModule/beans/EjercitarWSBean.java b/EjercitarServer/ejbModule/beans/EjercitarWSBean.java
new file mode 100644
index 0000000..96c7a8d
--- /dev/null
+++ b/EjercitarServer/ejbModule/beans/EjercitarWSBean.java
@@ -0,0 +1,63 @@
+package beans;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.ejb.LocalBean;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import model.Ejercicio;
+import model.Tema;
+
+/**
+ * Session Bean implementation class EjercitarWS
+ */
+@WebService
+@SOAPBinding(style=SOAPBinding.Style.RPC)
+@Remote(EjercitarWSRemote.class)
+@Stateless
+public class EjercitarWSBean implements EjercitarWSRemote {
+
+ @PersistenceContext EntityManager em;
+ /**
+ * Default constructor.
+ */
+ public EjercitarWSBean() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see beans.EjercitarWSRemote#getTemas()
+ */
+
+ @WebMethod
+ public Collection<Tema> getTemas() {
+ // TODO Auto-generated method stub
+ Query query = em.createQuery("SELECT e FROM Tema e");
+ return (Collection<Tema>) query.getResultList();
+ }
+
+ @WebMethod
+ public Ejercicio getSiguienteEjercicio() {
+ // TODO Auto-generated method stub
+ Ejercicio ej = em.find(Ejercicio.class, 1);
+ return ej;
+ }
+
+ @WebMethod
+ public String getText() {
+ return "hola mundo";
+ }
+
+
+
+}