Infrastructure Map Server General Discussion

Infrastructure Map Server General Discussion

Reply
Valued Mentor
gluckett
Posts: 383
Registered: ‎10-10-2003
Message 1 of 8 (1,471 Views)
Accepted Solution

GeoRest PUT with AIMS 2013

1471 Views, 7 Replies
08-02-2012 03:27 PM

Hi All, has anyone tried a PUT with XML with GeoRest with AIMS 2013?

 

I am getting an "Update Done" with a responseText but the data actually isn't updating.

 

Any clues? I am using IIS 7.5

 

 

Aha!  You need to remove the read-only tag - unfortunately, you have to install MapGuide Maestro because there is not an option (at least I can't find it) in Autodesk Infrastructure Studio 2013 to remove this flag from the Datasource.

 

maestro_readonly_georest.png

Valued Mentor
gluckett
Posts: 383
Registered: ‎10-10-2003
Message 2 of 8 (1,374 Views)

Re: GeoRest PUT with AIMS 2013

09-12-2012 09:36 PM in reply to: gluckett

Steps to reproduce:

1. Modify the existing restcfg.xml in the C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2013\www\GeoREST\conf\Sheboygan\Property\ folder to (A) point to AIMS and (B) Make XML editable:

<Resource uripart="property">
<Source type="MapGuide">
<FeatureSource>Library://Samples/Sheboygan/Data/Parcels.FeatureSource</FeatureSource>
<FeatureClass>SHP_Schema:smileytongue:arcels</FeatureClass>
<ServerIp>127.0.0.1</ServerIp>
<ServerPort>2802</ServerPort>
</Source>

<Representation renderer="JSON" pattern=".json"/>
<Representation renderer="XML" pattern=".xml">
<Method name="GET" />
<Method name="PUT" />
<Method name="POST" />
<Method name="DELETE" />
</Representation>

 

2. Restart IIS to refresh the Config in GeoRest 

 

3. Test the site to make sure you can see the parcel data:

georest_aims2013.png

 

4. Now write the PUT code to change the RACRE from 14.25 to 500

<script language=javascript>

var xml='<?xml version="1.0" encoding="UTF-8" ?><FeatureSet><Features><Feature>';
xml=xml+ '<Property><Name>RACRE</Name>';
xml=xml+ '<Value>500</Value></Property>';
xml=xml+ '</Feature></Features></FeatureSet>';


var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function(evt)
{
if(this.readyState == 4)
{
alert(this.responseText);
}
};
xmlhttp.open("PUT",'http://localhost/rest/data/property/1.xml',true);
xmlhttp.setRequestHeader("Content-Type","application/xml; charset=UTF-8");
xmlhttp.send(xml);
}
</script>

 

 

This returns "Update Done" but the data actually does not update (this worked with MG2011)

Load the 1.html to verify 

Valued Mentor
gluckett
Posts: 383
Registered: ‎10-10-2003
Message 3 of 8 (1,271 Views)

Re: GeoRest PUT with AIMS 2013

10-06-2012 05:45 AM in reply to: gluckett

