hmm, i wonder if the 417 error is from lighthttpd or the api and if so what it receives. <br>Do you know if there is a "sandbox" server api to play with ? i gues not...<br><br>thanks for your download code, mine is just a oneliner (i'm lazy, i know :)
<br>XmlDocument doc = new XmlDocument(); doc.Load(strUrl);<br><br>i'll digg further in the REST api examples<br><br><div><span class="gmail_quote">2008/1/21, Igor Brejc <<a href="mailto:igor.brejc@gmail.com">igor.brejc@gmail.com
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Rob wrote:<br>> i'm trying to update a node from my project (C#)<br>> when i do the web request, the GetResponse returns with "The remote
<br>> server returned an error: (417) Expectation Failed."<br>><br>> do i need to change the content type ? or do i have to include<br>> action='modify' in the node ?<br>><br>><br>>             string strXml = "<?xml version='
1.0'<br>> encoding='UTF-8'?><osm version='0.5' generator='OSMTAGEDITOR'><node<br>> id='30226967' lat='50.8489498 ' lon='5.6878935' user='rubke'
<br>> timestamp='2008-01-20T14:56:52Z'><tag k='amenity' v='place_of_worship'<br>> /><tag k='denomination' v='christian/catholic' /><tag k='name'<br>> v='St-Servaasbasiliek' /><tag k='religion' v='christian'
<br>> /></node></osm>";<br>><br>>             HttpWebRequest HttpWRequest =<br>> (HttpWebRequest)WebRequest.Create("<a href="http://api.openstreetmap.org/api/0.5/node/30226967">http://api.openstreetmap.org/api/0.5/node/30226967
</a>");<br>>             HttpWRequest.PreAuthenticate = true;<br>>             HttpWRequest.Credentials = new NetworkCredential("xxxx",<br>> "xxxx");<br>>             HttpWRequest.Method
 = "PUT";<br>>             HttpWRequest.ContentLength = strXml.Length;<br>>             HttpWRequest.ContentType = "text/plain";<br>>             using (StreamWriter writer = new<br>> StreamWriter(
HttpWRequest.GetRequestStream()))<br>>             {<br>>                 writer.WriteLine (strXml);<br>>             }<br>>             WebResponse response = HttpWRequest.GetResponse();<br>><br>>             using (StreamReader reader = new
<br>> StreamReader(response.GetResponseStream()))<br>>             {<br>>                 while ( reader.Peek() != -1)<br>>                 {<br>>                     Console.WriteLine(reader.ReadLine());<br>
>                 }<br>>             }<br>> ------------------------------------------------------------------------<br>Hello Rob,<br><br>I haven't tried your code, Have you checked the HTTP traffic using some
<br>http tracker?<br>This is what MSDN says about this error:     Equivalent to HTTP status<br>417. ExpectationFailed indicates that an expectation given in an Expect<br>header could not be met by the server.<br>Also:<br>
            HttpWRequest.ContentLength = strXml.Length;<br><br>ContentLength is set in bytes, which is not necessary the same as the<br>length of your string - it depends on encoding you use. Try to<br>explicitly specify encoding.
<br><br>BTW: I haven't yet implemented the code for uploading to OSM server, but<br>when downloading, I use WebClient class instead of<br>HttpWebRequest/Response. Example (which works for me):<br><br>        public osm GetMap (double bottomLeftLng, double bottomLeftLat,
<br>double topRightLng, double topRightLat)<br>        {<br>            WebClient webClient = new WebClient ();<br><br>            UriBuilder requestUrl = new UriBuilder(GetCommandUrl ("map"));<br>            requestUrl.Query
 = String.Format<br>(System.Globalization.CultureInfo.InvariantCulture,<br>                "bbox={0},{1},{2},{3}", bottomLeftLng, bottomLeftLat,<br>topRightLng, topRightLat);<br><br>            byte[] data = webClient.DownloadData
 (requestUrl.Uri);<br><br>            osm map = null;<br><br>            using (MemoryStream stream = new MemoryStream (data))<br>            {<br>                XmlSerializer serializer = new XmlSerializer (typeof (osm));
<br>                map = (osm)serializer.Deserialize (stream);<br>            }<br><br>            return map;<br>        }<br><br>Regards,<br>Igor<br><br><br></blockquote></div><br>