title: Consuming Java Web Service from C# .Net Application with Complex Type Return
body: <p>I'm Having this problem:<br/>
  I've developed a WS exposed in a Java EE application, this is the wsdl:types definition<br/></p>
  
  <pre><code>    &lt;wsdl:types&gt;
    &lt;schema elementFormDefault="qualified" targetNamespace="http://endpoint.ws.solution.client.com" xmlns="http://www.w3.org/2001/XMLSchema"&gt;
     &lt;import namespace="http://model.ws.solution.client.com"/&gt;
     &lt;element name="invoke"&gt;
      &lt;complexType&gt;
       &lt;sequence&gt;
        &lt;element name="cbte_modo" type="xsd:string"/&gt;
        &lt;element name="cuit_emisor" type="xsd:string"/&gt;
        &lt;element name="pto_vta" type="xsd:int"/&gt;
        &lt;element name="cbte_tipo" type="xsd:int"/&gt;
        &lt;element name="cbte_nro" type="xsd:int"/&gt;
        &lt;element name="cbte_fch" type="xsd:string"/&gt;
        &lt;element name="imp_total" type="xsd:double"/&gt;
        &lt;element name="cod_autorizacion" type="xsd:string"/&gt;
       &lt;/sequence&gt;
      &lt;/complexType&gt;
     &lt;/element&gt;
     &lt;element name="invokeResponse"&gt;
      &lt;complexType&gt;
       &lt;sequence&gt;
        &lt;element name="invokeReturn" type="tns1:ComprobanteConstatarResponse"/&gt;
       &lt;/sequence&gt;
      &lt;/complexType&gt;
     &lt;/element&gt;
    &lt;/schema&gt;
    &lt;schema elementFormDefault="qualified" targetNamespace="http://model.ws.solution.client.com" xmlns="http://www.w3.org/2001/XMLSchema"&gt;
     &lt;complexType name="ComprobanteConstatarResponse"&gt;
      &lt;sequence&gt;
       &lt;element name="code" nillable="true" type="xsd:string"/&gt;
       &lt;element name="fch_proceso" nillable="true" type="xsd:string"/&gt;
       &lt;element name="msg" nillable="true" type="xsd:string"/&gt;
       &lt;element name="resultado" nillable="true" type="xsd:string"/&gt;
      &lt;/sequence&gt;
     &lt;/complexType&gt;
    &lt;/schema&gt;
   &lt;/wsdl:types&gt;
  </code></pre>
  
  <p>This Web Service exposes only one method called "Invoke", this is the method definition in it's java class: </p>
  
  <pre><code>@WebMethod
      public ComprobanteConstatarResponse invoke(String cbte_modo, String cuit_emisor, Integer pto_vta, Integer cbte_tipo,
                                                  Integer cbte_nro, String cbte_fch, Double imp_total, String cod_autorizacion){
  
          ComprobanteConstatarRequest request = new ComprobanteConstatarRequest(cbte_modo, cuit_emisor, pto_vta, cbte_tipo, cbte_nro, cbte_fch, imp_total, cod_autorizacion);
          ComprobanteConstatarResponse response = this.wsConnectorFacade.validateComprobante(request);
          return response;
      }
  </code></pre>
  
  <p>As you can see, the response is a Java Class called "ComprobanteConstatarResponse".<br/>
  Also, I've developed a simple C# Console Application to test calling the WS from a .NET application. So I've added the Service Reference as many tutorials said and coded the call: <br/></p>
  
  <pre><code> static void Main(string[] args)
          {
              ComprobanteConstatarService webService = new ComprobanteConstatarService();
  
              ComprobanteConstatarResponse response = new ComprobanteConstatarResponse();
              response = webService.invoke("CAE","20351240181",4001,1,1223,"20140815",100.5,"CAE999999");
              Console.WriteLine("Resultado: " + response.resultado + " - MSG: " + response.msg);
              Console.ReadLine();
          }
  </code></pre>
  
  <p>The call executes successfuly, but the service returns the complex type (ComprobanteConstatarResponse) with all null values. I've debbuged the code and could see that the java application receives all the parameters and build the response correctly, but when it returns to the C# application, the object has null values.</p>
  
  <p>Any ideas?</p>