mardi 26 mai 2015

Java WebService call from ApacheCordova

I'm really new to apache cordova, I'm actually using visual studio dev kit for Cordova, I have a Java EE aplication running on glassfish and I have this web service:

import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(serviceName = "Eventos")
public class Eventos {
@EJB
private ServiceEventoFacadeLocal ejbRef;

@WebMethod(operationName = "findAll")
public List<ServiceEvento> findAll() {
    return ejbRef.findAll();
}

}

And this is the Entity:

@Entity
public class ServiceEvento implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
private String nombre;
@Basic(optional = false)
@NotNull
private BigInteger precioentrada;
@Basic(optional = false)
@NotNull
private BigInteger capacidad;
@Temporal(TemporalType.TIMESTAMP)
private Date inicio;
@Size(max = 300)
private String descripción;
@Size(max = 150)
private String ubicacion;

So as it says in the title I'm using apache cordova with visual studio, as far as my understanding goes i need to use JavaScript to call the web service, but I don't really understand how to call the webservice in JS and after traverse the list and display it Thanks in advance

Aucun commentaire:

Enregistrer un commentaire