您好,我创建了一个奇数或偶数的 Web 服务,当我在 netbeans 中为该 Web 服务创建客户端时,我遇到了这个错误。这里的网络服务:
@WebService(serviceName = "Par_Impar")
public class Par_Impar {
/**
* Web service operation
*/
@WebMethod(operationName = "operation")
public String operation(@WebParam(name = "val") int val) {
if(val%2!=0){
//daca reminder-ul nu este 0 este impar
return("IMPAR");
}
else {
//daca reminder-ul este 0 atunci este par
return("PAR");
}
}
}
index.jsp :
<html>
<head>
<title>PAGINA JSP</title>
</head>
<body>
<form action="action.jsp" method="post"<br/>
Introdu numarul :<input type="text" name="nr"/><br/>
<input type="submit" value="Testeaza"/>
</form>
</body>
action.jsp :
<%--
Document : action
Created on : Apr 27, 2013, 5:28:45 PM
Author : ARB
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<%-- start web service invocation --%><hr/>
<%
String add=request.getParameter("numar");
int aa=Integer.parseInt("add");
try {
mypack.ParImpar_Service service = new mypack.ParImpar_Service();
mypack.ParImpar port = service.getParImparPort();
// TODO initialize WS operation arguments here
int val=aa;
// TODO process result here
java.lang.String result = port.operation(aa);
out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
<%-- end web service invocation --%><hr/>
</body>
</html>
请帮我。谢谢 !