title: Delphi SOAP Envelope and WCF
body: <p>I am working on a system that provides a soap interface. One of the systems that are going to use the interface is coded in Delphi 7. The web service is developed with WCF, basic http binding, SOAP 1.1.</p>
  
  <p>If I use SOAP UI (JAVA), the service works properly. But Delphi seems to do special things here ;)</p>
  
  <p>This is how the message looks like in SOAP UI:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.xxx.de/xxx"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;ser:GetCustomer&gt;
           &lt;!--Optional:--&gt;
           &lt;ser:GetCustomerRequest&gt; &lt;!-- this is a data contract --&gt;
              &lt;ser:Id&gt;?&lt;/ser:Id&gt;
           &lt;/ser:GetCustomerRequest&gt;
        &lt;/ser:GetCustomer&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I am not a delphi developer , but I developed a simple test client to see what's going wrong. This what Delphi sends as a SOAP envelope.</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"&gt;
    &lt;SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="http://services.xxx.de/xxx"&gt;
      &lt;NS1:GetCustomer xmlns:NS1="http://services.xxx.de/xxx"&gt;
        &lt;GetCustomerRequest href="#1"/&gt;
      &lt;/NS1:GetCustomer&gt;
      &lt;NS2:GetCustomerRequest id="1" xsi:type="NS2:GetCustomerRequest"&gt;
        &lt;Id xsi:type="xsd:int"&gt;253&lt;/Id&gt;
      &lt;/NS2:GetCustomerRequest&gt;
    &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>WCF throws an error that is in German language... ;)</p>
  
  <blockquote>
    <p>Es wurde das Endelement "Body" aus Namespace "<a href="http://schemas.xmlsoap.org/soap/envelope/" rel="noreferrer">http://schemas.xmlsoap.org/soap/envelope/</a>" erwartet. Gefunden wurde "Element "NS2:GetCustomerRequest" aus Namespace "<a href="http://services.xxx.de/xxx" rel="noreferrer">http://services.xxx.de/xxx</a>"". Zeile 1, Position 599.</p>
  </blockquote>
  
  <p>Means something like</p>
  
  <blockquote>
    <p>The Body was expected. But instead the Element "NS2:GetCustomerReques" was found.</p>
  </blockquote>
  
  <p>Now my questions is: Can I somehow change the way Delphi creates the envelope? Or are the ways to make WCF work with such message formats? Any help is greatly appreciated!</p>