1、新建接口类,并声明为webService
package com.glaway.ws.webservice;import javax.jws.WebService;@WebService public class WsTest2 {}
2、在类中新建接口方法,返回值都是String,是通过Json工具类将结果对象都封装成json字符串
package com.glaway.ws.webservice;import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;import javax.jws.WebService;import com.glaway.ws.bean.User; import com.glaway.ws.util.JsonUtils;@WebService public class WsTest2 {//对象,封装成json字符串,否则报错public String getUser() {User user </