Beispiel: XML POST-Anforderung und -Antwort

Im Folgenden ist ein Beispiel für eine XML POST-Anforderung an den Geocode-Dienst aufgeführt. In diesem Beispiel wird veranschaulicht, wie die Funktion „Versatz von Mittellinie“ in customPreferences aktiviert wird und wie die Felder matchOnAddressNumber und matchOnStreetName im mustMatchFields-Objekt eingestellt werden. Für die Aktivierung der Einstellungen von mustMatchFields ist das Feld matchMode auf CUSTOM gesetzt.

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>

Nachfolgend wird die XML-Antwort dargestellt, die von der vorherigen Anforderung zurückgegeben wurde.

<?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>