Editing the client
The service creation process generates a client class which may be used to communicate with the new data service. For convenience in testing, the client class contains a main method which can be edited to invoke the service. To do this, some code will be added to the CaGridTutorialServiceClient.java file to query the data service and output the results for verification.
- Open the file CaGridTutorialServiceClient.java located in the folder *C:\CaGridTutorialService\src\gov\nih\nci\cagrid\tutorial\client* for editing.
- The main method has a comment indicating where code may be added for testing purposes:
// place client calls here if you want to use this main as a test....
At this point, enter the following code:
gov.nih.nci.cagrid.cqlquery.CQLQuery query = new gov.nih.nci.cagrid.cqlquery.CQLQuery(); gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object(); target.setName(gov.nih.nci.cabio.domain.Gene.class.getName()); gov.nih.nci.cagrid.cqlquery.Attribute att = new gov.nih.nci.cagrid.cqlquery.Attribute(); att.setName("symbol"); att.setValue("BRCA%"); att.setPredicate(gov.nih.nci.cagrid.cqlquery.Predicate.LIKE); target.setAttribute(att); query.setTarget(target); gov.nih.nci.cagrid.cqlresultset.CQLQueryResults results = client.query(query); java.util.Iterator iter = new gov.nih.nci.cagrid.data.utilities.CQLQueryResultsIterator(results, CaGridTutorialServiceClient.class.getResourceAsStream("client-config.wsdd")); while (iter.hasNext()) { Object o = iter.next(); System.out.println(((gov.nih.nci.cabio.domain.Gene) o).getFullName()); } System.out.println("Query Complete.");
Save the edited client class file.





