1

我仍然认为自己是 Java Web 服务的新手,并且遇到了我无法克服的真正障碍。

我正在尝试部署@StatelessWeb 服务并通过 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 中自动处理。我必须对描述符文件做任何特别的事情吗?如果有,有哪些?

谢谢你

4

3 回答 3

0

Https 默认使用 443 端口。如果您的网络服务正在侦听端口 8181,它将看不到 https 请求。

于 2012-06-28T20:40:34.573 回答
0

只是一个疯狂的猜测:您的信任库中是否有您的服务器证书颁发者?这可能是一个丑陋的 ssl 问题。(尽管它在没有@Stateless 的情况下工作的事实与我的理论相矛盾)

只是猜测...

于 2012-06-28T20:47:57.583 回答
0

这是一个奇怪的问题,我从来没有真正弄清楚原因。奇怪的是,这个问题最终通过不需要@Stateless.

于 2013-01-19T16:42:43.637 回答