I have a running web service (using EclipseLink as JPA provider) and would like to call the methods that updates data in the database from PHP using SOAP.
A method in the web service may look something like this:
public void updatePerson(Person p){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("PersonLib");
EntityManager em = emf.createEntityManager();
if(!em.getTransaction().isActive()) {
em.getTransaction().begin();
}
em.merge(p);
em.getTransaction().commit();
}
From PHP, I guess I have to create an object of type stdClass and send it as the parameter for a Person. Am I right? But I don´t get it work with these lines of code:
$client = new SoapClient("url.to.wsdl", array("trace" => 1));
$obj = new stdClass();
$obj->Person = new stdClass();
$obj->Person->personId = 1;
$obj->Person->name = "Peter";
$client->updatePerson($obj);
I don´t know if this is the correct way to send an object from PHP to Java (well, it calls the method updatePerson(Person p) in the java application, but p doesn´t contain the data I entered in PHP).
"classmap"is used in theSoapClientconstructor.