问题是这样的:
怎样编写client端代码调用一个webservice, 这个WS是deploy在weblogic上的,重点是做了ws-policy配置(需要用户名,密码认证),他们只提供给了我们WSDL。
我做了下面这些,可还是调用失败,并且错误信息不明确,哪为高手指点下小女子。不知到是否还需要别的配置, rampart ?
新建了一个java项目,导入Axis2 (1.6.2) jar包。
xxxStub
xxxCallbackHandler
Client代码
// Create stub
xxxStub stub = new xxxStub();
// Set userName, password
HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator();
basicAuthentication.setUsername("***");
basicAuthentication.setPassword("***");
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication);
// Prepare input parameters
...
// Set parameters
...
// Invoke Services
GetReportResponse response = stub.getReport(parameters);
// Get result
... = response.getGetReportResult();
错误信息:
org.apache.axis2.AxisFault: Unknown exception, internal system processing error.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
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)
at ....xxxStub.getReportMetaData(xxxStub.java:200)