Fixing metadata.wsdl

If you use the Force.com Web Service Connector to call Salesforce's metadata API, you may receive an error like the following when attempting to describe an sObject containing a geolocation field:

unable to find end tag at: START_TAG seen ...</fullName><displayLocationInDecimal>...

This is caused by metadata.wsdl containing an incomplete description of the metadata API. Specifically, it is missing the Location value for FieldType, and the displayLocationInDecimal field on CustomField. Luckily, this is easy to fix.

1. Add the following line to FieldType:

<xsd:enumeration value="Location"/>

2. Add the following line to CustomField, under displayFormat:

<xsd:element name="displayLocationInDecimal" minOccurs="0" type="xsd:boolean"/>

Then just run the corrected metadata.wsdl back through WSC to generate a new JAR, and you should be good to go!

Cheers,

Jeff