I recently tested WebService. I used myeclipse5.1.1 to create a WebService named "user" and added two methods to the service.
Public String example (string message ){
Return message;
}
Public String [] usercheck (string username, string password ){
String s [] = NULL;
If (username. inclusignorecase ("Robin") & password. inclusignorecase ("password ")){
S = new string [3];
S [0] = "Robin ";
S [1] = "Robin ";
S [2] = "Robin ";
}
Return S;
}
Publish it to Tomcat 6, generate a client using myeclipse, and call the service in the client for testing. The call is normal on the client. Next, we want to implement the user authentication function in JSP, that is, to submit the user name and password on the leaf, which is returned by wenservice.
Then write the authentication 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 ());
}
}
It runs directly in eclipse and is normal. But when I reference it in 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 ("________");
%>
the string reference is correct, that is, an error occurs when calling the list
unable to locate jaxb. properties for package com. Zoo. Service. User