最近在做webservice的测试,使用Myeclipse5.1.1创建webservice,名字为user,在服务中添加两个方法
public String example(String message) {
return message;
}
public String[] userCheck(String username,String password){
String s[] = null;
if (username.equalsIgnoreCase( "robin ") && password.equalsIgnoreCase( "password ")){
s = new String[3];
s[0] = "robin ";
s[1]= "robin ";
s[2]= "robin ";
}
return s;
}
发布到tomcat6中,然后通过myeclipse生成客户端,在客户端中调用服务进行测试。在客户端中调用正常。接下来想在JSP中实现用户身份验证功能,即有叶面提交用户名和密码,由wenservice返回。
于是编写身份验证bean
public class tt {
private static userClient uc = new userClient();
private static userPortType ut = uc.getuserHttpPort();
public String getExmple(){
String s = ut.example( "robin ");
return s;
}
public List getUser(String username,String password){
List s = null;
ArrayOfString as = (ArrayOfString)ut.userCheck(username,password);
try {
s = (List)as.getString();
}catch(Exception e ){
s = null;
}
return s;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
tt t = new tt();
System.out.println(t.getExmple());
List l = t.getUser( "robin ", "password ");
if(l==null){
System.out.println( "dd ");
}else{
System.out.println(l.size());
}
//System.out.println(.size());
}
}
在eclipse中直接运行,正常。但是当我在JSP中进行引用的时候出现问题
<%@ page import= "com.zoo.tt " %>
<%
tt t = new tt();
out.println(t.getExmple());
List l = t.getUser( "robin ", "password ");
out.println( "________ ");
out.println(l.size());
out.println( "________ ");
%>
字符串的引用没有问题,就是在List调用时出错
Unable to locate jaxb.properties for package com.zoo.service.user