简体   繁体   English

Web服务和Monodroid

[英]Webservice and Monodroid

I am consuming a webservice following the guide from this tutorial using Mono For Android using c#. 我正在按照本教程中的指南使用Web服务 ,使用Mono For Android通过c#。 Which is running perfectly fine. 这运行得很好。 Now i have created my own webservice and created a simple test method GetMyName(String Name) which is written in vb.net. 现在,我创建了自己的Web服务,并创建了一个简单的测试方法GetMyName(String Name) ,该方法用vb.net编写。
If i run this webservice from a remote machine VIA webbrowser it works fine. 如果我从远程计算机VIA Webbrowser运行此Web服务,则可以正常工作。 But its breaking on this line of code when run using Android Emulator. 但是,当使用Android Emulator运行时,它破坏了这一行代码。 (This code is part of the automatically generated code Refference.cs) (此代码是自动生成的代码Refference.cs的一部分)

public string GetMyName(string Name) {
            object[] results = this.Invoke("GetMayName", new object[] {
                        Name});
            return ((string)(results[0]));
        }

I am calling my webservice like this 我这样打电话给我的网络服务

 webserviceformobile.Service1 webservice = new webserviceformobile.Service1();
 String myName = webservice.GetMyName("RIZWAN");

when i run webservice from browser it outputs the following line: 当我从浏览器运行webservice时,它输出以下行:

<string xmlns="http://webserviceformobile.com/">rizwan</string>

What i am doing wrong ? 我做错了什么? Is my webservice is returning data in wrong format ? 我的Web服务是否以错误的格式返回数据? In example which is working fine i am calling webservice like this 在运行良好的示例中,我正在像这样调用webservice

com.cdyne.wsf.Weather we = new com.cdyne.wsf.Weather();
com.cdyne.wsf.WeatherReturn wr = new com.cdyne.wsf.WeatherReturn();
wr = we.GetCityWeatherByZIP("02138");

Can you make sure that your webservice is reachable from the emulator ? 您可以确保从仿真器访问您的Web服务吗? This is the exact problem that I was facing. 这是我面临的确切问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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