I am currently learning various functions for German forms. I created a web service that searches for weather information and sends a HTTPResponseMessage. I did not get any errors every time I call the API.
I change the path to the API and now I get the Jason pars error:
public async Tasks < String & gt; Weather () {var parameter = new dictionary & lt; String, string & gt; {{"Lat", "33.92649137"}, {"lon", "-83.343567"}}; Try {var xml = Wait MobileService.InvokeApiAsync & lt; String & gt; ("GetWeather", HttpMethod.Get, Parameter); Return xml; } Hold (exception e) {DisplayAlert ("error", e.ToString (), "closed"); Return "failed"; }}
My WebSaver API:
Namespace Mobile Weather Controllers {Public Class Test Controller: Table Controller & lt; Weather & gt; {Secure Override Zero Start (HTTP Controller Contents Container Contex) {base.Initialize (Controller Consultant); MobileServiceContext Reference = New MobileServiceContext (); DomainManager = New EntityDomainManager & lt; Weather & gt; (Context, request, service); } Public IQueryable & lt; Weather & gt; GetAllTodoItems () {return query (); } /// & lt; Summary & gt; Get weather information for location based on /// longitude and latitude values. /// & lt; / Summary & gt; /// & lt; Param name = "lat" & gt; The latitude of the project site & Lt; / Param & gt; /// & lt; Param name = "lon" & gt; Longitude of project site & Lt; / Param & gt; [HttpGET] [Route ("API / Get Weather")] Public ASICNC Task & LT; HTTPRPS Pormes & gt; GetWeather (String Lawn, String Lite) {HTTP Client Client = New HTTP Client (); Client.BaseAddress = New Uri ("http://forecast.weather.gov/MapClick.php"); String Yuri = "http://forecast.weather.gov/MapClick.php?lat=" + + Latitude "and Loan =" + Lawn + "and FCSTEP = Vimal" "; // Create a Weather Item Weather Season = New Weather (); HttpResponseMessage Feedback = Wait for Customer.GetSync (Yuri); XDocument xml = New XDocument (); Xml = XDocument.Parse (Wait for response. ContentReadrestringSync (), LoadOptices.NONE); / * Weather.Temperature = Convert.ToInt32 (xml.Descendants ("temperature") descendant ("value") element (0) .value;); season; lawn = lone; weather wave = ax Season = Execution = Convert. ToInt32 (xml.Descendants ("Chance-of-Rain"). Descent ("Value"). Element (0). Value); Weather.Forecast = xml.Descendants ("wordedForecast") Descendant ("text"). Element (0) .value; weather.Hazard = xml.Descendants ("threats") descendants ("status of danger"). Element (0) value; weather; date and time = Date time.Now; * / / Query for data that we want! New HttpResponseMessage return () {content = response.Content};} Public HttpResponseMessage Post () {New HttpResponseMessage Return} {Content = New String Con Content ("post: test message")}; } Public HttpResponseMessage Put () {New HTTPRPS Pacemess Back () {Content = New String Content ("PUT: Test Message")}; }}}
Update => I change the path to GetWeather method in [root ("API / Get Wiperer") and now I'm getting a parse error.
< Div class = "post-text" itemprop = "text">
OK, this will require a way to point to API / Get Wide to find my mobile client. For parsing error, as soon as the esior comes down from the bottom, I will fix it. The error seems to be due to the fact that InvokeApiAynync is expected to have a JSON object by default and I am responding with a HTTPResponseMessage.
No comments:
Post a Comment