Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Random WebService Timeouts

RobAtKansysRobAtKansys Member ✭✭

I am getting random webservice timeouts and I can't figure out why, it is only happening when calling the webservice from the Xamarin app. If I test the webservice in SoapUI, and even spam it with requests, I get 100% success and return values. But when calling the same webservice in Xamarin about 30% of the calls never return and eventually timeout. But on the backend I and see the calls 100% of the calls made it to the webservice and worked, but Xamarin isn't getting the response 30% of the time.

Webservice is C# asmx webservice, which is added via the connected services in the Xamarin project.

The call is pretty simple

PhoneWSServiceReference.PhoneWebServiceSoapClient wsclient = new PhoneWebServiceSoapClient(EndPointName); WSHelper.SetWSTimeOut(ref wsclient, 20); BaseResponse response = wsclient.UserLogin(UserName, Password);

But 30% of the time I get "System.TimeoutException: 'The operation has timed out.'"

I am using the IsBusy flag, setting it to true just before the webservice call and false after it. Is there a better way to call the asmx webservices?

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post the full log of this error, so that we can try to address this question according to the log?

    Besides, you need to make sure that the network is of good quality and stable.

  • RobAtKansysRobAtKansys Member ✭✭

    @jezh said:
    Could you please post the full log of this error, so that we can try to address this question according to the log?

    Besides, you need to make sure that the network is of good quality and stable.

    Not sure what logs you would need, have never had to use the logs in xamarin until now. I believe the network is just fine, unfortunately I gave up on using the connected services client and switch to HttpWebRequest calls. Simple HttpWebRequest calls works 100% of the time.

  • JuanFHJuanFH Member

    I have a similar problem.
    I have a WCF web service and in Xamarin Android I import the wdsl as a web reference.
    Normally it works fine, but sometimes it gives errors due to timeout.

    In the trace we can see:

    at System.Net.HttpWebRequest.MoveNext ()
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke....

    or directly:

    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke

    It seems to happen more often when the device is idle for a while.

Sign In or Register to comment.