我有以下代码,我正在尝试使用 Apache CXF 通过 HTTPS 访问 Web 服务。但是,每当我的消息发出时,在我的代码超时之前,我什么也得不到。有人可以给我的代码一次,让我知道我是否做错了什么。我尝试通过 SoapUI 访问该服务,这很好,所以它一定是我的 CXF 代码中的某些内容,但我只是不知道是什么!
谢谢你的帮助
DepositImplService ss = new DepositImplService(WSDL_LOCATION,
SERVICE_NAME);
PortType port = ss.getPortTypePort();
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = conduit.getClient();
httpClientPolicy.setConnectionTimeout(30000);
httpClientPolicy.setReceiveTimeout(30000);
conduit.setClient(httpClientPolicy);
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setUserName("foo");
authPolicy.setPassword("bar");
conduit.setAuthorization(authPolicy);
TLSClientParameters parameters = new TLSClientParameters();
parameters.setSecureSocketProtocol("SSL");
conduit.setTlsClientParameters(parameters);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
UploadRequestT doc = new UploadRequestT();
BufferedReader reader = new BufferedReader(new FileReader(new File(
"C:\\rawmessage.txt")));
String documentStr = "";
String currLine = "";
while ((currLine = reader.readLine()) != null) {
documentStr += currLine;
}
doc.setDoc(documentStr);
doc.setOwner("43");
port.upload(doc);