e.printStackTrace();
}
}
SearchService_Service ss = new SearchService_Service(wsdlURL, SERVICE_NAME);
SearchService port = ss.getSearch();
// Configure Turststore and KeyStore for SSL Client Authentication.
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
/*Set whether or not JSEE should omit checking if the host name
specified in the URL matches that of the Common Name (CN)
on the server's certificate. Default is false; this attribute
should not be set to true during production use*/
//tlsParams.setDisableCNCheck(true);
//CXF 2.1.3 will give IllegalExpection if you set portocal to SSL.
tlsParams.setSecureSocketProtocol("SSLv3");
//provide trust password
KeyStore keyStore = KeyStore.getInstance("JKS");
String trustpass = "REDACTED";
// provide your truststore file path
File truststore = new File(
"/usr/local/jdk1.5.0_06/jre/lib/security/cacerts");
keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(keyStore);
TrustManager[] tm = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tm);
// LabDc certs
//truststore = new File("/home/lakshmi/x509CRLLocation/LabDctestCert/untrusted.key"); // LabDc-untrusted
//truststore = new File("/home/lakshmi/x509CRLLocation/LabDctestCert/wrongcn.key"); //LabDc-wrongcn
//truststore = new File("/home/lakshmi/x509CRLLocation/LabDctestCert/expired.key"); //LabDc-expired
// provide your client store file path
truststore = new File("/home/lakshmi/x509CRLLocation/WijisServices.key");
keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyFactory.init(keyStore, trustpass.toCharArray());
KeyManager[] km = keyFactory.getKeyManagers();
tlsParams.setKeyManagers(km);
/*FiltersType filter = new FiltersType();
filter.getInclude().add(".*_EXPORT_.*");
filter.getInclude().add(".*_EXPORT1024_.*");
filter.getInclude().add(".*_WITH_DES_.*");
filter.getInclude().add(".*_WITH_NULL_.*");
filter.getExclude().add(".*_DH_anon_.*");
tlsParams.setCipherSuitesFilter(filter);//set all the needed include and exclude filters.*/
conduit.setTlsClientParameters(tlsParams);
{
System.out.println("Invoking recordRetrieval webservice...");
File retrieveRequestFile = new File(
"request-files/javaClient-requestFiles/recordRetrieval_request.xml");
Document retrieveRequestDocument = DomUtils
.getDocumentFromFile(retrieveRequestFile);
RecordRetrieval recordRetrieval = new RecordRetrieval();
recordRetrieval.setAny(retrieveRequestDocument.getDocumentElement());
try
{
RecordRetrievalResponse recordRetrievalResponse = port
.recordRetrieval(recordRetrieval);
if(recordRetrievalResponse != null)
{
Element retrieveReponseElement = (Element) recordRetrievalResponse.getAny();
System.out.println("RecordRetrieval result : "
+ DomUtils.getStringFromDocument(retrieveReponseElement
.getOwnerDocument()));
}
else
{
System.out.println("RecordRetrievalResponse returned is null");
}
}
catch (FatalRecordRetrievalFault e)
{
System.out.println("FatalFault exception: FatalFault has occurred.");
System.out.println(e.toString());
}
}
{
System.out.println("Invoking search webservice...");
File searchRequestFile = new File(
"request-files/javaClient-requestFiles/search_invocation.xml");
Document searchRequestDocument = DomUtils
.getDocumentFromFile(searchRequestFile);
Search search = new Search();
search.setAny(searchRequestDocument.getDocumentElement());
try
{
SearchResponse searchReponse = port.search(search);
if (searchReponse != null)
{
Element searchReponseElement = (Element) searchReponse.getAny();
System.out.println("Search result : "
+ DomUtils.getStringFromDocument(searchReponseElement