public String telephoneValidation() throws Exception{
ServletActionContext.getResponse().setContentType("utf-8");
//利用web service完成電話號碼的驗證
//獲取telephone
String telephone = (String) ServletActionContext.getContext().getParameters().get("tlephone");
Customer customer = WebClient.create("http://localhost:9002/crm_management/services/customerService/telephoneValidation/"+telephone).accept(MediaType.APPLICATION_JSON).get(Customer.class);
if(customer != null){
ServletActionContext.getResponse().getWriter().write("此號碼已經被佔用");
System.out.println("此號碼已經被佔用");
}else {
ServletActionContext.getResponse().getWriter().write("此號碼可用");
System.out.println("此號碼可用");
}
return NONE;
}