Tomcat在SOAPFault上抛出500内部服务器错误

时间:2016-01-06 14:54:20

标签: java tomcat tomcat7 jax-ws

我正在使用JAX-WS进行SOAP Web服务。并实现了SOAPHandler来进行身份验证。成功验证后返回true,如果失败则抛出异常。

public boolean handleMessage(SOAPMessageContext context)
{
    SOAPMessage soapMessage = context.getMessage();
    if (authenticateUser(soapMessage)) {
        return true;
    } else {
        throw new RuntimeException("Authentication failed!");
    }
}

虽然身份验证失败,但我应该在SOAPFault之下。

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
         <faultcode>S:Server</faultcode>
         <faultstring>java.lang.Exception: Authentication failed!</faultstring>
      </S:Fault>
   </S:Body>
</S:Envelope>

这在开发世界(eclipse / tomcat7)中运行良好。 但不适合在生产环境中工作。在prod中它只返回500 - 内部服务器错误。

为什么会出现这种情况?

0 个答案:

没有答案