function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sravanthi bhavanamsravanthi bhavanam 

Metadata API backward compatibility

I am using Metadata API version 37 while one of our sandboxes were upgraded to v40 (Spring '17). We ran into an issue while running the statement:
ReadResult readResult = mdConnection.readMetadata("KnowledgeSettings", new String[] { "*" });


This returned KnowledgeSettings response:
<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
        <readMetadataResponse>
          <result>
            <records xsi:type="KnowledgeSettings">
              <fullName>*</fullName>
              <answers>
                <enableArticleCreation>false</enableArticleCreation>
            </answers>
            <cases>
                <defaultContributionArticleType>How_To</defaultContributionArticleType>
                <editor>standard</editor>
                <enableArticleCreation>true</enableArticleCreation>
                <enableArticlePublicSharingSites>false</enableArticlePublicSharingSites>
                <enableCaseDataCategoryMapping>true</enableCaseDataCategoryMapping>
                <useProfileForPDFCreation>false</useProfileForPDFCreation>
            </cases>
			---
      </readMetadataResponse>
    </soapenv:Body>
  </soapenv:Envelope>


The property enableCaseDataCategoryMapping is not available on v37 but Salesforce sends the response treating it as v40. Can this be avoided by having backward compatibility with the responses?
The issue is that this application is deployed on various environments and getting updates for every new version is quite difficult to maintain.
sravanthi bhavanamsravanthi bhavanam
Unable to edit the post. Here's the request:
WSC: Creating a new connection to https://instance.salesforce.com/services/Soap/m/37.0/user Proxy = DIRECT username null
------------ Request start   ----------
<?xml version="1.0" encoding="UTF-8"?><env:Envelope
   xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <env:Header>
  <SessionHeader xmlns="http://soap.sforce.com/2006/04/metadata">
   <sessionId>sessionId</sessionId>
  </SessionHeader>
 </env:Header>
 <env:Body>
  <m:readMetadata xmlns:m="http://soap.sforce.com/2006/04/metadata" xmlns:sobj="null">
   <m:type>KnowledgeSettings</m:type>
   <m:fullNames>*</m:fullNames>
  </m:readMetadata>
 </env:Body>
</env:Envelope>

From the request, it is hitting v37.0 but returning v40.0 response which is invalid.