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

Web service working fine in Android but not in IOS

$
0
0

Hi Guys, I have created simple project which invokes asmx web service in json format,

and error is_ "500, ReasonPhrase: 'Internal Server Error"_

the web service is working fine for Android and getting results in Android emulator, but the same code is working for IOS
can you please help me to resolve this

Here is the code
public async void GetCategories()
{
if (NetworkCheck.IsInternet())
{

                var client = new System.Net.Http.HttpClient();
                var formcontent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair<string,string>("StrCustomerID","C001"),
                new KeyValuePair<string, string>("StrCustomerPwd","12345")
            });

                categorylist ObjContactList = new categorylist();
                var response = await client.PostAsync("http://localhost/mynewservice/WebService.asmx/GetCategories",formcontent);

                if (response.IsSuccessStatusCode)
                {
                    string Categoryjson = await response.Content.ReadAsStringAsync();


                    if (Categoryjson != "" && Categoryjson != "Invalid Entry")
                    {
                        //Converting JSON Array Objects into generic list
                        ObjContactList = JsonConvert.DeserializeObject<categorylist>(Categoryjson);
                    }
                    //Binding listview with server response
                    listviewcategories.ItemsSource = ObjContactList.Table;

                }
                else
                {
                    await DisplayAlert("JSONParsing", "No network is available.", "Ok");
                }
                //Hide loader after server response
                ProgressLoader.IsVisible = false;
            }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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