spring + XFire 构建webservic 例二

User.java文件
package com.hyw.example;

import java.io.Serializable;

public class User implements Serializable {

	private static final long serialVersionUID = 2814532266609852960L;
	private String username;
	private String password;
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getUsername() {
		return username;
	}
	
	public String getPassword() {
		return password;
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("username=" + this.username);
		sb.append("|password=" + this.password);
		return sb.toString();
	}

}


UserService.java文件
package com.hyw.example;

public interface UserService {
	
	public User getUser(String username);
	
	public String createUser(User user);

}


UserServiceImpl.java文件
package com.hyw.example;

public class UserServiceImpl implements UserService {

	public String createUser(User user) {
		
		return user.toString();
	}

	public User getUser(String username) {
		
		User user = new User();
		user.setUsername(username);
		user.setPassword("123456");
		return user;
	}

}

你可能感兴趣的:(java,spring)