我需要使用自签名的可信证书,但在从 java 客户端建立连接时遇到问题。
我使用自签名证书/密码设置了信任库。
我遇到的问题是如何将 wsse 安全标头合并到 java Web 服务调用中。有人告诉我,在建立 ssl 连接后,我需要将此自签名证书包含在 soap 有效负载中。
我正在按如下方式设置 ConfigurationContext...如何在实际的 Web 服务调用中包含安全标头...请告知...谢谢 jim
System.setProperty("javax.net.ssl.keyStore", "c:\\cvp.keystore");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
ConfigurationContext ctx = getConfigurationContext(getMaxOutgoingConnections(appDir, getHostName(), LOBSB_TYPE));
String epLoc = getEndpointLocation(appDir, getHostName(), SERVICE_TYPE);
ListParticipantExport4_ListParticipantHttpServiceStub stub = new ListParticipantExport4_ListParticipantHttpServiceStub(ctx,epLoc);
/*
if (!setSecurityOptions(stub._getServiceClient())) {
throw new Exception("Error setting up security options!");
}
*/
int timeOut = getTimeout(appDir, getHostName(), SERVICE_TYPE);
if (timeOut > 0) {
//Only set the timeout value if greater
//than zero!
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(timeOut);
}
ListParticipantDocument doc = ListParticipantDocument.Factory.newInstance();
ListParticipant part = ListParticipant.Factory.newInstance();
ListParticipantRequest req = ListParticipantRequest.Factory.newInstance();
ServiceAttributesType saType = ServiceAttributesType.Factory.newInstance();
saType.setApplicationIdentifier("IVR");
saType.setLogLevel(ServiceAttributesType.LogLevel.ERRORS);
saType.setVersion("1.0");
req.setServiceAttributes(saType);
ParticipantSelection partSel = ParticipantSelection.Factory.newInstance();
partSel.setAccountHolderSSN(accountHolderSSN);
req.setParticipantSelection(partSel);
part.setListParticipantRequest(req);
doc.setListParticipant(part);
long startTime = System.currentTimeMillis();
sharedlib.listparticipant_v3.ListParticipantResponseDocument respDoc = stub.listParticipant(doc);
long endTime = System.currentTimeMillis();
respTime = (endTime-startTime);
ResponseReturnStatusType retStatus = respDoc.getListParticipantResponse().getListParticipantResponse().getResponseReturnStatus();
returnCode = retStatus.getResponseReturnCode().getCode();
returnCodeName = retStatus.getResponseReturnCode().getCodeName();