public class WebServiceClient
extends java.lang.Object
The helper methods do the following:
The DDS helpers submit requests to the DDS Search Web Services and returns
responses as Document
.
The DCS helpers support the following repository services:
$Id: WebServiceClient.java,v 1.23 2009/03/20 23:33:58 jweather Exp $
Modifier and Type | Field and Description |
---|---|
protected static boolean |
debug
Description of the Field
|
Constructor and Description |
---|
WebServiceClient(java.lang.String baseWebServiceUrl)
Constructor for the WebServiceClient object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
doGetId(java.lang.String collection)
Requests an id from DCS getId web service.
|
java.lang.String |
doPutRecord(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String collection) |
java.lang.String |
doPutRecord(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String collection,
java.lang.String status,
java.lang.String statusNote)
Generate an ID and insert it in the recordXML before calling the PutRecord
web service
|
java.lang.String |
doPutRecord(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String collection,
java.lang.String id,
java.lang.String status,
java.lang.String statusNote)
Assumes id is already placed in the xmlRecord.
|
org.dom4j.Document |
doSearch(java.lang.String queryStr) |
java.lang.String |
getBaseUrl() |
GetRecordResponse |
getRecord(java.lang.String id)
Submits a request to the GetRecord DDS Web Service and returns response as
a
Document . |
java.net.URL |
getRequestUrl()
Gets the requestUrl attribute of the WebServiceClient object
|
protected org.dom4j.Document |
getResponseDoc()
retreives the contents of the requestUrl field as a
Document |
static org.dom4j.Document |
getResponseDoc(java.net.URL url)
Static version of getResponseDoc.
|
static java.lang.String |
getResponseError(org.dom4j.Document doc)
Gets the responseError attribute of the WebServiceClient class
|
static java.lang.String |
getResponseError(java.lang.String s)
Searches the response string for error elements and returns the contents of
the error if one is found.
|
protected java.lang.String |
getResponseStr()
Submits a Web Service and returns the result as a string.
|
static java.lang.String |
getTimedURL(java.net.URL url)
Uses a
TimedURLConnection to get the repsonse
from the web service (the request is a URL), which is returned as a String. |
static org.dom4j.Document |
getTimedXmlDocument(java.net.URL url)
gets the contents of a URL via
getTimedURL(URL) and then parses
the contents into a dom4j Document, which is returned |
int |
getTimeOutSecs() |
static void |
main(java.lang.String[] args)
The main program for the WebServiceClient class
|
static void |
setDebug(boolean db)
Sets the debug attribute
|
void |
setRequestUrl(java.lang.String verb,
java.lang.String argStr)
Sets the requestUrl attribute of the WebServiceClient object
|
void |
setRequestUrl(java.net.URL url)
Sets the requestUrl attribute of the WebServiceClient object
|
void |
setTimeOutSecs(int i) |
static java.lang.String |
stuffId(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String id)
Place the provided ID into the provided recordXml.
|
org.dom4j.Document |
urlCheck(java.lang.String s)
Submit a request (query) to the UrlCheck Web service and return the
response as a
Document . |
public WebServiceClient(java.lang.String baseWebServiceUrl)
Example baseWebServiceUrls:
baseWebServiceUrl
- url of Web Servicepublic java.lang.String getBaseUrl()
public void setTimeOutSecs(int i)
public int getTimeOutSecs()
public org.dom4j.Document urlCheck(java.lang.String s) throws WebServiceClientException
Document
. The UrlCheck service returns
items that match the query. the query is a url and may contain asterisks as
wildcards.s
- query to be submitted to UrlCheck
service.WebServiceClientException
- Description of the Exceptionpublic org.dom4j.Document doSearch(java.lang.String queryStr) throws WebServiceClientException
WebServiceClientException
public static java.lang.String stuffId(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String id) throws java.lang.Exception
recordXml
- Description of the Parameterid
- Description of the Parameterjava.lang.Exception
- Description of the Exceptionpublic java.lang.String doPutRecord(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String collection, java.lang.String status, java.lang.String statusNote) throws WebServiceClientException
recordXml
- xml record to be putxmlFormat
- metadata format of xml record (e.g., "adn")collection
- destination collection (e.g., "dcc")WebServiceClientException
- Description of the Exceptionpublic java.lang.String doPutRecord(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String collection) throws WebServiceClientException
WebServiceClientException
public java.lang.String doPutRecord(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String collection, java.lang.String id, java.lang.String status, java.lang.String statusNote) throws WebServiceClientException
recordXml
- xml record to be putxmlFormat
- metadata format of xml record (e.g., "adn")collection
- destination collection (e.g., "dcc")id
- xml record idWebServiceClientException
- Description of the Exceptionpublic java.lang.String doGetId(java.lang.String collection) throws WebServiceClientException
collection
- Description of the ParameterWebServiceClientException
- If unable to generate an IDpublic GetRecordResponse getRecord(java.lang.String id) throws WebServiceClientException
Document
. The GetRecord service returns an ADN record
wrapped in a XML response.id
- id of the record to getWebServiceClientException
- Description of the Exceptionpublic void setRequestUrl(java.net.URL url)
url
- The new requestUrl valuepublic java.net.URL getRequestUrl()
public void setRequestUrl(java.lang.String verb, java.lang.String argStr)
verb
- The new requestUrl valueargStr
- The new requestUrl valueprotected java.lang.String getResponseStr() throws WebServiceClientException
WebServiceClientException
- Description of the Exceptionpublic static java.lang.String getResponseError(java.lang.String s)
s
- Web service response as stringprotected org.dom4j.Document getResponseDoc() throws WebServiceClientException
Document
WebServiceClientException
- if unsuccessful retrieving url or
parsing docpublic static org.dom4j.Document getResponseDoc(java.net.URL url) throws WebServiceClientException
url
- Description of the ParameterWebServiceClientException
- Description of the Exceptionpublic static java.lang.String getResponseError(org.dom4j.Document doc)
doc
- Description of the Parameterpublic static java.lang.String getTimedURL(java.net.URL url) throws WebServiceClientException
TimedURLConnection
to get the repsonse
from the web service (the request is a URL), which is returned as a String.url
- Description of the ParameterWebServiceClientException
- Description of the Exceptionpublic static org.dom4j.Document getTimedXmlDocument(java.net.URL url) throws WebServiceClientException, org.dom4j.DocumentException
getTimedURL(URL)
and then parses
the contents into a dom4j Document, which is returnedurl
- url to retrieveWebServiceClientException
- Description of the Exceptionorg.dom4j.DocumentException
- Description of the Exceptionpublic static void main(java.lang.String[] args)
args
- The command line argumentspublic static void setDebug(boolean db)
db
- The new debug value