Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Calling a web api 2.0 webservice call from xamarin.forms

$
0
0

Hello, thanks for any help in advance. I'm getting an unhandled exception error while calling my call. It is hosted via my local iis at this time. I can make the call in the browser and this returns all the json i need. However, this just isn't working for me. Attached is the code and error I'm getting in the device log.

` public async void GetSampleOrders()
{
try
{
HttpResponseMessage response = await client.GetAsync("api/samples?userid=3869");
if (response.IsSuccessStatusCode)
{
var formatters = new OurObservableCollection() { new JsonMediaTypeFormatter() };

                var list = await response.Content.ReadAsAsync<OurObservableCollection<FSP2_Sample_GetSampleOrders>>();
                SampleList = list;
            }
            else
            {
                SampleList = new OurObservableCollection<FSP2_Sample_GetSampleOrders>();
            }
        }
        catch (Exception e)
        {
            string error = e.Message;
            throw;
        }
    }`

thanks so much for your help! This is a real tough bug to crack.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>