我在WSO2 AS 5上部署了一个axis2服务,我使用服务器使用UT basic auth保护了该服务。我想用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:选择了基本身份验证方案 2015年4月30日下午6:02:58 org.apache.axis2.engine.AxisEngine收到 严重:必须理解标题http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd的检查失败:安全性 org.apache.axis2.AxisFault:必须理解标题http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd的检查失败:安全性 在org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:105) 在org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:171) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364) 在org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 在org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) .... ....
,这在服务器上,
[2015-04-30 18:02:58,250]错误 - AxisEngine系统错误 org.apache.axis2.AxisFault:系统错误 在org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:303) 在org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340) 在org.apache.axis2.engine.Phase.invoke(Phase.java:313) 在org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261) 在org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) 在org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146) 在org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:755) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:848) .... ....
我在这里做错了什么?如何在WSO2 AS中为UT保护的服务编写轴客户端?提前谢谢。
答案 0 :(得分:1)
根据您的错误,它似乎是产品中的错误。在这个jira中,它说POX处理程序存在问题.WSO2AS也使用相同的处理程序,它也必须是你的问题的原因。在jira,它说If client request does not include empty soap header, that conversion fails with following error
。因此,作为一种解决方法,您可以尝试使用空SOAP标头。