fedora.soapclient
Class FedoraAccessSoapServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by fedora.soapclient.FedoraAccessSoapServlet
All Implemented Interfaces:
Constants, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FedoraAccessSoapServlet
extends javax.servlet.http.HttpServlet
implements Constants

An example of a web-based client that provides a front end to the Fedora Access SOAP service. This servlet is designed to provide a "browser centric" view of the Fedora Access interface. Return types from the Fedora Access SOAP service are translated into a form suitable for viewing with a web browser; in other words MIME-typed streams. Applications that can readily handle SOAP requests and responses would most likely communicate directly with the Fedora Access SOAP service rather than use a java servlet as an intermediary. This servlet serves as an example of how to construct a client that uses the Fedora Access API via SOAP.

Input parameters for the servlet include:

Note that all servlet parameter names that are implementation specific end with the underscore character ("_"). This is done to avoid possible name clashes with user-supplied method parameter names. As a general rule, user-supplied parameters should never contain names that end with the underscore character to prevent possible name conflicts.

Example URLs

  1. GetDissemination URL syntax:

    protocol://hostname:port/soapclient/apia?action_=GetDissemination&PID_=pid&sDefPID_=sdefpid&methodName_=methodname[&asOfDateTime_=dateTime][?parmArray]

    This syntax requests a dissemination of the specified object using the specified method of the associated service definition object. The result is returned as a MIME-typed stream.

  2. GetDatastreamDissemination URL syntax:

    protocol://hostname:port/soapclient/apia?action=GetDatastreamDissemination&PID_=pid&dsID_=dsid[&asOfDateTime_=dateTime]

    This syntax requests a datastream dissemination for the specified digital object. It is used to return the contents of a datastream.

  3. GetObjectProfile URL syntax:

    protocol://hostname:port/soapclient/apia?action_=GetObjectProfile&PID_=pid[&asOfDateTime_=dateTime][&xml=boolean]

    This syntax requests an object profile for the specified digital object.

  4. GetObjectHistory URL syntax:

    protocol://hostname:port/soapclient/apia?action_=GetObjectHistory&PID_=pid[&xml_=boolean]

    This syntax requests an object history for the specified digital object.

  5. DescribeRepository URL syntax:

    protocol://hostname:port/soapclient/apia?action_=DescribeRepository[&xml_=boolean]

    This syntax requests an object profile for the specified digital object.

  6. ListDatastreams URL syntax:

    protocol://hostname:port/soapclient/apia?action_=ListDatastreams&PID_=pid[&asOfDateTime_=dateTime][&xml_=boolean]

    This syntax requests a list of datastreams for the specified digital object.

  7. ListMethods URL syntax:

    protocol://hostname:port/soapclient/apia?action_=ListMethods&PID_=pid[&asOfDateTime_=ateTime][xml_=boolean]

    This syntax requests a list of methods for the specified digital object.

Author:
Ross Wayland
See Also:
Serialized Form

Nested Class Summary
 class FedoraAccessSoapServlet.DatastreamDefSerializerThread
           A Thread to serialize a DatastreamDef object into XML.
 class FedoraAccessSoapServlet.ObjectHistorySerializerThread
           A Thread to serialize an ObjectHistory object into XML.
 class FedoraAccessSoapServlet.ObjectMethodDefSerializerThread
           A Thread to serialize an ObjectMethodDef object into XML.
 class FedoraAccessSoapServlet.ProfileSerializerThread
           A Thread to serialize an ObjectProfile object into XML.
 class FedoraAccessSoapServlet.ReposInfoSerializerThread
           A Thread to serialize a RepositoryInfo object into XML.
 
Nested classes/interfaces inherited from interface fedora.common.Constants
Constants.FedoraHome
 
Field Summary
 
Fields inherited from interface fedora.common.Constants
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM1_0, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, ENVIRONMENT, FCFG, FEDORA, FEDORA_HOME, FOXML, FOXML1_0, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, REPO_DESC1_0, RESOURCE, SDEF, SDEP, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XLINK, XML_XSD, XMLNS, XSI
 
Constructor Summary
FedoraAccessSoapServlet()
           
 
Method Summary
 RepositoryInfo describeRepository()
           Gets repository information for the server by invoking the appropriate Fedora Access SOAP service.
 void destroy()
           Cleans up servlet resources.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           Process Fedora Access Request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           For now, treat a HTTP POST request just like a GET request.
 FieldSearchResult findObjects(java.lang.String[] resultFields, int maxResults, FieldSearchQuery query)
           Lists the specified fields of each object matching the given criteria.
 MIMETypedStream getDatastreamDissemination(java.lang.String PID, java.lang.String dsID, java.lang.String asOfDateTime)
           
 MIMETypedStream getDissemination(java.lang.String PID, java.lang.String sDefPID, java.lang.String methodName, Property[] userParms, java.lang.String asOfDateTime)
           Gets a MIME-typed bytestream containing the result of a dissemination by invoking the appropriate Fedora Access SOAP service.
 java.lang.String[] getObjectHistory(java.lang.String PID)
           Gets a list of Service Definition object PIDs for the specified digital object by invoking the appropriate Fedora Access SOAP service.
 ObjectProfile getObjectProfile(java.lang.String PID, java.lang.String asOfDateTime)
           Gets a object profile for the specified object by invoking the appropriate Fedora Access SOAP service.
 void init()
           Initialize servlet.
 DatastreamDef[] listDatastreams(java.lang.String PID, java.lang.String asOfDateTime)
           Gets a list of all datastream for the specified object by invoking the appropriate Fedora Access SOAP service.
 ObjectMethodsDef[] listMethods(java.lang.String PID, java.lang.String asOfDateTime)
           Gets a list of all method definitions for the specified object by invoking the appropriate Fedora Access SOAP service.
 FieldSearchResult resumeFindObjects(java.lang.String sessionToken)
           Resumes an in-progress listing of object fields.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FedoraAccessSoapServlet

public FedoraAccessSoapServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException

Process Fedora Access Request. Parse and validate the servlet input parameters and then execute the specified request by calling the appropriate Fedora Access SOAP service.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request.
response - servlet The servlet response.
Throws:
javax.servlet.ServletException - If an error occurs that effects the servlet's basic operation.
java.io.IOException - If an error occurs with an input or output operation.

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException

For now, treat a HTTP POST request just like a GET request.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - The servet request.
response - The servlet response.
Throws:
javax.servlet.ServletException - If thrown by doGet.
java.io.IOException - If thrown by doGet.
javax.servlet.ServletException - If an error occurs that effects the servlet's basic operation.

getObjectHistory

public java.lang.String[] getObjectHistory(java.lang.String PID)
                                    throws java.lang.Exception

Gets a list of Service Definition object PIDs for the specified digital object by invoking the appropriate Fedora Access SOAP service.

Parameters:
PID - The persistent identifier of the digital object.
Returns:
An array of timestamps indicating when an object component changed.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

getDissemination

public MIMETypedStream getDissemination(java.lang.String PID,
                                        java.lang.String sDefPID,
                                        java.lang.String methodName,
                                        Property[] userParms,
                                        java.lang.String asOfDateTime)
                                 throws java.lang.Exception

Gets a MIME-typed bytestream containing the result of a dissemination by invoking the appropriate Fedora Access SOAP service.

Parameters:
PID - The persistent identifier of the digital object.
sDefPID - The persistent identifier of the Service Definition object.
methodName - The name of the method.
asOfDateTime - The version datetime stamp of the digital object.
userParms - An array of user-supplied method parameters and values.
Returns:
A MIME-typed stream containing the dissemination result.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

getDatastreamDissemination

public MIMETypedStream getDatastreamDissemination(java.lang.String PID,
                                                  java.lang.String dsID,
                                                  java.lang.String asOfDateTime)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

listMethods

public ObjectMethodsDef[] listMethods(java.lang.String PID,
                                      java.lang.String asOfDateTime)
                               throws java.lang.Exception

Gets a list of all method definitions for the specified object by invoking the appropriate Fedora Access SOAP service.

Parameters:
PID - The persistent identifier for the digital object.
asOfDateTime - The versioning datetime stamp.
Returns:
An array of object method definitions.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

listDatastreams

public DatastreamDef[] listDatastreams(java.lang.String PID,
                                       java.lang.String asOfDateTime)
                                throws java.lang.Exception

Gets a list of all datastream for the specified object by invoking the appropriate Fedora Access SOAP service.

Parameters:
PID - The persistent identifier of the digital object.
asOfDateTime - The versioning datetime stamp.
Returns:
An array of datastream definitions.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

getObjectProfile

public ObjectProfile getObjectProfile(java.lang.String PID,
                                      java.lang.String asOfDateTime)
                               throws java.lang.Exception

Gets a object profile for the specified object by invoking the appropriate Fedora Access SOAP service.

Parameters:
PID - The persistent identifier for the digital object.
asOfDateTime - The versioning datetime stamp.
Returns:
An object profile data structure.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

describeRepository

public RepositoryInfo describeRepository()
                                  throws java.lang.Exception

Gets repository information for the server by invoking the appropriate Fedora Access SOAP service.

Returns:
A repository information data structure.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

findObjects

public FieldSearchResult findObjects(java.lang.String[] resultFields,
                                     int maxResults,
                                     FieldSearchQuery query)
                              throws java.lang.Exception

Lists the specified fields of each object matching the given criteria.

Parameters:
resultFields - the names of the fields to return
maxResults - the maximum number of results to return at a time
query - the query
Returns:
the specified fields of each object matching the given criteria.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

resumeFindObjects

public FieldSearchResult resumeFindObjects(java.lang.String sessionToken)
                                    throws java.lang.Exception

Resumes an in-progress listing of object fields.

Parameters:
sessionToken - the token of the session in which the remaining results can be obtained
Returns:
the remaining specified fields of each object matching the given criteria.
Throws:
java.lang.Exception - If an error occurs in communicating with the Fedora Access SOAP service.

init

public void init()
          throws javax.servlet.ServletException

Initialize servlet.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - If the servet cannot be initialized.

destroy

public void destroy()

Cleans up servlet resources.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet