New attribute "backendtype" for syntax section which specifies record
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Aug 2004 09:02:16 +0000 (09:02 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Aug 2004 09:02:16 +0000 (09:02 +0000)
syntax to be transmitted to backend.

YAZ proxy no longer transmits element set name to backend target when
doing schema conversions. It just gets unset instead (it's optional).

NEWS
doc/reference.xml
etc/fennica.xml [new file with mode: 0644]
etc/helka.xml [new file with mode: 0644]
etc/yazproxy.xsd
include/yazproxy/proxy.h
src/yaz-proxy-config.cpp
src/yaz-proxy.cpp

diff --git a/NEWS b/NEWS
index 61fa5d5..63956ac 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,12 @@
-Use YAZ_DOC macro to setup documentation. Add yaz.m4.
+
+New attribute "backendtype" for syntax section which specifies
+record syntax to be transmitted to backend. This allows proxy to
+offer a record syntax different from that offered by backend.
+
+YAZ proxy no longer transmits element set name to backend target when
+doing schema conversions. It just gets unset instead (it's optional).
+
+Use YAZ_DOC macro to setup documentation. Added yaz.m4.
 
 --- 0.8 2004/04/23
 
index 6983679..109eb2a 100644 (file)
      If attribute <literal>marcxml</literal> is given, the proxy will
      perform MARC21 to MARCXML conversion. In this case the
      <literal>type</literal> should be XML. The proxy will use
-     preferred record syntax USMARC/MARC21 against the backend target.
+     preferred record syntax USMARC/MARC21 or <literal>backendtype</literal> 
+     (if given) against the backend target.
+    </para>
+    <para>
+     If attribute <literal>backendtype</literal> is given, that holds the
+     record syntax to be transmitted to backend.
     </para>
     <para>
      If attribute <literal>stylesheet</literal> is given, the proxy
    <screen><![CDATA[
 <?xml version="1.0"?>
 <!-- XML Schema for YAZ proxy config file.
-    $Id: reference.xml,v 1.9 2004-07-06 10:49:44 mike Exp $
+    $Id: reference.xml,v 1.10 2004-08-10 09:02:16 adam Exp $
 -->
 <xs:schema
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
diff --git a/etc/fennica.xml b/etc/fennica.xml
new file mode 100644 (file)
index 0000000..6db2ce8
--- /dev/null
@@ -0,0 +1,209 @@
+<?xml version="1.0"?>
+<!-- $Id: fennica.xml,v 1.1 2004-08-10 09:02:16 adam Exp $ -->
+<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.8/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://indexdata.dk/yazproxy/schema/0.8/ yazproxy.xsd"
+>
+  <!-- define default target and name it voyager -->
+  <target default="1" name="voyager">
+    <!-- all backend addresses as seen from this proxy .. -->
+    <xurl>193.166.7.194:11390</xurl>
+    <url>localhost:9999</url>
+
+    <!-- set session timeout between proxy and backend target -->
+    <target-timeout>300</target-timeout>
+
+    <!-- set session timeout between client and proxy.
+    Should be lower than target-timeout -->
+    <client-timeout>180</client-timeout>
+
+    <!-- if either bandwidth or pdu limit is reached the session is no
+    longer kept alive -->
+    <keepalive>
+      <bandwidth>500000</bandwidth>
+      <pdu>500</pdu>
+    </keepalive>
+
+    <!-- client limits .. -->
+    <limit>
+      <bandwidth>200000</bandwidth>
+      <pdu>31</pdu>
+      <retrieve>50</retrieve>
+    </limit>
+
+    <!-- use attributes -->
+    <attribute type="1" value="1-11,13-1010,1013-1023,1025-1030"/>
+    <attribute type="1" value="*" error="114"/>
+
+    <!-- relation attributes -->
+    <attribute type="2" value="1,2,3,4,5,6"/>
+    <attribute type="2" value="*" error="117"/>
+    
+    <!-- position attributes -->
+    <attribute type="3" value="1,2,3"/>
+    <attribute type="3" value="*" error="119"/>
+
+    <!-- structure attributes -->
+    <attribute type="4" value="1,2,3,4,5,6"/>
+    <attribute type="4" value="*" error="118"/>
+
+    <!-- truncation attributes -->
+    <attribute type="5" value="1,100"/>
+    <attribute type="5" value="*" error="120"/>
+
+    <!-- completeness attributes -->
+    <attribute type="6" value="1,2,3"/>
+    <attribute type="6" value="*" error="122"/>
+
+    <!-- other types -->
+    <attribute type="*" value="*" error="113"/>
+
+    <!-- list allowed record syntaxes and possible schemas (if any);
+    reject all others at the end -->
+    <syntax type="opac"/>
+    <syntax type="finmarc" backendtype="usmarc"/>
+    <zsyntax type="usmarc"/>
+    <syntax type="usmarc" backendtype="canmarc"/>
+    <syntax type="none"/>
+    
+    <syntax type="xml" marcxml="1"
+      identifier="info:srw/schema/1/marcxml-v1.1"
+      >
+      <title>MARCXML</title>
+      <name>marcxml</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2SRWDC.xsl"
+      identifier="info:srw/schema/1/dc-v1.1"
+      >
+      <title>Dublin Core</title>
+      <name>dc</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2MODS.xsl"
+      identifier="http://www.loc.gov/mods"
+      >
+      <title>MODS v2</title>
+      <name>mods2</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2MODS3.xsl"
+      identifier="info:srw/schema/1/mods-v3.0"
+      >
+      <title>MODS v3</title>
+      <name>mods3</name>
+      <name>mods</name>
+    </syntax>
+
+    <syntax type="*" error="238"/>
+
+    <!-- keep this number of spare sessions for future sessions -->
+    <preinit>0</preinit>
+
+    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
+      <serverInfo>
+       <host>indexdata.dk</host>
+       <port>9000</port>
+       <database>voyager</database>
+      </serverInfo>
+      
+      <databaseInfo>
+       <title>LoC gateway</title>
+       <description lang="en" primary="true">
+         SRW/SRU/Z39.50 Gateway to HELKA (The OPAC of the Helsinki University Libraries)
+       </description>
+      </databaseInfo>
+      
+      <indexInfo>
+       <set identifier="info:srw/cql-context-set/1/cql-v1.1"
+         name="cql"/>
+       <set identifier="info:srw/cql-context-set/1/dc-v1.1"
+         name="dc"/>
+       <set identifier="http://zing.z3950.org/cql/bath/2.0/"
+         name="bath"/>
+       
+       <index id="4">
+         <title>title</title>
+         <map><name set="dc">title</name></map>
+       </index>
+       <index id="21">
+         <title>subject</title>
+         <map><name set="dc">subject</name></map>
+       </index>
+       <index id="1003">
+         <title>creator</title>
+         <map><name set="dc">creator</name></map>
+         <map><name set="dc">author</name></map>
+       </index>
+       
+       <index id="1020">
+         <title>editor</title>
+         <map><name set="dc">editor</name></map>
+       </index>
+       
+       <index id="1018">
+         <title>publisher</title>
+         <map><name set="dc">publisher</name></map>
+       </index>
+       
+       <index id="62">
+         <title>description</title>
+         <map><name set="dc">description</name></map>
+       </index>
+       
+       <index id="30">
+         <title>date</title>
+         <map><name set="dc">date</name></map>
+       </index>
+       
+       <index id="1002">
+         <title>name</title>
+         <map><name set="bath">name</name></map>
+       </index>
+       
+       <index id="7">
+         <title>isbn</title>
+         <map><name set="bath">isbn</name></map>
+       </index>
+       <index id="8">
+         <title>issn</title>
+         <map><name set="bath">issn</name></map>
+       </index>
+      </indexInfo>
+
+      <schemaInfo>
+       <schema identifier="info:srw/schema/1/marcxml-v1.1"
+         sort="false" name="marcxml">
+         <title>MARCXML</title>
+       </schema>
+       
+       <schema identifier="info:srw/schema/1/dc-v1.1"
+         sort="false" name="dc">
+         <title>Dublin Core</title>
+       </schema>
+       
+       <schema identifier="http://www.loc.gov/mods"
+         sort="false" name="mods2">
+         <title>MODS v2</title>
+       </schema>
+
+       <schema identifier="info:srw/schema/1/mods-v3.0"
+         sort="false" name="mods">
+         <title>MODS v3</title>
+       </schema>
+
+      </schemaInfo>
+
+      <configInfo>
+        <default type="numberOfRecords">0</default>
+      </configInfo>
+    </explain>
+   <cql2rpn>pqf.properties</cql2rpn>
+  </target>
+
+
+  <!-- maximum number of client sessions. Remember to allow for
+     at least max-clients*2+5 sockets. Use 'ulimit -n 1040' on bash -->
+  <max-clients>500</max-clients>
+  
+  <!-- what we log. Allowed tokens: client-apdu, server-apdu,
+  client-requests, server-requests -->
+  <log>client-requests server-requests</log>
+</proxy>
diff --git a/etc/helka.xml b/etc/helka.xml
new file mode 100644 (file)
index 0000000..3bb1a2d
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+<!-- $Id: helka.xml,v 1.1 2004-08-10 09:02:16 adam Exp $ -->
+<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.8/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://indexdata.dk/yazproxy/schema/0.8/ yazproxy.xsd"
+>
+  <!-- define default target and name it voyager -->
+  <target default="1" name="voyager">
+    <!-- all backend addresses as seen from this proxy .. -->
+    <url>193.166.7.193:7590</url>
+
+    <!-- set session timeout between proxy and backend target -->
+    <target-timeout>300</target-timeout>
+
+    <!-- set session timeout between client and proxy.
+    Should be lower than target-timeout -->
+    <client-timeout>180</client-timeout>
+
+    <!-- if either bandwidth or pdu limit is reached the session is no
+    longer kept alive -->
+    <keepalive>
+      <bandwidth>500000</bandwidth>
+      <pdu>500</pdu>
+    </keepalive>
+
+    <!-- client limits .. -->
+    <limit>
+      <bandwidth>200000</bandwidth>
+      <pdu>31</pdu>
+      <retrieve>50</retrieve>
+    </limit>
+
+    <!-- use attributes -->
+    <attribute type="1" value="1-11,13-1010,1013-1023,1025-1030"/>
+    <attribute type="1" value="*" error="114"/>
+
+    <!-- relation attributes -->
+    <attribute type="2" value="1,2,3,4,5,6"/>
+    <attribute type="2" value="*" error="117"/>
+    
+    <!-- position attributes -->
+    <attribute type="3" value="1,2,3"/>
+    <attribute type="3" value="*" error="119"/>
+
+    <!-- structure attributes -->
+    <attribute type="4" value="1,2,3,4,5,6"/>
+    <attribute type="4" value="*" error="118"/>
+
+    <!-- truncation attributes -->
+    <attribute type="5" value="1,100"/>
+    <attribute type="5" value="*" error="120"/>
+
+    <!-- completeness attributes -->
+    <attribute type="6" value="1,2,3"/>
+    <attribute type="6" value="*" error="122"/>
+
+    <!-- other types -->
+    <attribute type="*" value="*" error="113"/>
+
+    <!-- list allowed record syntaxes and possible schemas (if any);
+    reject all others at the end -->
+    <syntax type="opac"/>
+    <syntax type="finmarc" backendtype="usmarc"/>
+    <syntax type="usmarc" backendtype="canmarc"/>
+    <syntax type="none"/>
+    
+    <syntax type="xml" marcxml="1"
+      identifier="info:srw/schema/1/marcxml-v1.1"
+      >
+      <title>MARCXML</title>
+      <name>marcxml</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2SRWDC.xsl"
+      identifier="info:srw/schema/1/dc-v1.1"
+      >
+      <title>Dublin Core</title>
+      <name>dc</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2MODS.xsl"
+      identifier="http://www.loc.gov/mods"
+      >
+      <title>MODS v2</title>
+      <name>mods2</name>
+    </syntax>
+    <syntax type="xml" marcxml="1" stylesheet="MARC21slim2MODS3.xsl"
+      identifier="info:srw/schema/1/mods-v3.0"
+      >
+      <title>MODS v3</title>
+      <name>mods3</name>
+      <name>mods</name>
+    </syntax>
+
+    <syntax type="*" error="238"/>
+
+    <!-- keep this number of spare sessions for future sessions -->
+    <preinit>0</preinit>
+
+    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
+      <serverInfo>
+       <host>indexdata.dk</host>
+       <port>9000</port>
+       <database>voyager</database>
+      </serverInfo>
+      
+      <databaseInfo>
+       <title>LoC gateway</title>
+       <description lang="en" primary="true">
+         SRW/SRU/Z39.50 Gateway to HELKA (The OPAC of the Helsinki University Libraries)
+       </description>
+      </databaseInfo>
+      
+      <indexInfo>
+       <set identifier="info:srw/cql-context-set/1/cql-v1.1"
+         name="cql"/>
+       <set identifier="info:srw/cql-context-set/1/dc-v1.1"
+         name="dc"/>
+       <set identifier="http://zing.z3950.org/cql/bath/2.0/"
+         name="bath"/>
+       
+       <index id="4">
+         <title>title</title>
+         <map><name set="dc">title</name></map>
+       </index>
+       <index id="21">
+         <title>subject</title>
+         <map><name set="dc">subject</name></map>
+       </index>
+       <index id="1003">
+         <title>creator</title>
+         <map><name set="dc">creator</name></map>
+         <map><name set="dc">author</name></map>
+       </index>
+       
+       <index id="1020">
+         <title>editor</title>
+         <map><name set="dc">editor</name></map>
+       </index>
+       
+       <index id="1018">
+         <title>publisher</title>
+         <map><name set="dc">publisher</name></map>
+       </index>
+       
+       <index id="62">
+         <title>description</title>
+         <map><name set="dc">description</name></map>
+       </index>
+       
+       <index id="30">
+         <title>date</title>
+         <map><name set="dc">date</name></map>
+       </index>
+       
+       <index id="1002">
+         <title>name</title>
+         <map><name set="bath">name</name></map>
+       </index>
+       
+       <index id="7">
+         <title>isbn</title>
+         <map><name set="bath">isbn</name></map>
+       </index>
+       <index id="8">
+         <title>issn</title>
+         <map><name set="bath">issn</name></map>
+       </index>
+      </indexInfo>
+
+      <schemaInfo>
+       <schema identifier="info:srw/schema/1/marcxml-v1.1"
+         sort="false" name="marcxml">
+         <title>MARCXML</title>
+       </schema>
+       
+       <schema identifier="info:srw/schema/1/dc-v1.1"
+         sort="false" name="dc">
+         <title>Dublin Core</title>
+       </schema>
+       
+       <schema identifier="http://www.loc.gov/mods"
+         sort="false" name="mods2">
+         <title>MODS v2</title>
+       </schema>
+
+       <schema identifier="info:srw/schema/1/mods-v3.0"
+         sort="false" name="mods">
+         <title>MODS v3</title>
+       </schema>
+
+      </schemaInfo>
+
+      <configInfo>
+        <default type="numberOfRecords">0</default>
+      </configInfo>
+    </explain>
+   <cql2rpn>pqf.properties</cql2rpn>
+  </target>
+
+
+  <!-- maximum number of client sessions. Remember to allow for
+     at least max-clients*2+5 sockets. Use 'ulimit -n 1040' on bash -->
+  <max-clients>500</max-clients>
+  
+  <!-- what we log. Allowed tokens: client-apdu, server-apdu,
+  client-requests, server-requests -->
+  <log>client-requests server-requests</log>
+</proxy>
index 07464ef..49cbc0d 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!-- XML Schema for YAZ proxy config file.
-    $Id: yazproxy.xsd,v 1.2 2004-07-02 12:37:03 adam Exp $
+    $Id: yazproxy.xsd,v 1.3 2004-08-10 09:02:16 adam Exp $
 -->
 <xs:schema
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
@@ -85,6 +85,7 @@
    <xs:attribute name="marcxml" type="xs:string" />
    <xs:attribute name="identifier" type="xs:string" />
    <xs:attribute name="stylesheet" type="xs:string" />
+   <xs:attribute name="backendtype" type="xs:string" />
   </xs:complexType>
  </xs:element>
 
index 2936c1a..9c87ab8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: proxy.h,v 1.4 2004-04-22 07:46:21 adam Exp $
+/* $Id: proxy.h,v 1.5 2004-08-10 09:02:16 adam Exp $
    Copyright (c) 1998-2004, Index Data.
 
 This file is part of the yaz-proxy.
@@ -71,7 +71,8 @@ public:
     int check_query(ODR odr, const char *name, Z_Query *query, char **addinfo);
     int check_syntax(ODR odr, const char *name,
                     Odr_oid *syntax, Z_RecordComposition *comp,
-                    char **addinfo, char **stylesheet, char **schema);
+                    char **addinfo, char **stylesheet, char **schema,
+                    char **backend_type);
     char *get_explain(ODR odr, const char *name, const char *db,
                      int *len);
 private:
@@ -208,6 +209,9 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
     Z_APDU *m_stylesheet_apdu;
     Z_NamePlusRecordList *m_stylesheet_nprl;
     char *m_schema;
+    char *m_backend_type;
+    int m_frontend_type;
+    void convert_to_frontend_type(Z_NamePlusRecordList *p);
     void convert_to_marcxml(Z_NamePlusRecordList *p);
     int convert_xsl(Z_NamePlusRecordList *p, Z_APDU *apdu);
     void convert_xsl_delay();
index dc5c883..772b678 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: yaz-proxy-config.cpp,v 1.4 2004-04-22 07:46:21 adam Exp $
+/* $Id: yaz-proxy-config.cpp,v 1.5 2004-08-10 09:02:16 adam Exp $
    Copyright (c) 1998-2004, Index Data.
 
 This file is part of the yaz-proxy.
@@ -446,7 +446,8 @@ int Yaz_ProxyConfigP::check_schema(xmlNodePtr ptr, Z_RecordComposition *comp,
 int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name,
                                  Odr_oid *syntax, Z_RecordComposition *comp,
                                  char **addinfo,
-                                 char **stylesheet, char **schema)
+                                 char **stylesheet, char **schema,
+                                 char **backend_type)
 {
     if (stylesheet)
     {
@@ -458,6 +459,11 @@ int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name,
        xfree (*schema);
        *schema = 0;
     }
+    if (backend_type)
+    {
+       xfree (*backend_type);
+       *backend_type = 0;
+    }
 #if HAVE_XSLT
     int syntax_has_matched = 0;
     xmlNodePtr ptr;
@@ -476,6 +482,7 @@ int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name,
            const char *match_marcxml = 0;
            const char *match_stylesheet = 0;
            const char *match_identifier = 0;
+           const char *match_backend_type = 0;
            struct _xmlAttr *attr;
            for (attr = ptr->properties; attr; attr = attr->next)
            {
@@ -494,6 +501,10 @@ int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name,
                if (!strcmp((const char *) attr->name, "identifier") &&
                    attr->children && attr->children->type == XML_TEXT_NODE)
                    match_identifier = (const char *) attr->children->content;
+               if (!strcmp((const char *) attr->name, "backendtype") &&
+                   attr->children && attr->children->type == XML_TEXT_NODE)
+                   match_backend_type = (const char *)
+                       attr->children->content;
            }
            if (match_type)
            {
@@ -531,6 +542,11 @@ int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name,
                    xfree(*schema);
                    *schema = xstrdup(match_identifier);
                }
+               if (backend_type && match_backend_type)
+               {
+                   xfree(*backend_type);
+                   *backend_type = xstrdup(match_backend_type);
+               }
                if (match_marcxml)
                {
                    return -1;
index b246554..f319d5d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: yaz-proxy.cpp,v 1.4 2004-04-22 07:46:21 adam Exp $
+/* $Id: yaz-proxy.cpp,v 1.5 2004-08-10 09:02:16 adam Exp $
    Copyright (c) 1998-2004, Index Data.
 
 This file is part of the yaz-proxy.
@@ -141,6 +141,8 @@ Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable,
     m_s2z_stylesheet = 0;
     m_s2z_database = 0;
     m_schema = 0;
+    m_backend_type = 0;
+    m_frontend_type = 0;
     m_initRequest_apdu = 0;
     m_initRequest_mem = 0;
     m_initRequest_preferredMessageSize = 0;
@@ -190,6 +192,7 @@ Yaz_Proxy::~Yaz_Proxy()
     xfree (m_time_tv);
 
     xfree (m_schema);
+    xfree (m_backend_type);
     if (m_s2z_odr_init)
        odr_destroy(m_s2z_odr_init);
     if (m_s2z_odr_search)
@@ -725,6 +728,30 @@ void Yaz_Proxy::convert_xsl_delay()
        timeout(0);
 }
 
+void Yaz_Proxy::convert_to_frontend_type(Z_NamePlusRecordList *p)
+{
+    if (m_frontend_type != VAL_NONE)
+    {
+       int i;
+       for (i = 0; i < p->num_records; i++)
+       {
+           Z_NamePlusRecord *npr = p->records[i];
+           if (npr->which == Z_NamePlusRecord_databaseRecord)
+           {
+               Z_External *r = npr->u.databaseRecord;
+               if (r->which == Z_External_octet)
+               {
+                   npr->u.databaseRecord =
+                       z_ext_record(odr_encode(),
+                                    m_frontend_type,
+                                    (char*) r->u.octet_aligned->buf,
+                                    r->u.octet_aligned->len);
+               }
+           }
+       }
+    }
+}
+
 void Yaz_Proxy::convert_to_marcxml(Z_NamePlusRecordList *p)
 {
     int i;
@@ -1062,6 +1089,8 @@ int Yaz_Proxy::send_to_client(Z_APDU *apdu)
        {
            if (p && p->which == Z_Records_DBOSD)
            {
+               if (m_backend_type)
+                   convert_to_frontend_type(p->u.databaseOrSurDiagnostics);
                if (m_marcxml_flag)
                    convert_to_marcxml(p->u.databaseOrSurDiagnostics);
                if (convert_xsl(p->u.databaseOrSurDiagnostics, apdu))
@@ -1100,6 +1129,8 @@ int Yaz_Proxy::send_to_client(Z_APDU *apdu)
        }
        if (p && p->which == Z_Records_DBOSD)
        {
+           if (m_backend_type)
+               convert_to_frontend_type(p->u.databaseOrSurDiagnostics);
            if (m_marcxml_flag)
                convert_to_marcxml(p->u.databaseOrSurDiagnostics);
            if (convert_xsl(p->u.databaseOrSurDiagnostics, apdu))
@@ -1208,6 +1239,12 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu)
                return 0;
            }
            Z_NamePlusRecordList *npr;
+           int oclass = 0;
+#if 0
+           yaz_log(LOG_LOG, "%sCache lookup %d+%d syntax=%s",
+                   m_session_str, start, toget, yaz_z3950oid_to_str(
+                       pr->preferredRecordSyntax, &oclass));
+#endif
            if (m_client->m_cache.lookup (odr_encode(), &npr, start, toget,
                                          pr->preferredRecordSyntax,
                                          pr->recordComposition))
@@ -1593,12 +1630,22 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
            rc = &rc_temp;
        }
 
+       if (sr->preferredRecordSyntax)
+       {
+           struct oident *ent;
+           ent = oid_getentbyoid(sr->preferredRecordSyntax);
+           m_frontend_type = ent->value;
+       }
+       else
+           m_frontend_type = VAL_NONE;
+
        char *stylesheet_name = 0;
        if (cfg)
            err = cfg->check_syntax(odr_encode(),
                                    m_default_target,
                                    sr->preferredRecordSyntax, rc,
-                                   &addinfo, &stylesheet_name, &m_schema);
+                                   &addinfo, &stylesheet_name, &m_schema,
+                                   &m_backend_type);
        if (stylesheet_name)
        {
            m_parent->low_socket_close();
@@ -1616,8 +1663,19 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
        }
        if (err == -1)
        {
-           sr->preferredRecordSyntax =
-               yaz_oidval_to_z3950oid(odr_encode(), CLASS_RECSYN, VAL_USMARC);
+           sr->smallSetElementSetNames = 0;
+           sr->mediumSetElementSetNames = 0;
+           if (m_backend_type)
+           {
+               
+               sr->preferredRecordSyntax =
+                   yaz_str_to_z3950oid(odr_encode(), CLASS_RECSYN,
+                                       m_backend_type);
+           }
+           else
+               sr->preferredRecordSyntax =
+                   yaz_oidval_to_z3950oid(odr_encode(), CLASS_RECSYN,
+                                          VAL_USMARC);
            m_marcxml_flag = 1;
        }
        else if (err)
@@ -1633,6 +1691,11 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
            
            return 0;
        }
+       else if (m_backend_type)
+       {
+           sr->preferredRecordSyntax =
+               yaz_str_to_z3950oid(odr_encode(), CLASS_RECSYN, m_backend_type);
+       }
     }
     else if (apdu->which == Z_APDU_presentRequest)
     {
@@ -1641,12 +1704,22 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
        char *addinfo = 0;
        Yaz_ProxyConfig *cfg = check_reconfigure();
 
+       if (pr->preferredRecordSyntax)
+       {
+           struct oident *ent;
+           ent = oid_getentbyoid(pr->preferredRecordSyntax);
+           m_frontend_type = ent->value;
+       }
+       else
+           m_frontend_type = VAL_NONE;
+
        char *stylesheet_name = 0;
        if (cfg)
            err = cfg->check_syntax(odr_encode(), m_default_target,
                                    pr->preferredRecordSyntax,
                                    pr->recordComposition,
-                                   &addinfo, &stylesheet_name, &m_schema);
+                                   &addinfo, &stylesheet_name, &m_schema,
+                                   &m_backend_type);
        if (stylesheet_name)
        {
            m_parent->low_socket_close();
@@ -1664,8 +1737,18 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
        }
        if (err == -1)
        {
-           pr->preferredRecordSyntax =
-               yaz_oidval_to_z3950oid(odr_decode(), CLASS_RECSYN, VAL_USMARC);
+           pr->recordComposition = 0;
+           if (m_backend_type)
+           {
+               
+               pr->preferredRecordSyntax =
+                   yaz_str_to_z3950oid(odr_encode(), CLASS_RECSYN,
+                                       m_backend_type);
+           }
+           else
+               pr->preferredRecordSyntax =
+                   yaz_oidval_to_z3950oid(odr_encode(), CLASS_RECSYN,
+                                          VAL_USMARC);
            m_marcxml_flag = 1;
        }
        else if (err)
@@ -1682,6 +1765,11 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
            
            return 0;
        }
+       else if (m_backend_type)
+       {
+           pr->preferredRecordSyntax =
+               yaz_str_to_z3950oid(odr_encode(), CLASS_RECSYN, m_backend_type);
+       }
     }
     return apdu;
 }