我需要使用自签名的可信证书,但在从java客户端建立连接时遇到问题。
我使用自签名证书/ pw进行信任存储设置。
我遇到的问题是如何将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();