none
WCF service issue in Mono for Android mobile applicaiton RRS feed

  • Question

  • Hi, I am working on Mono Android Mobile Applicaiton, I have problem while consuming WCF Services in my mobile application. How can i get ServiceClient in the application in order give the Binding type and Endpoint How to specify **Endpoint **and how to get **ServicClient **in MonoAndroid Mobile Application? In normal .Net Client(dotnet web application) when we add Service to the client we will get ServiceClient automatically In DotNet Client We will get WebService.GPFServerService.GPFServerClient oCls; BasicHttpBinding bGPFBinding = new BasicHttpBinding("BasicHttpBinding"); string sEPAddress = System.Configuration.ConfigurationManager.AppSettings.Get("GPFServerService_EndPoint"); EndpointAddress ep = new EndpointAddress(sEPAddress); oCls = new WebService.GPFServerService.GPFServerClient(bGPFBinding, ep); textbox1.text = oCls.GetAllCountries(); _ Where as in Mono Android I am getting WebService.GPFServerService oCls = new WebService.GPFServerService(); textbox1.text = oCls.GetAllCountries(); and there is no ServiceClient to give the Binding and Endpoint. But i am getting all the Operation Contracts. Note:- I found this url:- "docs.xamarin.com/guides/cross-platform/application_fundamentals/introduction_to_web_services" and follwed SubHeading 4.Consuming WCF Services.. I got GPFService.cs and ServiceReferences.ClientConfig files by which i can get ServiceClient ,But by this i am able to call the operationcontracts in Async mode only. i.e GPFServiceClient ogpfClient = new GPFServiceClient(); ogpfClient.GetAllCountriesAsync(); ogpfClient.GetAllCountriesCompleted += new EventHandler(ogpfclient_GetAllCountriesCompleted); As per requirement I need to call services Synchronously. So is there any way how to get the ServiceClient and how could i specify the endpointaddress and binding in order to call the services synchronously. Please help me out, It's urgent requirement.

    Any sample application with detailed steps which helps me is appreciated.

    Thanks in Advance Sreeni

    Monday, August 26, 2013 7:48 AM

All replies

  • Hi,

    Please try to check the following:
    Consume REST services from Android: Use the AndroidHttpClient class, as described in http://developer.android.com/reference/android/net/http/AndroidHttpClient.html.

    Consume SOAP services from Android: Once again, Android doesn't provide any out-of-box support for SOAP services. But you can find some third party open source libraries. For example, according to the tutorial on http://www.codeproject.com/KB/android/webservice-from-android.aspx, you can use the kSOAP 2 library.

    Anyway, I recommend you to use REST services, which are supported by almost all platforms, because it is simply HTTP. Most devices do not have built-in support for SOAP services (although Windows Phone has some basic support). So if you use SOAP, you may have a difficult time to work with your devices, as you have to search from a lot of open source libraries and try to make one work.

    Thanks.

    Tuesday, August 27, 2013 7:52 AM