title: SOAP Server in JAVA <-> SOAP Client in C#
body: <p>I have a problem with a SOAP Server written in JAVA, the project is running as a windows service and not as a webserver (e.g. GLASSFISH).
  So the problem is, everytime I make a request from a C# .NET client, the JAVA SOAP server is not able to parse the request. The called function gets a NULL value as input parameter.</p>
  
  <p>The communictaion with JAVA clients, SoapUI, aso. works perfectly but the .NET (C#) clients are sending maleformed requests I think. Because the project is already existing and installed a lot of times, I can't develope it in C#. 
  I've read a lot of threads with similar problems, but I couldn't find any solution for my case.</p>
  
  <p>I just wrote some simple test cases to show you the problem in a short way.</p>
  
  <p><strong>JAVA Code:</strong></p>
  
  <pre><code>main.java
  //...
  Endpoint endpoint = Endpoint.create(new WS());
  endpoint.publish("http://0.0.0.0:8081/test"); 
  //...
  
  WS.java
  //...
  @WebService(serviceName = "WS")
  @SOAPBinding(style = SOAPBinding.Style.RPC)
  public class WS {
      @WebMethod(operationName = "echo")
      public String echo(@WebParam(name = "val") String val) {
          return val;
      }
  }
  </code></pre>
  
  <p><strong>The WSDL:</strong></p>
  
  <pre><code>&lt;definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webj/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webj/" name="WS"&gt;
  &lt;types/&gt;
  &lt;message name="echo"&gt;
      &lt;part name="val" type="xsd:string"/&gt;
  &lt;/message&gt;
  &lt;message name="echoResponse"&gt;
      &lt;part name="return" type="xsd:string"/&gt;
  &lt;/message&gt;
  &lt;portType name="WS"&gt;
      &lt;operation name="echo"&gt;
          &lt;input wsam:Action="http://webj/WS/echoRequest" message="tns:echo"/&gt;
          &lt;output wsam:Action="http://webj/WS/echoResponse" message="tns:echoResponse"/&gt;
      &lt;/operation&gt;
  &lt;/portType&gt;
  &lt;binding name="WSPortBinding" type="tns:WS"&gt;
      &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/&gt;
      &lt;operation name="echo"&gt;
          &lt;soap:operation soapAction=""/&gt;
          &lt;input&gt;
              &lt;soap:body use="literal" namespace="http://webj/"/&gt;
          &lt;/input&gt;
          &lt;output&gt;
              &lt;soap:body use="literal" namespace="http://webj/"/&gt;
          &lt;/output&gt;
      &lt;/operation&gt;
  &lt;/binding&gt;
  &lt;service name="WS"&gt;
      &lt;port name="WSPort" binding="tns:WSPortBinding"&gt;
          &lt;soap:address location="http://xxx:8081/test"/&gt;
      &lt;/port&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>C# Request</strong></p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;SOAP-ENV:Header/&gt;
      &lt;s:Body&gt;
          &lt;echo xmlns="http://webj/"&gt;
              &lt;val xmlns="http://webj/"&gt;TEST&lt;/val&gt;
          &lt;/echo&gt;
      &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p><strong>JAVA Request</strong></p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:std="http://webj/"&gt;
      &lt;SOAP-ENV:Header/&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;std:echo&gt;
              &lt;val&gt;TEST&lt;/val&gt;
          &lt;/std:echo&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>The problem seems to be the namespave of the parameter "val":</p>
  
  <pre><code> &lt;echo xmlns="http://webj/"&gt;
     &lt;val xmlns="http://webj/"&gt;TEST&lt;/val&gt;
   &lt;/echo&gt;
  </code></pre>
  
  <p>I've already tested this case in JAVA by adding a namespace to the parameter "val" manually and got the same problem. In C# I've tried with generated WebReferences and ServiceReferences.</p>
  
  <p>(e.g. ServiceReference)</p>
  
  <pre><code>TestService.WSClient proxy = new TestService.WSClient();
  String results = proxy.echo("TEST");
  </code></pre>
  
  <p>Can someone tell me how I can get the JAVA server compatible for .NET requests please?
  Thanks for help!</p>