source: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3ServicesAPIA.java@ 21835

Last change on this file since 21835 was 21835, checked in by ak19, 14 years ago

Browse takes a list of classifierIDs, not a single one.

File size: 24.9 KB
Line 
1/**
2 *#########################################################################
3 * GS3ServicesAPIA.java - part of the demo-client for Greenstone 3, of the
4 * Greenstone digital library suite from the New Zealand Digital Library
5 * Project at the * University of Waikato, New Zealand.
6 * <BR><BR>
7 * Copyright (C) 2008 New Zealand Digital Library Project
8 * <BR><BR>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 * <BR><BR>
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *########################################################################
19 */
20
21package org.greenstone.gs3client.dlservices;
22
23import javax.swing.JOptionPane;
24
25import java.util.HashMap;
26import java.util.Map;
27
28import java.io.IOException;
29import java.net.MalformedURLException;
30import javax.xml.parsers.ParserConfigurationException;
31import javax.xml.rpc.ServiceException;
32import org.xml.sax.SAXException;
33
34import org.greenstone.gs3client.data.DocumentNodeData;
35
36import org.apache.log4j.Logger; //Import log4j classes
37import java.util.Properties;
38
39/**
40 * GS3ServicesAPIA does two things:
41 * - it implements DigitalLibraryServicesAPIA for enabling the Java-client
42 * to access Greenstone's repository of collections and documents. It
43 * makes this possible through use of Greenstone 3's web services.
44 * - it inherits from GS3WebServicesQBRAPI, which means it inherits all the
45 * methods that deal with invoking the Greenstone 3 web services
46 * functionality (through use of Apache Axis' Service and Call objects).
47 * It therefore provides an equivalent method to each Greenstone 3 web
48 * service operation, even if some of these web service operations are
49 * never called by the Java-client and therefore not prescribed by the
50 * DigitalLibraryServicesAPIA interface.
51 * @author ak19
52*/
53public class GS3ServicesAPIA extends GS3WebServicesQBRAPI
54 implements DigitalLibraryServicesAPIA
55{
56 /** The Logger for this class */
57 static Logger LOG = Logger.getLogger(GS3ServicesAPIA.class);
58
59 /** Storing language settings for requests and responses*/
60 protected String language;
61
62 /** Displays a dialog to get user input for the location of the Greenstone 3
63 * web services' WSDL file */
64 public GS3ServicesAPIA()
65 throws ServiceException, MalformedURLException,
66 ParserConfigurationException, IOException, Exception
67 {
68 this(showWsdlInputDialog());
69 }
70
71 /** GS3ServicesAPIA constructor, which, given the url to the wsdl file,
72 * finds either service and port or the service's endpoint of the GS3 Web
73 * Services and instantiates the associated Service and Call objects.
74 * @param wsdlURLName - location of the WSDL for Greenstone 3's
75 * web services */
76 public GS3ServicesAPIA(String wsdlURLName)
77 throws ServiceException, MalformedURLException,
78 ParserConfigurationException, IOException, SAXException
79 {
80 super(wsdlURLName);
81 // Very important to initialise member language to some value, in
82 // this case, it is set to "" (which Greenstone takes as English).
83 this.language = "";
84 }
85
86 /** Static method that displays a dialog requesting the user to
87 * input the location of Greenstone 3 web services' WSDL file.
88 * @return a String representing the URL location of Greenstone 3 web
89 * services' WSDL file */
90 public static String showWsdlInputDialog()
91 throws Exception
92 {
93 String wsdlURL = "";
94 Properties properties = new Properties();
95
96 // set default values from any properties file
97 try {
98 if(DigitalLibraryServicesAPIA.propertiesFile.exists()) {
99 properties.load(new java.io.FileInputStream(
100 DigitalLibraryServicesAPIA.propertiesFile));
101 }
102 } catch(Exception e) {
103 LOG.warn("Exception loading properties from file "
104 + DigitalLibraryServicesAPIA.propertiesFile
105 + ": " + e);
106 }
107
108 // Show the dialog and get input for the wsdlURL property
109 // It will display GS3WebServicesQBRAPI.defaultWsdlURL in the input
110 // field if it can not find a wsdlURL property in the propertiesFile
111 wsdlURL = JOptionPane.showInputDialog(
112 "Enter the URL of the wsdl file of GS3's QBRSOAPServer web services",
113 properties.getProperty("wsdlURL", GS3WebServicesQBRAPI.defaultWsdlURL)
114 );
115 if(wsdlURL == null) { // cancel pressed
116 throw new CancelException(
117 "User cancelled out of connecting to GS3 Web Services");
118 } else { // if ok clicked, update properties with the input value
119 properties.setProperty("wsdlURL", wsdlURL);
120 }
121
122 // Store the user-entered URL for future use, so it is loaded next time
123 try {
124 java.io.FileOutputStream out = new java.io.FileOutputStream(
125 DigitalLibraryServicesAPIA.propertiesFile);
126 properties.store(out, "GS3ServicesAPIA");
127 out.close();
128 } catch(Exception e) {
129 LOG.warn("Exception writing properties to file "
130 + DigitalLibraryServicesAPIA.propertiesFile
131 + ": " + e);
132 }
133 return wsdlURL;
134 }
135
136 //************DigitalLibraryServicesAPIA METHOD IMPLEMENTATIONS************//
137 /** @return the name of this digital library for displaying in the client */
138 public String getDisplayName() {
139 return "Greenstone3";
140 }
141
142 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
143 * contract.
144 * Sets the preferred language (code) for metadata and other content to be
145 * returned on request messages. If the preferred language is not available,
146 * the implementation may choose to send English back instead, or failing
147 * that, send the data in any other available language.
148 * @param language has to be a language code as recognised by Greenstone3
149 * (the language codes used by W3C probably). E.g. "en" for English. */
150 public void setLanguage(String language) { this.language = language; }
151
152 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
153 * contract.
154 * Gets the language that's set as the preferred language.
155 * @return the language code as recognised by Greenstone3 (which are the
156 * language codes used by W3C probably). E.g. "en" for English. */
157 public String getLanguage() { return language; }
158
159 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
160 * contract.
161 * @return the overall directory path for associated files (not including
162 * the document's nodeID/pid). This can be used to *formulate* the base url
163 * of JEditorPane's HTML documents. If the documents from any digital library
164 * do not contain relative paths, or otherwise deal with the resolution of
165 * relative urls themselves, then return "" from here. */
166 public String getAssocFileBaseURL() { return ""; }
167
168 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
169 * contract.
170 * @return the directory path to the associated files of the given document
171 * node. For instance, the base url of a JEditorPane's HTML documents can be
172 * set to this. */
173 public String getAssocFileBaseURL(DocumentNodeData docNode) {
174 return "_httpdocimg_/"; // for now.
175 // TODO:
176 /*DocumentNodeData root = docNode.getRoot();
177 if(root != null)
178 return root.getAssocFilePath();
179 else return "";*/
180 }
181
182 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
183 * contract
184 * @return Greenstone3 XML describe response message originating from
185 * the Message Router, describing the Collections, ServiceRacks
186 * and Services supported by the Message Router for all collections. */
187 public String describe() {
188 return this.describe(language, "");
189 }
190
191 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
192 * contract.
193 * @param collection is the name of the collection to be described.
194 * @return Greenstone3 XML describe response message originating from a
195 * collection, describing the collection (display items) as well as
196 * listing any services supported specifically by the collection.
197 */
198 public String describeCollection(String collection) {
199 return this.describeCollection(collection, language, "");
200 }
201
202 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
203 * contract.
204 * @param collection is the name of the collection to be described.
205 * @param service is the name of the collection's service to be described.
206 * @return Greenstone3 XML describe response message originating from a
207 * collection's service, describing the service (display items).
208 */
209 public String describeCollectionService(String collection, String service) {
210 return this.describeCollectionService(collection, service, language, "");
211 }
212
213 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
214 * contract.
215 * @param service is the name of the collection's service to be described.
216 * @return Greenstone3 XML describe response message originating from a
217 * general (non-collection specific) service, describing the requested
218 * service (for example with GS3 display items).
219 */
220 public String describeService(String service) {
221 return this.describeService(service, language, "");
222 }
223
224 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
225 * contract.
226 * @param collection is the name of the collection.
227 * @param docIDs is an array of document identifiers of documents whose (text)
228 * contents are requested.
229 * @return a String representing Greenstone3 DocumentContentRetrieve XML
230 * containing the document contents of the documents indicated by docIDs
231 */
232 public String retrieveDocumentContent(String collection, String[] docIDs) {
233 return this.retrieveDocumentContent(collection, language, docIDs);
234 }
235
236 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
237 * contract.
238 * @param collection is the name of the collection.
239 * @param docID is the document identifier of the document whose (text)
240 * content is requested.
241 * @return a String representing Greenstone3 DocumentContentRetrieve XML
242 * containing the document contents of the document indicated by docID
243 */
244 public String retrieveDocumentContent(String collection, String docID) {
245 return this.retrieveDocumentContent(collection, language,
246 new String[]{ docID });
247 }
248
249 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
250 * contract.
251 * @param collection is the name of the collection.
252 * @param docIDs is an array of document identifiers of documents whose
253 * metadata is requested.
254 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
255 * containing all the metadata of all the documents indicated by docIDs
256 */
257 public String retrieveDocumentMetadata(String collection, String[] docIDs) {
258 return this.retrieveAllDocumentMetadata(collection, language, docIDs);
259 }
260
261 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
262 * contract.
263 * @param collection is the name of the collection.
264 * @param docID is the document identifier of the document whose metadata is
265 * requested.
266 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
267 * containing all the metadata of the document denoted by docID
268 */
269 public String retrieveDocumentMetadata(String collection, String docID) {
270 return this.retrieveAllDocumentMetadata(collection, language,
271 new String[] { docID });
272 }
273
274 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
275 * contract.
276 * @param collection is the name of the collection.
277 * @param docIDs is an array of document identifiers of documents whose titles
278 * are requested
279 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
280 * containing only the title metadata of the documents denoted by docIDs
281 */
282 public String retrieveTitleMetadata(String collection, String[] docIDs) {
283 final String[] titleMetaName = {"Title"};
284 return this.retrieveDocumentMetadata(collection, language, docIDs,
285 titleMetaName);
286 }
287
288 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
289 * contract.
290 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
291 * containing only the title metadata of the document denoted by docID
292 * @param collection is the name of the collection
293 * @param docID is the document identifier of the document whose titles is
294 * requested */
295 public String retrieveTitleMetadata(String collection, String docID) {
296 final String[] titleMetaName = {"Title"};
297 return this.retrieveDocumentMetadata(collection, language,
298 new String[] { docID }, titleMetaName);
299 }
300
301 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
302 * contract.
303 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
304 * containing the document structure of the documents indicated by docIDs:
305 * this means all their descendants
306 * @param collection is the name of the collection
307 * @param docIDs is an array of document identifiers of documents whose
308 * hierarchical structures are requested */
309 public String retrieveDocumentStructure(String collection, String[] docIDs) {
310 return this.retrieveEntireDocumentStructure(collection, language, docIDs);
311 }
312 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
313 * contract.
314 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
315 * containing the document structure of the document indicated by docID:
316 * this means all its descendants
317 * @param collection is the name of the collection
318 * @param docID is the document identifier of the document whose hierarchical
319 * structure is requested*/
320 public String retrieveDocumentStructure(String collection, String docID) {
321 return this.retrieveEntireDocumentStructure(collection, language,
322 new String[] { docID });
323 }
324
325 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
326 * contract.
327 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
328 * containing a view of the document structure of the documents denoted by
329 * docs where only the requested documents and their direct children are
330 * returned.
331 * @param collection is the name of the collection
332 * @param docIDs is an array of document identifiers of documents whose
333 * hierarchical structures are requested */
334 public String retrieveDocumentChildren(String collection, String[] docIDs) {
335 return this.retrieveDocumentStructure(collection, collection, docIDs,
336 new String[] { "children" }, null);
337 }
338
339 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
340 * contract.
341 * @return a String representing Greenstone3 DocumentMetadataRetrieve XML
342 * containing a view of the document structure of the document denoted by
343 * docID where only the document and its direct children are returned.
344 * @param collection is the name of the collection
345 * @param docID is the document identifier of the document whose hierarchical
346 * structure is requested */
347 public String retrieveDocumentChildren(String collection, String docID) {
348 return this.retrieveDocumentStructure(collection, collection,
349 new String[] { docID }, new String[] { "children" }, null);
350 }
351
352 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
353 * contract.
354 * @return a String representing Greenstone3 ClassifierBrowse XML
355 * giving the entire *structure* of the classification denoted by
356 * classifierID (including the structures of document descendants of
357 * the classifier).
358 * @param classifierIDs - each ID is of the form CL# where the number (#)
359 * marks out structured sections like CL1.1.3 or CL2
360 * @param collection is the name of the collection
361 * @param service is the name of the browse service (=ClassifierBrowse usually)
362 */
363 public String retrieveBrowseStructure(
364 String collection, String service, String[] classifierIDs)
365 {
366 return this.browseDescendants(collection, service,
367 language, classifierIDs );
368 }
369
370 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
371 * contract.
372 * @return a String representing Greenstone3
373 * ClassifierBrowseMetadataRetrieve XML giving all the metadata for
374 * all the subclassifiers denoted by nodeIDs.
375 * @param nodeIDs is of the form CL#.# where the number (#) marks
376 * out structured sections like CL2.1.3. NodeIDs are generally subsections
377 * of top-level classifierNodes (CL#, e.g. CL3).
378 * @param collection is the name of the collection
379 * @param service is the name of the Browse's MetadataRetrieve service
380 * (usually the browse service is ClassifierBrowse, in which case it always
381 * has a retrieve service called ClassifierBrowseMetadataRetrieve) */
382 public String retrieveBrowseMetadata(
383 String collection, String service, String[] nodeIDs)
384 {
385 return this.retrieveAllBrowseMetadata(collection, service,
386 language, nodeIDs);
387 }
388
389 /** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface
390 * contract.
391 * @return a String representing Greenstone3 XML for a query process
392 * response returning the results for the query denoted by parameter
393 * nameValParamsMap.
394 * @param nameValParamsMap is a Map of name and value pairs for all the
395 * query field data values. The names match the field names that
396 * describeCollectionService() would have returned for the query service.
397 * @param collection is the name of the collection
398 * @param service is the name of the query service
399 */
400 public String query(String collection, String service, Map nameValParamsMap)
401 {
402 return this.query(collection, service, language, nameValParamsMap);
403 }
404
405 /*public static void main(String args[]) {
406 try{
407 GS3ServicesAPIA ws = new GS3ServicesAPIA();
408
409 // (1) trying 4 describe methods
410 System.out.println(ws.describe("", ""));
411 System.out.println(ws.describeCollectionOrServiceRack("gs2mgppdemo", "", ""));
412 System.out.println(ws.describeCollectionService("gs2mgppdemo", "AdvancedFieldQuery", "", ""));
413 System.out.println(ws.describeService("AddItem", "", ""));
414
415
416 // (2) try 3 query methods (simplerFieldQuery twice) + getFieldNameMappings()
417 Map map = new HashMap();
418 map.put("maxDocs", "100");
419 map.put("level", "Sec");
420 map.put("accent", "1");
421 map.put("matchMode", "some");
422 map.put("fqf", "ZZ,ZZ,ZZ,ZZ");
423 map.put("case", "1");
424 map.put("sortBy", "1");
425 map.put("fqv", "snail,water,,");
426
427 String response = ws.query("gs2mgppdemo", "FieldQuery", "", map);
428 System.out.println("Regular query: " + response);
429
430 System.out.println("Field mappings: " + ws.getFieldNameMappings());
431 response = ws.simplerFieldNameQuery(
432 "gs2mgppdemo", "FieldQuery", "", map);
433 System.out.println("response:\n" + response);
434
435 // trying the same with special field names
436 map.clear();
437
438 map.put("maxDocs", "100");
439 map.put("level", "Sec");
440 map.put("accent", "on");
441 map.put("matchMode", "some");
442 map.put("fields", "all fields,all fields,all fields,all fields");
443 map.put("case", "on");
444 map.put("sortBy", "on");
445 map.put("values", "snail,water,,");
446
447 response = ws.simplerFieldNameQuery(
448 "gs2mgppdemo", "FieldQuery", "", map);
449 System.out.println("response:\n" + response);
450
451 // trying query - array version
452 String[] names = {"maxDocs", "level", "accent", "matchMode", "fqf",
453 "case", "sortBy", "fqv"};
454 String[] values = {"100", "Sec", "1", "some", "ZZ,ZZ,ZZ,ZZ",
455 "1", "1", "snail,water,,"};
456 System.out.println(ws.query("gs2mgppdemo", "FieldQuery", "", names, values));
457
458
459 // (3) try 2 browse
460 System.out.println("describe browse:\n"
461 + ws.describeCollectionService("gs2mgppdemo", "ClassifierBrowse", "", ""));
462
463 System.out.println("browse children of CL1-CL4:\n" +
464 ws.browse("gs2mgppdemo", "ClassifierBrowse", "",
465 new String[]{"CL1", "CL2", "CL3", "CL4"}, new String[]{"children"}));
466
467 System.out.println("browse descendants of CL2.3:\n" +
468 ws.browseDescendants("gs2mgppdemo", "ClassifierBrowse", "",
469 new String[]{"CL2.3"}));
470
471
472 // (4) try 2 DocStructure
473 System.out.println("retrieve ancestors and children structure of HASH016193b2847874f3c956d22e.4:\n" +
474 ws.retrieveDocumentStructure("gs2mgppdemo", "",
475 new String[]{"HASH016193b2847874f3c956d22e.4"},
476 new String[]{"ancestors", "children"}, new String[]{"numSiblings"}));
477
478
479 System.out.println("retrieve entire structure of HASH016193b2847874f3c956d22e.4.1:\n" +
480 ws.retrieveEntireDocumentStructure(
481 "gs2mgppdemo", "", new String[]{"HASH016193b2847874f3c956d22e.4.1"}));
482
483
484 // (5) try the 1 DocumentContent retrieve
485 System.out.println("retrieve content of HASH016193b2847874f3c956d22e.4:\n" +
486 ws.retrieveDocumentContent("gs2mgppdemo", "",
487 new String[]{"HASH016193b2847874f3c956d22e.4", "HASH016193b2847874f3c956d22e.4.1",
488 "HASH016193b2847874f3c956d22e.4.2"}));
489
490
491 // (6) try 2 DocumentMeta
492 System.out.println("retrieve title meta of HASH016193b2847874f3c956d22e.4 children:\n" +
493 ws.retrieveDocumentMetadata("gs2mgppdemo", "",
494 new String[]{"HASH016193b2847874f3c956d22e.4.1", "HASH016193b2847874f3c956d22e.4.2",
495 "HASH016193b2847874f3c956d22e.4.3"}, new String[]{"Title"}));
496
497 System.out.println("retrieve all meta of HASH016193b2847874f3c956d22e.4 children:\n" +
498 ws.retrieveAllDocumentMetadata("gs2mgppdemo", "",
499 new String[]{"HASH016193b2847874f3c956d22e.4",
500 "HASH016193b2847874f3c956d22e.4.1", "HASH016193b2847874f3c956d22e.4.2",
501 "HASH016193b2847874f3c956d22e.4.3"}));
502
503 // (7) try 2 BrowseMeta
504 System.out.println("retrieve all browse meta of CL1, CL2, CL2.1, CL3:\n" +
505 ws.retrieveAllBrowseMetadata("gs2mgppdemo", "", "",
506 new String[]{"CL1", "CL2",
507 "CL2.1", "CL3"}));
508
509 System.out.println("retrieve Title, hastxt browse meta of CL1, CL2, CL2.1, CL3:\n" +
510 ws.retrieveBrowseMetadata("gs2mgppdemo", "", "",
511 new String[]{"CL1", "CL2","CL2.1", "CL3"}, new String[]{"Title", "hastxt"}));
512
513 // (8) try process:
514 String requestXMLMessage = "<message>"
515 + "<request lang='' to='gs2mgppdemo/ClassifierBrowseMetadataRetrieve' type='process' uid=''>"
516 + "<paramList>" + "<param name='metadata' value='Title' />"
517 + "<param name='metadata' value='hastxt' /></paramList>"
518 + "<classifierNodeList><classifierNode nodeID='CL1' /><classifierNode nodeID='CL2' />"
519 + "<classifierNode nodeID='CL2.1' /><classifierNode nodeID='CL3' /></classifierNodeList>"
520 + "</request></message>";
521 System.out.println(ws.process(requestXMLMessage));
522
523
524 // (9) activate, deactivate and the 2 reconfigures
525 System.out.println("activate:\n" + ws.activate("collection", "gs2mgppdemo"));
526 System.out.println("deactivate:\n" + ws.deactivate("site", "site1"));
527 System.out.println("configure MR:\n" + ws.reconfigure());
528 System.out.println("configure:\n" + ws.reconfigure("collectionList"));
529
530 // (10) 1 format
531 System.out.println("format:\n" + ws.format("gs2mgppdemo", "FieldQuery", ""));
532
533 // (11) 2 processType: build/NewCollection, build/ImportCollection
534 System.out.println("describe build/NewCollection:\n"
535 + ws.describeService("build/NewCollection", "", ""));
536
537 Map params = new HashMap(10);
538 params.put("creator", "me@home");
539 params.put("collName", "the demo collection");
540 params.put("collShortName", "demo");
541
542 System.out.println("processType build/NewCollection:\n"
543 + ws.processTypeService("build/NewCollection", "", params));
544
545 params.clear();
546 params.put("collection", "demo");
547 System.out.println("processType build/ImportCollection:\n"
548 + ws.processTypeService("build/ImportCollection", "", params));
549
550 // (12) Test status(), if possible
551 System.out.println("status:\n" + ws.status("build/NewCollection", "", "1"));
552
553
554 // (13) One applet-type service:
555 //Map params = new HashMap(10);
556 params.clear();
557 params.put("pc", "1");
558 params.put("pptext", "health");
559 params.put("pfe", "0");
560 params.put("ple", "10");
561 params.put("pfd", "0");
562 params.put("pld", "10");
563 params.put("pfl", "0");
564 params.put("pll", "10");
565 System.out.println("appletTypeService:\n"
566 + ws.appletTypeService("gs2mgppdemo", "PhindApplet", "query", params));
567 // no PhindApplet service deployed in gs2mgppdemo anymore, so maybe that's
568 // why it doesn't work. The request matches what's in the manual (p.50) though.
569
570
571 // (14) One enrich service:
572 params.clear();
573 params.put("annotationType", "Date,Location");
574 String[] nodeIDs = {"HASHac0a04dd14571c60d7fbfd"};
575 String[] nodeContents = { "FOOD AND AGRICULTURE ORGANIZATION OF THE UNITED NATIONS\n"
576 + "Rome 1986\nP-69\nISBN 92-5-102397-2\nFAO 1986"};
577 System.out.println("enrich:\n"
578 + ws.enrich("GatePOSTag", "en", params, nodeIDs, nodeContents));
579 // no GatePOSTag service deployed in gs2mgppdemo anymore, so maybe that's
580 // why it doesn't work. The request matches what's in the manual (p.50) though.
581
582 // (16) try help
583 System.out.println(ws.help());
584 System.out.println(ws.help("describe"));
585
586 }catch(Exception e) {
587 System.out.println("Problem accessing service\n" + e.getMessage());
588 e.printStackTrace();
589 }
590 }*/
591}
Note: See TracBrowser for help on using the repository browser.