Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SampleData.java
- package wstest;
- import java.util.Date;
- import java.util.GregorianCalendar;
- import java.util.Random;
- /**
- *
- * @author victor.sakhnov
- */
- public class SampleData {
- public Date dateField;
- public String stringField;
- public double doubleField;
- public int intField;
- public SampleData() {
- this.dateField = GregorianCalendar.getInstance().getTime();
- this.stringField = "Some string";
- Random r = new Random();
- this.doubleField = r.nextDouble();
- this.intField = r.nextInt();
- }
- }
- /***********************************************************************/
- // NewWebService.java
- package wstest;
- import javax.jws.WebMethod;
- import javax.jws.WebParam;
- import javax.jws.WebService;
- /**
- *
- * @author victor.sakhnov
- */
- @WebService()
- public class NewWebService {
- public NewWebService() {
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "hello")
- public String hello(@WebParam(name = "name")
- String name) {
- return "Hello, "+name;
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "oneObject")
- public SampleData[] oneObject() {
- SampleData[] ar = new SampleData[1];
- ar[0] = new SampleData();
- return ar;
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "manyObjects")
- public SampleData[] manyObjects(@WebParam(name = "howMany")
- int howMany) {
- SampleData[] ar = new SampleData[howMany];
- for(int i=0; i<howMany; i++){
- ar[i] = new SampleData();
- }
- return ar;
- }
- }
- /****************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment