Ejemplo: Solicitud y respuesta XML POST

A continuación, se muestra un ejemplo de una solicitud XML POST para el servicio Geocode. En este ejemplo, se muestra cómo activar la función de desplazamiento de línea central en customPreferences, así como configurar los campos matchOnAddressNumber y matchOnStreetName en el objeto mustMatchFields. Para activar la configuración de mustMatchFields, el campo matchMode se define en CUSTOM.

POST http://myserver:8080/rest/GlobalGeocode/geocode.xml HTTP/1.1
<?xml version="1.0" encoding="UTF-8"?>
<geocodeRequest>
   <type>ADDRESS</type>
   <preferences>
      <returnAllCandidateInfo 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <fallbackToGeographic 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <fallbackToPostal 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <maxReturnedCandidates 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <distance 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <streetOffset 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <cornerOffset 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xsi:nil="true" />
      <matchMode>CUSTOM</matchMode>
      <mustMatchFields>
         <matchOnAddressNumber>true</matchOnAddressNumber>
         <matchOnPostCode1>false</matchOnPostCode1>
         <matchOnPostCode2>false</matchOnPostCode2>
         <matchOnAreaName1>false</matchOnAreaName1>
         <matchOnAreaName2>false</matchOnAreaName2>
         <matchOnAreaName3>false</matchOnAreaName3>
         <matchOnAreaName4>false</matchOnAreaName4>
         <matchOnAllStreetFields>false</matchOnAllStreetFields>
         <matchOnStreetName>true</matchOnStreetName>
         <matchOnStreetType>false</matchOnStreetType>
         <matchOnStreetDirectional>false</matchOnStreetDirectional>
         <matchOnPlaceName>false</matchOnPlaceName>
         <matchOnInputFields>false</matchOnInputFields>
      </mustMatchFields>
      <customPreferences>
         <entry>
            <key 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">CENTERLINE_OFFSET_UNIT</key>
            <value 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">FEET</value>
         </entry>
         <entry>
            <key 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">CENTERLINE_OFFSET</key>
            <value xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">30.0</value>
         </entry>
         <entry>
            <key 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">USE_CENTERLINE_OFFSET</key>
            <value 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:type="xs:string">true</value>
         </entry>
      </customPreferences>
   </preferences>
   <addresses>
      <mainAddressLine>
            36 Rue de la Haute Moline Champagne-Ardenne 10800
      </mainAddressLine>
      <country>FRA</country>
   </addresses>
</geocodeRequest>

A continuación, se muestra la respuesta XML que devuelve la solicitud anterior.

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeServiceResponseList>
   <responses>
      <totalPossibleCandidates>1</totalPossibleCandidates>
      <totalMatches>1</totalMatches>
      <candidates>
         <precisionLevel>1</precisionLevel>
         <formattedStreetAddress>
                36 rue de la Haute Moline
         </formattedStreetAddress>
         <formattedLocationAddress>
                10800 Saint-Julien-les-Villas
         </formattedLocationAddress>
         <identifier>65277882</identifier>
         <precisionCode>S5HPNTS-ZA</precisionCode>
         <sourceDictionary>0</sourceDictionary>
         <geometry>
            <type>Point</type>
            <coordinates>4.10284503209829</coordinates>
            <coordinates>48.28588205764661</coordinates>
            <crs>
               <type>name</type>
               <properties>
                  <name>epsg:4326</name>
               </properties>
            </crs>
         </geometry>
         <address>
            <mainAddressLine>36 rue de la Haute Moline</mainAddressLine>
            <addressLastLine>
                   10800 Saint-Julien-les-Villas
            </addressLastLine>
            <placeName />
            <areaName1>Champagne-Ardenne</areaName1>
            <areaName2>Aube</areaName2>
            <areaName3>Saint-Julien-les-Villas</areaName3>
            <areaName4 />
            <postCode1>10800</postCode1>
            <postCode2 />
            <country>FRA</country>
            <addressNumber>36</addressNumber>
            <streetName>de la Haute Moline</streetName>
            <customFields />
         </address>
         <ranges>
            <lowHouse>34</lowHouse>
            <highHouse>38</highHouse>
            <side>RIGHT</side>
            <oddEvenIndicator>EVEN</oddEvenIndicator>
            <customValues />
         </ranges>
      </candidates>
   </responses>
</GeocodeServiceResponseList>