SRU (Search/Retrieval Using URL)

SRU

SRW: Search/Retrieve Web Service

SRW is a variation of SRU. Messages are conveyed from client to server, not by a URL, but instead using XML over HTTP via the W3C recommendation SOAP, which specifies how to wrap an XML message within an XML envelope. The SRW specification tries to adhere to the Web Services Interoperability recommendations.

Benefits of SRW

The incremental benefits of SRW (that is, the advantages of using SRW over SRU) are: better extension support, authentication, and web service features.

SOAP Version

SRW clients and servers must support SOAP version 1.1. They may support version 1.2 or later. This is to allow the most flexibility in implementation as possible.

Service Style

The SOAP service style for SRW is document/literal. Messages should be inline with no multrefs.

Other Considerations

If there is a doubt whether to return a SOAP fault or an SRW diagnostic, then the diagnostic is the preferred solution, as the client must support the diagnostics, and toolkits may not handle SOAP faults as gracefully (see below).

The SOAPAction HTTP header may be present in a request (but should not be required for SRW implementations). If present, its value must be an empty string, and it must be expressed as:

SOAPAction: ""

(A header of

SOAPAction:

is incorrect.)

"Toolkit as Impediment"

This phrase, coined by one of the designers of SRW, refers to the fact that different toolkits make some things easy to accomplish where they might be extremely arcane in others. The design of SRW tries to take a good cross sample of well-supported, standards-compliant toolkits, and takes the line of least resistance. Thus if you ever think, 'Why is it done like that?!', the answer is probably that it was easiest to do it that way while remaining standards compliant.

Parameters

The parameters for the SRW request and response are the same as the SRU searchRetrieve request and response parameters, with the following exceptions:

  •  The operation parameter, defined for the SRU request, is not defined for SRW.
  •  The stylesheet parameter, defined for the SRU request, is not defined for SRW.
  •  The echoedSearch RetrieveRequest parameter, defined for the SRU response, is not defined for SRW.

Examples

A typical searchRetrieve request might be:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <SRW:searchRetrieveRequest xmlns:SRW="//www.loc.gov/zing/srw/">
      <SRW:version>1.1</SRW:version>
      <SRW:query>(dc.author exact "jones" and  dc.title >= "smith")</SRW:query>
      <SRW:startRecord>1</SRW:startRecord>
      <SRW:maximumRecords>10</SRW:maximumRecords>
      <SRW:recordSchema>info:srw/schema/1/mods-v3.0</SRW:recordsSchema>
    </SRW:searchRetrieveRequest>
  </SOAP:Body>
</SOAP:Envelope>
      

The searchRetrieve response would be of the form:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <SRW:searchRetrieveResponse xmlns:SRW="//www.loc.gov/zing/srw/" 
         xmlns:DIAG="//www.loc.gov/zing/srw/diagnostics/">
      <SRW:version>1.1</SRW:version>
      <SRW:numberOfRecords>2</SRW:numberOfRecords>
      <SRW:resultSetId>8c527d60-c3b4-4cec-a1de-1ff80a5932df</SRW:resultSetId>
      <SRW:resultSetIdleTime>600</SRW:resultSetIdleTime>
      <SRW:records>
        <SRW:record>
          <SRW:recordSchema>info:srw/schema/1/mods-v3.0</SRW:recordSchema>
          <SRW:recordPacking>string</SRW:recordPacking>
          <SRW:recordData>
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
            &lt;mods xmlns:xlink=&quot;http://www.w3.org/TR/xlink&quot; 
               xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
               xmlns=&quot;http://www.loc.gov/mods/&quot; 
               xsi:schemaLocation=&quot;
                http://www.loc.gov/standards/mods/mods.xsd&quot;&gt;
              &lt;titleInfo&gt;
                &lt;title&gt;Sound and fury : 
                 the making of the punditocracy /&lt;/title&gt;
              &lt;/titleInfo&gt;
              &lt;name type=&quot;personal&quot;&gt;
                &lt;namePart&gt;Alterman, Eric.&lt;/namePart&gt;
                &lt;role&gt;creator&lt;/role&gt;
              &lt;/name&gt;
              ...
          </SRW:recordData>
          <SRW:recordPosition>1</SRW:recordPosition>
        </SRW:record>
        <SRW:record>
          <SRW:recordSchema>info:srw/schema/1/diagnostic-v1.1
              </SRW:recordSchema>
          <SRW:recordPacking>string</SRW:recordPacking>
  
          <SRW:recordData>
            &lt;diagnostic&gt;
            &lt;uri&gt;info:srw/diagnostic/1/68&lt;/uri&gt;
            &lt;details&gt;Not authorised 
                      to send record&lt;/details&gt;
          &lt;/diagnostic&gt;
          </SRW:recordData>
          <SRW:recordPosition>2</SRW:recordPosition>
        </SRW:record>
      </SRW:records>
      <SRW:diagnostics>
        <DIAG:diagnostic>
          <DIAG:uri>info:srw/diagnostic/1/59</DIAG:uri>
          <DIAG:message>Result set created with valid 
             partial results available</DIAG:message>
        </DIAG:diagnostic>
      </SRW:diagnostics>
    </SRW:searchRetrieveResponse>
  </SOAP:Body>
</SOAP:Envelope>