[Mono-dev] .Net Webservice

Ghostdog m.schlembach at ceeyafree.de
Wed Feb 20 20:15:35 UTC 2013


Hi all,
I am new to IPhone development and Mono.
I have written a small webservice in C# as above.
[WebService(Namespace = "http://ibs.service/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hallo";
        }
    }

The webservice is working well in a C# client and on the webpage that the
service shows up.
But I recieve an error when trying to call the webservice from Mono

  at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult
asyncResult) [0x00043] in
/Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:739 
  at System.Net.HttpWebRequest.GetRequestStream () [0x00057] in
/Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:757 
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
(System.String method_name, System.Object[] parameters) [0x00069] in
/Developer/MonoTouch/Source/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:367 

My Code
                         this.btnSend.TouchUpInside += delegate 
			{
				ibswebservice.Service1 myservice = new ibswebservice.Service1();
				try 
				{
					
					myservice.HelloWorldCompleted += HelloWorld_CompletedHandler;
					string result = "";
					result = String.Format("LALA {0}",myservice.HelloWorld(""));
					UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
					this.lblResult.Text = String.Format("Ergebnis {0}",result);

					
					//this.lblResult.Text = result;
				}
				catch (Exception e)
				{
					this.lblResult.Text = e.StackTrace.ToString();
				}
			};
                private void HelloWorld_CompletedHandler(object sender,
HelloWorldCompletedEventArgs args)
		{
			UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			this.InvokeOnMainThread (delegate {
				this.lblResult.Text = String.Format("Ergebnis {0}",args.Result);
				if (null != args.Error)
				{
					this.lblResult.Text = String.Format("Fehler {0}",args.Error);
				}
			});
		}

Thank you very much for any idea.



--
View this message in context: http://mono.1490590.n4.nabble.com/Net-Webservice-tp4658651.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list