最近在做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