Aha!  You need to remove the read-only tag - unfortunately, you have to install MapGuide Maestro because there is not an option (at least I can't find it) in Autodesk Infrastructure Studio 2013 to remove this flag from the Datasource.

 

maestro_readonly_georest.png

Contributor
ericsn.tang
Posts: 15
Registered: ‎01-05-2014
Message 4 of 8 (164 Views)

Re: GeoRest PUT with AIMS 2013

07-03-2014 12:21 AM in reply to: gluckett

Hi Gluckett,

 

I still cannot make the PUT - Georest work! I created a new feature source which the data source is in sqlite format. I have tried to use SDF, SQLite. I using AIMS 2014 and the server is Windows Server 2008 R2 64-bit.

 

The restcfg.xml is:

 

<Resource uripart="building">
   <Source type="MapGuide">
    <FeatureSource>Library://Samples/Sheboygan/Data/BuildingOutlines.FeatureSource</FeatureSource>
    <FeatureClass>SHP_Schema:BuildingOutlines</FeatureClass>
   </Source>
   <Representation renderer="JSON" pattern=".json"/>
   <Representation renderer="XML" pattern=".xml"><Method name="PUT" /><Method name="POST" /><Method name="GET" /></Representation>
   <Representation renderer="Template" pattern=".html" mimetype="text/html" >
    <Templates section="BUILDING" prefix="BUILDING_">
      <Many file="building_map_html_many.tpl" />
      <Single file="building_map_html_single.tpl" />
      <None file="building_map_html_none.tpl" />
      <Error file="building_map_html_error.tpl" />
    </Templates>
    <Method name="GET" defaultcount="20" maxcount="500" />
   </Representation>

 

The building_map_html_single.tpl is:

 

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="/css/voka_int.css"> {{#BUILDING}} </head> <script> function UpdateFeature() {   var xml = '<?xml version="1.0" encoding="UTF-8"?><FeatureSet><Features><Feature>';   xml = xml+'<Property><Name>NAME</Name><Value>'+document.getElementById('feature_NAME').value+'</Value></Property>';   xml = xml+'</Feature></Features></FeatureSet>';                   

  var xmlhttp;

  if (window.XMLHttpRequest)

  {

    xmlhttp=new XMLHttpRequest();

    xmlhttp.onreadystatechange = function(evt)

    {

     if(this.readyState == 4)

     {

        alert(this.responseText);

     }

    };

    xmlhttp.open("PUT",'/rest/data/building/{{BUILDING_ID}}.xml',true);

    xmlhttp.setRequestHeader("Content-Type","application/xml; charset=UTF-8");

    xmlhttp.send(xml);

  }

} </script>

<table width="100%" height="50" id="feature_TABLE" class="mainfont">

               <tr>

                              <th height="10" align="left" valign="left" bgcolor="#E6E6E6" >Edit building data</th>

  </tr>

               <tr>

                              <td class="mainfont" height="10" >

                              <strong ><em>ID: </em></strong><input type="text" name="feature_ID" id="feature_ID" value="{{BUILDING_ID}}" size="17"/></td>

               </tr>

               <tr>

                              <td class="mainfont" height="10" >

                              <strong ><em>Name: </em></strong><input type="text" name="feature_NAME" id="feature_NAME" value="{{BUILDING_NAME}}" size="17"/></td>

                              </td>

               </tr>

               </table>

               <input type="button" name="send" id="button" value="Send" onClick="UpdateFeature()" size="17"/>

{{/BUILDING}}

</td>

</tr>

</table> </body> </html>

 

I found the feature class of Maestro is "Default: BuildingOutlines". It is not work if I change the feture class of restcfg.xml file to "Default: BuildingOutlines. Is there anything missing?

 

Valued Mentor
gluckett
Posts: 383
Registered: ‎10-10-2003
Message 5 of 8 (155 Views)

Re: GeoRest PUT with AIMS 2013

07-03-2014 06:52 AM in reply to: ericsn.tang
Make sure your SQLLITE file is editable in Windows Security (perhaps try "ALL USERS" - then restrict as you go).

Contributor
ericsn.tang
Posts: 15
Registered: ‎01-05-2014
Message 6 of 8 (151 Views)

Re: GeoRest PUT with AIMS 2013

07-03-2014 06:51 PM in reply to: gluckett

Thanks. I have grant the permission with write to the user "Everyone" and restart the machine. Finally It still cannot be updated via the georest! :smileysad:

Valued Mentor
gluckett
Posts: 383
Registered: ‎10-10-2003
Message 7 of 8 (118 Views)

Re: GeoRest PUT with AIMS 2013

07-11-2014 06:18 AM in reply to: ericsn.tang
Are you able to see the data read-only?
Contributor
ericsn.tang
Posts: 15
Registered: ‎01-05-2014
Message 8 of 8 (103 Views)

Re: GeoRest PUT with AIMS 2013

07-13-2014 05:44 PM in reply to: gluckett

The data can be displayed without any problem. Should I use the SDF file directly instead of <FeatureSource>Library://GEOTECHNICAL/Slope.FeatureSource</FeatureSource>?

 

Thanks :smileyhappy:

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.