简体   繁体   中英

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. I am using PCL and as far as I can tell we cannot use string as a variable when returning, only 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.

[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.

If I make a Service Reference in all other projects like ASP Web Page, ect. It builds these methods differently. And does let you return a string.

CONFUSED ... THANKS

这可能是一个简单的答案,但是我建议您阅读Xamarin Web服务简介。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM