my activity.cs file code is
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using webserviceexample.com.cdy.ws;
using System.Net;
using System.IO;
using System.Text;
namespace webserviceexample
{
[Activity(Label = "webserviceexample", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button button = FindViewById<Button>(Resource.Id.MyButton);
TextView lable = FindViewById<textview>(Resource.Id.lbltxt);
com.cdy.ws.Androidhelloo dd = new com.cdy.ws.Androidhelloo();
lable.Text = dd.HelloWorld();
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}</textview>
My webservice code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace AndroidHello
{
[WebService(Namespace = "http://127.0.0.1:8012/Androidhelloo.asmx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class Androidhelloo : System.Web.Services.WebService
{
[SoapDocumentMethod(Action = "http://127.0.0.1:8012/Androidhelloo.asmx")]
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
public string Namespace { get; set; }
}
}
Error come---
#pragma warning disable 1591
namespace webserviceexample.com.cdy.ws {
using System;
using System.Web.Services;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using System.ComponentModel;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="AndroidhellooSoap", Namespace="http://127.0.0.1:8012/Androidhelloo.asmx")]
public partial class Androidhelloo : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback HelloWorldOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
public Androidhelloo() {
this.Url = "http://127.0.0.1:8012/Androidhelloo.asmx";
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
public event HelloWorldCompletedEventHandler HelloWorldCompleted;
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://127.0.0.1:8012/Androidhelloo.asmx", RequestNamespace = "http://127.0.0.1:8012/Androidhelloo.asmx", ResponseNamespace = "http://127.0.0.1:8012/Androidhelloo.asmx", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string HelloWorld() {
<big> object[] results = this.Invoke("HelloWorld", new object[0]);</big>
return ((string)(results[0]));
}
public void HelloWorldAsync() {
this.HelloWorldAsync(null);
}
public void HelloWorldAsync(object userState) {
if ((this.HelloWorldOperationCompleted == null)) {
this.HelloWorldOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHelloWorldOperationCompleted);
}
this.InvokeAsync("HelloWorld", new object[0], this.HelloWorldOperationCompleted, userState);
}
private void OnHelloWorldOperationCompleted(object arg) {
if ((this.HelloWorldCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.HelloWorldCompleted(this, new HelloWorldCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
public delegate void HelloWorldCompletedEventHandler(object sender, HelloWorldCompletedEventArgs e);
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class HelloWorldCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal HelloWorldCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
}
#pragma warning restore 1591