在Mono Android移动应用程序中使用WCF服务时出现问题 [英] Problem in consuming WCF Services in Mono Android Mobile Application

查看:103
本文介绍了在Mono Android移动应用程序中使用WCF服务时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我正在使用Mono Android Mobile Applicaiton,我在移动应用程序中使用WCF服务时遇到问题。如何在应用程序中获取ServiceClient,以便给出Binding类型和端点



在正常的.Net客户端(dotnet web应用程序)中,当我们向客户端添加服务时将自动获得ServiceClient



在DotNet客户端我们将获得



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();




在Mono Android中我得到的地方



WebService.GPFServerService oCls = new WebService.GPFServerService(); textbox1.text = oCls.GetAllCountries();



并且没有ServiceClient来提供绑定和端点。但是我得到了所有的操作合同。



我们在MonoAndroid应用程序中没有配置文件我希望.....



注意: - 我找到了这个网址,然后是SubHeading 4.Consuming WCF Services .. http://docs.xamarin.com/guides/cross-platform/application_fundamentals/introduction_to_web_services



我获得了GPFService.cs(服务类)和ServiceReferences.ClientConfig( ServiceClient Config )文件我有ServiceClient,但通过这个我能够只在异步模式下调用operationcontracts。即


GPFServiceClient ogpfClient = new GPFServiceClient(); ogpfClient.GetAllCountriesAsync(); ogpfClient.GetAllCountriesCompleted + = new EventHandler(ogpfclient_GetAllCountriesCompleted);



根据要求,我需要同步调用服务。那么有什么方法可以获得 ServiceClient 以及如何指定 endpointaddress和binding 以便同步调用服务。



Mono for Android或WCF服务有问题吗?



请帮帮我,这是迫切需要。



在此先感谢



Sreeni

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

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.

We don't have config files in MonoAndroid Application i hope.....

Note:- I find this url and follwed SubHeading 4.Consuming WCF Services.. http://docs.xamarin.com/guides/cross-platform/application_fundamentals/introduction_to_web_services

I got GPFService.cs(Service Class) and ServiceReferences.ClientConfig(ServiceClient Config) files by which i got 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.

Is this problem with Mono for Android or WCF Services?

Please help me out, It's urgent requirement.

Thanks in Advance

Sreeni

推荐答案

检查这些链接..

使用C#MonoAnDroid应用程序在Android应用程序中使用Web服务 [ ^ ]

Comsuming WC使用Android的F服务 [ ^ ]
Check these links..
Consume a Web Service in an Android application with C# MonoAnDroid application[^]
Comsuming WCF Services With Android[^]


这篇关于在Mono Android移动应用程序中使用WCF服务时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