I am currently using Mono for Android to develop a mobile application. I have been trying to consume a WCF web service by adding a web reference to it but I can't seem to make the call that way. I am now considering to bite the bullet and rewrite the code using Java which I am not as good at as I am with C#.
I have 2 questions:
- How do I consume a WCF webservice using Mono for android.
If I am to use java how would I call a method that looks like the one below:
[OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/MyMethod", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] void MyMethod(CustomObjectFromDataContract c_Object);
When I make the call I get a MessageBox that says Unhandled exception System.Net.WebException:. When I step into the code I see that the error happens when you call
[System.Web.Services.Protocols.SoapDocumentMethodAttribute ("http://tempuri.org/IMyService/MyMethod", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void MyMethod([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] CustomObjectFromDataContract c_Object) {
this.Invoke("MyMethod", new object[] {
c_Object});
}
The invoke is the one throwing the exception.