0
votes

I'm currently walking through the example how to use ASMX webservices from Xamarin Forms at https://developer.xamarin.com/guides/xamarin-forms/web-services/consuming/asmx/ . I read the text and checked the example. I tried to build the same structure using my own webservice but unfortunately this does not work.

The problem is: While in example there are methods like "todoService.BeginGetTodoItems" and "todoService.EndGetTodoItems" but in my webservices they do not exist. I only have e.g. "Login", but I do not have "BeginLogin" and "EndLogin".

So I could call it sync (which works fine) but not async.

How could I get / create the begin- and end- methods?

Many thanks!

Update: Just to clarify: In Reference.cs of ASMXService of TodoASMX Sample App, there are these methods included e.g. for GetTodoItems:

public TodoItem[] GetTodoItems()
public System.IAsyncResult BeginGetTodoItems(System.AsyncCallback callback, object asyncState)
public TodoItem[] EndGetTodoItems(System.IAsyncResult asyncResult)
public void GetTodoItemsAsync()
public void GetTodoItemsAsync(object userState)
private void OnGetTodoItemsCompleted(object arg)

But within my own ASMX Webserivce, only these methods are available e.g. for the default HelloWorld:

public string HelloWorld()
public void HelloWorldAsync()
public void HelloWorldAsync(object userState)
private void OnHelloWorldOperationCompleted(object arg)

So you see, BeginHelloWorld and EndHelloWorld are missing...

Update2: Problem is repeatable easily: Download the example provided by article https://developer.xamarin.com/guides/xamarin-forms/web-services/consuming/asmx/ at https://developer.xamarin.com/samples/xamarin-forms/WebServices/TodoASMX . It works fine. Now delete the webreference ASMXService from iOS Project and manually add it again. URL is http://todoasmxservice.azurewebsites.net/TodoService.asmx and type should be ".NET 2.0 Web Services" because it's the ASMX sample, not the WCF sample. Now I get the following error messages because BEGIN and END Methods do not exist anymore:

/TodoASMX/iOS/SoapService.cs(87,87): Error CS1061: Type TodoASMX.iOS.ASMXService.TodoService' does not contain a definition forBeginGetTodoItems' and no extension method BeginGetTodoItems' of typeTodoASMX.iOS.ASMXService.TodoService' could be found. Are you missing an assembly reference? (CS1061) (TodoASMX.iOS)

What am I doing wrong? What do I need to do additionally if I just remove the webservices and add it again? Many thanks!!

1

1 Answers

0
votes

Web Service could not be reach if we don't add this to add reference menu to our project.

Try to right click your project references > Add web Reference > enter url of .asmx