Home > Back-end >  Xamarin Forms added web service is not working
Xamarin Forms added web service is not working

Time:03-08

I added a connection service to my Xamarin.Forms project via WCF, then added these codes:

private async void NumberToWord(ulong num)
    {
        NumConvert.NumberConversionSoapTypeClient client = new NumConvert.NumberConversionSoapTypeClient(NumConvert.NumberConversionSoapTypeClient.EndpointConfiguration.NumberConversionSoap12);
        var result = await client.NumberToWordsAsync(num);
        labell.Text = result.ToString();
    }

But when i called this function it gives an error like this:

System.Xml.XmlException: 'Element 'NumberToWordsAsyncResponse' with namespace name 'http://www.dataaccess.com/webservicesserver/' was not found. Line 4, position 6.'

Thanks.

CodePudding user response:

I solved the problem while adding web service referance, checked the "Generate Synchronous Operations" checkbox on specifying the client options section: enter image description here

With this you don't need to use only asynchronous functions but also synchronous ones too which is how i solved my problem.

  • Related