SOAP

package com.*.webservice.service.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.jws.WebService;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;



@WebService(endpointInterface="com.*.webservice.service.impl.UserWsServiceImpl", serviceName="userWsService")
public class UserWsServiceImpl implements UserWsService {

/**
* 验证名称合法性-非中文
* @param userName
* @return
* @throws WsException
*/
private String validata(String userName) throws WsException {
if(null == userName){
return this.getXmlString("360", "");//用户名为空
}

userName = userName.trim();

if("".equals(userName)){
return this.getXmlString("360", "");//用户名为空
}

if (userName.length() > 64) {
return this.getXmlString("310", "");//长度大于64
}
String regex = "/^[\u0000-\u00FF]+$/";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(userName);
if (m.matches()) {
return this.getXmlString("300", "");//中文
}
return this.getXmlString("0", "");
}

}

package com.*.webservice.service;

import javax.jws.WebService;

@WebService
public interface UserWsService {

String addUser(String userName) throws Exception;

String delUser(String userName) throws Exception;
}

你可能感兴趣的:(java,sql,webservice,SOAP,360)