必须了解 UT 安全服务检查失败

Must Understand check Failed for UT secured Service

我在 WSO2 AS 5 上部署了一个 axis2 服务,我已经使用服务器使用 UT 基本身份验证对其进行了保护。我想用 Axis 客户端调用该服务。我生成了存根并尝试了这个,

        String trustStore = "/home/dumidu/wso2carbon.jks";
        System.setProperty("javax.net.ssl.trustStore",  trustStore );
        System.setProperty("javax.net.ssl.trustStorePassword", "test123");

        HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator();
        basicAuthentication.setUsername("admin");
        basicAuthentication.setPassword("admin");

        OrderProcessorStub ordPros = new OrderProcessorStub();
        ordPros._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication);                       
        OrderProcessorStub.GetOrder req = new OrderProcessorStub.GetOrder();
        req.setOrdID(1);

        OrderProcessorStub.GetOrderResponse resp = ordPros.getOrder(req);
        System.out.println("resp \t"+resp.get_return());

我在客户端收到此错误,

INFO: basic authentication scheme selected Apr 30, 2015 6:02:58 PM org.apache.axis2.engine.AxisEngine receive SEVERE: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security org.apache.axis2.AxisFault: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security at org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:105) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:171) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) .... ....

这在服务器上,

[2015-04-30 18:02:58,250] ERROR - AxisEngine System error org.apache.axis2.AxisFault: System error at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:303) at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340) at org.apache.axis2.engine.Phase.invoke(Phase.java:313) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146) at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) .... ....

我在这里做错了什么?我如何为 WSO2 AS 中使用 UT 保护的服务编写轴客户端?提前致谢。

根据您的错误,这似乎是产品中的错误。在此 jira 中,它表示 POX 处理程序存在问题。WSO2AS 也使用相同的处理程序,这也一定是您出现问题的原因。在 jira 中它说 If client request does not include empty soap header, that conversion fails with following error。因此,作为一种解决方法,您可以尝试使用空 SOAP header.