if (((X509Certificate) trustedcerts[i]).getBasicConstraints() != -1) {
trustcol.add(trustedcerts[i]);
}
}
XKMSInvoker xKMSInvoker = new XKMSInvoker(SERVICE_URL, trustcol);
// Test simple validate
ValidateRequestType validateRequestType = xKMSObjectFactory.createValidateRequestType();
validateRequestType.setId("200");
UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
useKeyWithType.setIdentifier("Test");
validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);
QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
validateRequestType.setQueryKeyBinding(queryKeyBindingType);
JAXBElement<ValidateRequestType> validateRequest = xKMSObjectFactory.createValidateRequest(validateRequestType);
Document doc = dbf.newDocumentBuilder().newDocument();
marshaller.marshal(validateRequest, doc);
try {
ValidateResultType validateResultType = xKMSInvoker.validate(validateRequestType, pkCert, key);
assertTrue(validateResultType.getRequestId().equals("200"));
assertTrue(validateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
} catch (javax.xml.ws.soap.SOAPFaultException e) {
log.debug("", e);
assertTrue("There was a server error. (" + e.getMessage() + ") Did you enable the XKMS CA service?", false);