我正在开发一个使用第三方.asmx
Web服务的应用程序。我在我的应用程序中使用PCL(便携式类库)。在pcl中使用asmx webservice
所以我想在我的应用程序中使用这些.asmx
网络服务。问题是PCL不支持传统的Web服务,即.asmx
。它支持WCF
网络服务。
我看了很多文章,他们建议我从wsdl
写WCF
web服务。但由于所有Web服务都是第三方,因此我需要在客户端应用程序(在调用Web服务的位置)编写代理,以便将WCF
调用转换为.asmx
。
此外,我已经尝试使用PCL这个例子。 我使用this ASMX Web服务
public class PerformLogIn : ILogInService
{
public string LogIn(string code)
{
ServiceReference1.WeatherSoapClient obj = new ServiceReference1.WeatherSoapClient();
obj.GetCityForecastByZIPAsync(code);
ServiceReference1.WeatherReturn get = new ServiceReference1.WeatherReturn();
return (get.Temperature);
}
但我没有收到任何结果。 那么有人有想法该怎么做?
您不必做任何转换。就像你通常那样使用“添加服务参考”。 – 2014-09-24 05:40:55
@JohnSaunders:Thnx的回复..我做到了......这是给我'asych'方法。其返回类型是“空白”。那么如何得到服务的回应? – Rohit 2014-09-24 06:37:06