Hi, everyone! :)
I've worked with Google App Engine for a couple months. I've done web
app, hosted it on my app engine account using JPA. After that
developing I wanted to create App Engine web service application. I've
looked some technologies for creating web services app for a long time
and finally I've found it! There is http://code.google.com/p/webserviceservlet/.
I downloaded UserGuide.pdf from this link. There is an example in this
user guide. I made application by its tutorial. Webserviceservlet
doesn't support JAX-WS but it supports JAXB framework. In example the
simple way is described. There is one model entity with JAXB
annotations - Employee:

@XmlRootElement
@XmlType(name="Employee")
public class Employee {
       String fname;
       public Employee(){
       }
       public void setFirstName(String value){
              this.fname = value;
       }
       public String getFirstName(){
              return this.fname;
       }
}

My web.xml is the same from tutorial example.
Then I've written web method like in the tutorial:

public class MyWebService {
       public MyWebService(){
       }
       public String addEmployee(Employee emp){
              return "ok: emplyee added";
       }
}

After this need to create xml schema from class Employee. Created
schema is an input parameter to web services servlet, described in
web.xml
I launched app and that's great! It's worked good.
But it was easy.

I've wanted to modify my web services with input List<Employee>
instead of single instance of Employee like tutorial.
Modifyed method:

public class MyWebService {
       public MyWebService(){
       }
       public String addEmployee(List<Employee> empList){
              return "ok: emplyee added";
       }
}

java.util.List isn't marked with JAXB annotations, so I've created a
new class Employees that contains List<Employee>:

@XmlRootElement(namespace = "ws.employee.com")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Employees", namespace = "ws.employee.com")
public class Employees {

        /** */
        private List<Employee> employeeList = new ArrayList<Employee>();

        public List<Employee> getEmployeeList() {
                return employeeList;
        }

        public void setEmployeeList(List<Employee> employeeList) {
                this.employeeList = employeeList;
        }
}

New Employee class is shown now:

@XmlRootElement(namespace = "ws.employee.com")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Employee", namespace = "ws.jevera.com")
public class Employee {
        /** */
        private String name;

        public String getName() {
                return name;
        }

        public void setName(String name) {
                this.name = name;
        }

}

And finally changed web method addEmployee
public String addEmployee(Employees emp){
      return "ok: emplyee added";
}

Schema created OK. And wsdl was created also good. But during making a
client through wsimport utilities i catched error - some type in xml
schema could not de found.
Who worked with lists in Google App Engine Web Services through
http://code.google.com/p/webserviceservlet/ please HELP ME. I've tryed
all ways to success but it was failed. This task is very important for
me.
Thank you :)

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to