I have an axis2 service deployed on WSO2 AS 5 which I've secured with UT basic auth using the server. I want to invoke the service with an Axis client. I generated the stub and tried this,
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());
Im getting this error on client side,
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) .... ....
and this on server,
[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) .... ....
what am i doing wrong here? how can i write an axis client for a service secured with UT in WSO2 AS? Thanks in advance.