[英]Xamarin Forms SOAP WebService, how to get data?
I have searched for a few days now and cannot figure this out. 我已经搜索了几天,无法解决这个问题。 I would like to get my results from a WebService.
我想从WebService获得结果。 I am using PCL and as far as I can tell we cannot use string as a variable when returning, only void.
我正在使用PCL,据我所知,返回时不能将字符串用作变量,只能是void。
WebServiceSoapClient client = new WebServiceSoapClient();
string result = client.SetDriverAvailAsync(varUserid, varPassword, varLocation, varDateTime);
Above is what I'm using to call the method. 以上是我用来调用该方法的内容。 And the web service was written as such.
Web服务就是这样编写的。
[WebMethod]
public string SetDriverAvail(string drivername, string password, string location, string datetime)
{
if (location == "" || datetime == "")
{
return "failed";
}
It does a bunch of other stuff. 它还有很多其他的东西。 Then returns "success" or "failed".
然后返回“成功”或“失败”。 Bottom line is.
底线是。 When i make my Service Reference for a Portable Form in Xamarin the only methods it makes in the Connection Service are public voids.
当我在Xamarin中为可移植表单创建服务参考时,它在连接服务中所做的唯一方法是公共无效。
If I make a Service Reference in all other projects like ASP Web Page, ect. 如果我在所有其他项目(例如ASP网页)中做“服务参考”,等等。 It builds these methods differently.
它以不同的方式构建这些方法。 And does let you return a string.
并让您返回一个字符串。
CONFUSED ... THANKS 困惑...谢谢
这可能是一个简单的答案,但是我建议您阅读Xamarin Web服务简介。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.