title: Mono for Android or Java and WCF
body: <p>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#. </p>
  
  <p>I have 2 questions: </p>
  
  <ol>
  <li>How do I consume a WCF webservice using Mono for android. </li>
  <li><p>If I am to use java how would I call a method that looks like the one below:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", UriTemplate = "/MyMethod",
             RequestFormat = WebMessageFormat.Json,
             ResponseFormat = WebMessageFormat.Json)]
  void MyMethod(CustomObjectFromDataContract c_Object);
  </code></pre></li>
  </ol>
  
  <p>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</p>
  
  <pre><code>  [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});
      }
  </code></pre>
  
  <p>The invoke is the one throwing the exception.</p>