我仍然认为自己是 Java Web 服务的新手,并且遇到了我无法克服的真正障碍。
我正在尝试部署@Stateless
Web 服务并通过 https 访问它的 WSDL。每当我尝试访问它时,我都会在浏览器中收到以下错误:
Error generating artifacts for the following WSDL https://localhost:8181/TestService/Test?WSDL
Possible causes can be invoking https when the application is not configured for security
控制台显示以下错误:
INFO: parsing WSDL...
WARNING: Invalid request scheme for Endpoint Test. Expected http . Received https
INFO: [ERROR] Premature end of file.
INFO: line 1 of https://localhost:8181/TestService/Test?WSDL
WARNING: Invalid request scheme for Endpoint Test. Expected http . Received https
WARNING: MEX0008:Failed to parse metadata returned from server at https://localhost:8181/TestService/Test?WSDL using protocol SOAP_1_2. Continuing attempts.
WARNING: Invalid request scheme for Endpoint Test. Expected http . Received https
WARNING: MEX0008:Failed to parse metadata returned from server at https://localhost:8181/TestService/Test?WSDL using protocol SOAP_1_1. Continuing attempts.
WARNING: Invalid request scheme for Endpoint Test. Expected http . Received https
WARNING: MEX0008:Failed to parse metadata returned from server at https://localhost:8181/TestService/Test?WSDL/mex using protocol SOAP_1_2. Continuing attempts.
WARNING: Invalid request scheme for Endpoint Test. Expected http . Received https
WARNING: MEX0008:Failed to parse metadata returned from server at https://localhost:8181/TestService/Test?WSDL/mex using protocol SOAP_1_1. Continuing attempts.
INFO: [ERROR] Premature end of file.
Failed to read the WSDL document: https://localhost:8181/TestService/Test?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
INFO: [ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
INFO: Failed to parse the WSDL.
INFO: Invoking wsimport with https://localhost:8181/TestService/Test?WSDL
SEVERE: wsimport failed
同样,这仅在通过 HTTPS 访问时才会发生。常规的 HTTP 很好。但是,如果我要删除@Stateless
注释,它可以在 https 上正常工作。@Stateless
添加注释时失败。
我需要@Stateless
注释,因为我将使用 JMS 队列,这样做时您需要它。
下面是我的课的代码:
package service.test;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
@Stateless
@WebService
public class Test
{
public String hello()
{
return "Hello!";
}
@WebMethod
public int addNumbers(int number1, int number2)
{
return number1 + number2;
}
}
到目前为止,我从来不需要使用任何网络描述符。默认情况下,我所做的一切都在 Eclipse 中自动处理。我必须对描述符文件做任何特别的事情吗?如果有,有哪些?
谢谢你