Select to view content in your preferred language

Geocoding using SOAP API

927
4
08-23-2012 10:09 AM
HubertLo
Emerging Contributor
I have been using the TA_Streets_US_10 with REST API for geocoding for a while. However I have a need to call TA_Streets_US_10 using SOAP instead from some back end codes. The back end codes will work much better if the results are in XML. I have been testing the call using a free application called soapUI. I can get the geocode to work but I cannot get the results back in the Spatial Reference that I want. I want wkid 102100 web mercator for the coordinates.

My REST API call:
http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Streets_US_10/GeocodeServer/findAddre...

Using soapUI request generation, I was able to construct this XML request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.esri.com/schemas/ArcGIS/10.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:FindAddressCandidates>
         <Address>
            <PropertyArray>
               <!--Zero or more repetitions:-->
               <PropertySetProperty>
                  <Key>Street</Key>
                  <Value>400 Market Street</Value>
               </PropertySetProperty>
               <PropertySetProperty>
                  <Key>City</Key>
                  <Value>San Francisco</Value>
               </PropertySetProperty>
               <PropertySetProperty>
                  <Key>State</Key>
                  <Value>CA</Value>
               </PropertySetProperty>
               <PropertySetProperty>
                  <Key>ZIP</Key>
                  <Value>94111</Value>
               </PropertySetProperty>
               <PropertySetProperty>
                  <Key>outSR</Key>
                  <Value>{"wkid":102100}</Value>
               </PropertySetProperty>
            </PropertyArray>
         </Address>
         <PropMods>
            <PropertyArray>
               <PropertySetProperty>
                  <Key>outSR</Key>
                  <Value>{"wkid":102100}</Value>
               </PropertySetProperty>            
            </PropertyArray>
         </PropMods>
      </ns:FindAddressCandidates>
   </soapenv:Body>
</soapenv:Envelope>


This is part of what came back:
               <Record xsi:type="tns:Record">
                  <Values xsi:type="tns:ArrayOfValue">
                     <Value xsi:type="xsd:int">1</Value>
                     <Value xsi:type="tns:PointN">
                        <X>-122.3984001482126</X>
                        <Y>37.791717541197158</Y>
                     </Value>
                     <Value xsi:type="xsd:short">100</Value>
                     <Value xsi:type="xsd:string">L</Value>
                     <Value xsi:type="xsd:double">-122.39839924502249</Value>
                     <Value xsi:type="xsd:double">37.791719039988372</Value>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string">450</Value>
                     <Value xsi:type="xsd:string">400</Value>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string">451</Value>
                     <Value xsi:type="xsd:string">401</Value>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string">Market</Value>
                     <Value xsi:type="xsd:string">St</Value>
                     <Value xsi:type="xsd:string"/>
                     <Value xsi:type="xsd:string">San Francisco</Value>
                     <Value xsi:type="xsd:string">San Francisco</Value>
                     <Value xsi:type="xsd:string">CA</Value>
                     <Value xsi:type="xsd:string">CA</Value>
                     <Value xsi:type="xsd:string">94111</Value>
                     <Value xsi:type="xsd:string">94105</Value>
                     <Value xsi:type="xsd:string">400 Market St, San Francisco, CA, 94111</Value>
                  </Values>
               </Record>


As you can see, setting the "outSR" as part of the Address or PropMods have no effect on the output coordinates. It is still in wkid 4326 (WGS84). What do I need to set to change the output coordinate system? Can someone show me the piece of XML I need or where I can see an example? If that can be done in the REST API, there must be a way to do it in SOAP.
0 Kudos
4 Replies
JeffJacobson
Frequent Contributor
I think it would be
<ProjectedCoordinateSystem><WKID>102100</WKID></ProjectedCoordinateSystem>
0 Kudos
HubertLo
Emerging Contributor
I think it would be
<ProjectedCoordinateSystem><WKID>102100</WKID></ProjectedCoordinateSystem>


My guess as well but where do you put it? The PorpMods and Address sections expect PropertyArray.
0 Kudos
JeffJacobson
Frequent Contributor
I've never had to construct a SOAP request manually.  I've only used the SOAP endpoint through the .NET proxy library.

I would write a .NET app using this library to call the SOAP endpoint, then use Fiddler to capture the request when the program is running.
0 Kudos
HubertLo
Emerging Contributor
I've never had to construct a SOAP request manually.  I've only used the SOAP endpoint through the .NET proxy library.

I would write a .NET app using this library to call the SOAP endpoint, then use Fiddler to capture the request when the program is running.


The problem is the dll from your link does not work in runtime. I dug up the older ArcGIS 9.3 dll and that got me a bit further. The actual geocode call still failed because of some encoding issue. Nevertheless it revealed enough in Fiddler2 for me to use it in soapUI where it worked properly. This is what the SOAP xml has to look like: (this is the GeocodeAddress call but the FindAddressCandidate one is 98% similar)
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <GeocodeAddress xmlns="http://www.esri.com/schemas/ArcGIS/10.0">
      <Address xmlns="">
        <PropertyArray>
          <PropertySetProperty>
            <Key>Street</Key>
            <Value xsi:type="xsd:string">400 Market Street</Value>
          </PropertySetProperty>
          <PropertySetProperty>
            <Key>City</Key>
            <Value xsi:type="xsd:string">San Francisco</Value>
          </PropertySetProperty>
          <PropertySetProperty>
            <Key>State</Key>
            <Value xsi:type="xsd:string">CA</Value>
          </PropertySetProperty>
          <PropertySetProperty>
            <Key>Zip</Key>
            <Value xsi:type="xsd:string">94111</Value>
          </PropertySetProperty>
          <PropertySetProperty>
           <Key>Country</Key>
           <Value xsi:type="xsd:string">US</Value>
          </PropertySetProperty>
        </PropertyArray>
      </Address>
      <PropMods xmlns="">
        <PropertyArray>
          <PropertySetProperty>
            <Key>OutputSpatialReference</Key>
            <Value xmlns:q2="http://www.esri.com/schemas/ArcGIS/10.0" xsi:type="q2:ProjectedCoordinateSystem">
              <WKID>102100</WKID>
            </Value>
          </PropertySetProperty>
        </PropertyArray>
      </PropMods>
    </GeocodeAddress>
  </soap:Body>
</soap:Envelope>
0 Kudos