Introduction
Z39.50 is a national and international (ISO 23950) standard defining a protocol for computer-to-computer information retrieval.
Z39.50 makes it possible for a user in one system to search and retrieve information from other computer systems (that have also
implemented Z39.50) without knowing the search syntax that is used by those other systems. Z39.50 was originally approved by the
National Information Standards Organization (NISO) in 1988.
Different types of requests can be made to the Z39.50 gateway to get different types of responses.
- ExecSearch
- GetState
- ExecPresent
- StopSearch
Requests are sent XML-encoded according to the Z39.50 protocol. See
below for details
on how to format the XML query.
<Request Type="ExecSearch">
<Query>someQuery</Query>
<RecordSyntax>xml</RecordSyntax>
<ElementSet>S</ElementSet>
<Targets>
<Target>
<ID>3</ID>
<Host></Host>
<dbName></dbName>
<Port></Port>
</Target>
...
...
...
</Targets>
</Request>
Getting this response,
<Response Type="ExecSearch">
<Targets>
<Target>
<ID>3</ID>
<SearchStatus>Connecting</SearchStatus>
<ResultsFound></ResultsFound>
<ErrorMsg>if search status is
failed</ErrorMsg>
</Target>
..
..
..
</Targets>
</Response>
This response is usually followed by subsequent
GetState requests.
<Request Type="GetState">
<TargetIds>3,9</TargetIds>
</Request>
Which would return state information for the IDs provided:
<Response Type="GetState">
<Targets>
<Target>
<ID>3</ID>
<SearchStatus>Searching</SearchStatus>
<ResultsFound>0</ResultsFound>
</Target>
..
..
..
</Targets>
</Response>
Once the search has been completed. Another request is made to actually get the metadata
(the data is usually returned between some start and end point rather than all at once):
<Request Type="ExecPresent">
<RecordSyntax>xml</RecordSyntax>
<ElementSet>S</ElementSet>
<Targets>
<Target>
<ID>3</ID>
<StartRow>1</StartRow>
<EndRow>10</EndRow>
</Target>
.
..
.
</Targets>
</Request>
To which the gateway would respond with something like:
<Response Type="GetState">
<Targets>
<Target>
<ID>3</ID>
<SearchStatus>Searching</SearchStatus>
<ResultsFound>0</ResultsFound>
</Target>
..
..
..
</Targets>
</Response>
See below for additional details on formatting the XML request.
Formatting the XML Request
top
Each element in the XML request can have different values. Below is a listing of these
values.
- Query tag: Has to be in Type 1 format. "PQF" or prefix query format is a type 1
format used by WES Z39.50 services.
- RecordSyntax tag: Can be equal to either 'HTML', 'XML', or 'SUTRS' (which is text only).
- ElementSet tag: Can be equal to either 'F', 'S', or 'B' which stand for 'Full',
'Summary' or 'Brief', respectively. It basically determines the level of detailed information that will be
returned in the response.
You only need to provide three pieces of information to search a particular Z39.50 node,
the 'Host', 'dbName' (or database name), and 'Port'. Each tag can be found within the repeatable
'Target' tag.
The 'ID' tag is something the user defines to uniquely identify the target (or node) since
multiple Z39.50 nodes can be hit at the same time.
Additional Note
top
As an additional note, the Z39.50 gateway will create a session and store it in a cookie, which will
in turn be returned to the caller. It is then up to the caller to get this cookie and set it in each
subsequent request to ensure they connect to the correct session.