customerservice.java

来自「Xfire文件 用于开发web service 的一个开源工具 很好用的」· Java 代码 · 共 48 行

JAVA
48
字号
// START SNIPPET: servicepackage org.codehaus.xfire.demo;import java.util.ArrayList;import java.util.Collection;import java.util.List;import javax.jws.WebMethod;import javax.jws.WebParam;import javax.jws.WebResult;import javax.jws.WebService;@WebServicepublic class CustomerService{    private List<Customer> customers = new ArrayList<Customer>();        public CustomerService()    {    }    @WebMethod    @WebResult(name="Customers")    public Collection<Customer> getCustomers(@WebParam(name="UserToken", header=true) UserToken auth)    {        authorize(auth);                return customers;    }        private void authorize(UserToken auth)    {        System.out.println(auth.getUsername());        System.out.println(auth.getPassword());    }    @WebMethod    public String addCustomer(@WebParam(name="UserToken", header=true) UserToken auth,                               @WebParam(name="customer") Customer customer)    {        authorize(auth);                customers.add(customer);                return "";    }}//START SNIPPET: service

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?