[greenstone-users] how to build Application which can search , get and manage the Object in GSDL remote

From Anupama of Greenstone Team
DateWed Apr 16 14:38:33 2008
Subject [greenstone-users] how to build Application which can search , get and manage the Object in GSDL remote
Attachments removed for greenstone-users mailing list.

Hello Feng Wang,
I am attaching several files. The first two are on:
1. How to write a client for the process web service
2. How to write a general purpose web service class (even though you
particularly would like information on how to write a client for
Greenstone 3's existing web service).


You asked:
1. Anupama, like you told to me that in the GSDL
http://localhost:8080/greenstone3/services has a WSDL Page for ?process?
method.
But it?s for the ?process? messages or for the ?process? services? You
know, there is a ?process? service in the ?process? message.

It is the process Message. That means you can send "describe", "query",
"retrieve" and all other requests that the Greenstone 3 MessageRouter can
handle to it (see the Greenstone 3 manual).


You rightly observed that Fedora has stub classes that make invoking its
web services easier and that its fedora-client.jar contains these stub
classes for us to use. Yes, Greenstone's current web service (process)
does not come with stub classes, which means that developers of client
applications have to do more work before they can invoke the service.
> > And the Fedora has a DEMO Java Code for the SOAP Implementation.
> > Can you give me some source code or advices for client Implementation,
if you have? Some demo-code like describe the repository. I just wanna
study and begin to write my program as fast as soon.

What I'll do is, next to those two Example text files that I intend to
attach, I will attach the relevant java files of my code with their
javadocs. The two java files are:
1. GS3WebServices.java: The class with the web services methods that I
have written.
The "configure" and "system" messages should work, but I need to ask
Katherine Don about the added web services which invoke build/NewDocument
and build/ImportCollection and why the MessageRouter's response at present
isn't as I anticipated.
2. GS3WebServicesAPI.java: The class on the client end that handles the
web service method invocations. This class is like the Fedora API-A class
that you use to access Fedora's web services.
Essentially, GS3WebServicesAPI.java is like a manually written stub class,
though one can generate a static stub class for the web services using the
Java WebServices Development Pack (JWSDP) I think.
I needed it to conform to my interface class and so wrote something
manually that could work with my client. But because I've more recently
split the class that does this client-side work into two, I think one of
the two can implement the interface class while the other can be an
auto-generated stub class. Therefore, thanks to the ideas in your email I
may now consider having it generated automatically as a static stub file
each time changes have been made to the web services class in Greenstone's
code repository. I believe something like this is what Fedora does as
well.

Just have a look at the files and ask me if there's something you don't
understand. I will attach the javadoc for the two files as well. Do bear
in mind that
- the functioning of the web service operation that maps the process
Service (not process message) in the web services class, which is meant to
be used to import and build new collections for instance, needs further
investigation and I would have to talk to Katherine for that.
- the help web service methods are not functional yet. I intend loading
help strings from a properties file that I already have somewhat prepared
but haven't formatted yet. This file usually contains the contents in the
javadoc. I have included it in the attachment (helpfile.txt).

What I suggest you could do after downloading the tar.gz attachment:
1. Read the two "Example-something" text files about how to write a web
service class and general web service client. Don't need to do anything
with it.
2. Take the code files and create an eclipse project and put them into
their proper package structure in there. Add the necessary jar files from
Greenstone into their build path to get them compiling. Also add all the
jar files they will complain about to get them running (Run
configuration).
3. There are main methods in both classes for you to test running them
with. I may have made some changes yesterday when trying to merge my web
services with Greenstone's existing SOAPServer<sitename>.java class, but I
think it should still work. Tell me if there is any problem.
4. First try running the main method of the web services class
GS3WebServices.java as a regular class. Then, using the information in the
Example2_CreatingWebServices.txt file, expose this class as a web service.
5. Now, try running the main method in the client-side API class
GS3WebServicesAPI.java.
6. Note how the client class merely returns XML responses as Strings. It's
obviously not as special as the Fedora API-A classes that return
ready-made data structures. Therefore, a Greenstone client has to either
do lots of parsing to create data structures to represent the response
data OR needs to parse out just the data it needs. To do this, my
demo-client code has a package containing the data structures it uses.
However, for now, just try reading the files above and getting the two
java files running.


Best of luck trying it all out. Regards,
Anupama


Hi,

I am glad that I could get so many advices from the developer team of
GSDL. And so
lucky got the answer about the SOAP.

Anupama, like you told to me that in the GSDL
http://localhost:8080/greenstone3/services has a WSDL Page for ?process?
method.
But it?s for the ?process? messages or for the ?process? services? You
know, there is a ?process? service in the ?process? message.

Do you know, whether the GSDL supports any messages without the WSDL
Information
except the ?process?? Like ?describe?, ?system?? type messages in the
Manual.pdf. There are important for my client program too. So I must know
it, hehe.

To write the remote Client Implementation for GSDL with SOAP is not so
easy like for
the Fedora Repository. The Fedora hat a Fedora-Client.jar, which has two
APIs for
accessing the managing the Fedora Repository including the SOAP. What I
should do is
just to call the method with the two APIs. And the Fedora has a DEMO Java
Code for
the SOAP Implementation.

I think for the GSDL, I must create the SOAP Stub and Connection, parse
the XML File
? all by myself. I am a Newbie for it. So I do need the help from you.
Can you
give me some source code or advices for client Implementation, if you
have? Some
demo-code like describe the repository. I just wanna study and begin to
write my
program as fast as soon.

Do you know how I can upload the Document remote to GSDL Service with SOAP
and
?Process?? And how does the workflow for the building a Document look
like? Like
the GLI with several different ?process? message?

Hope, that you can help me. Thank You!

Regards
Feng Wang