title: What's the problem with this web service method?
body: <p><strong>Update: <a href="https://stackoverflow.com/questions/1953132/whats-the-problem-with-this-web-service-method/2119426#2119426">Problem solved</a>.</strong></p>
  
  <hr>
  
  <p>I have to call a web service method (dduLogin), which returns 3 parameters. I generated the code by "adding a web reference" through visual studio. This is the relevant part of the wsdl:</p>
  
  <pre><code>&lt;message name="dduLoginRequest"&gt;
      &lt;part name="Ticket" type="xsd:string"/&gt;
      &lt;part name="ServiceId" type="xsd:string"/&gt;
      &lt;part name="Market" type="xsd:string"/&gt;
      &lt;part name="Application" type="xsd:string"/&gt;
      &lt;part name="Brand" type="xsd:string"/&gt;
      &lt;part name="Sincom" type="xsd:string"/&gt;
      &lt;part name="CertificationSystem" type="xsd:string"/&gt;
  &lt;/message&gt;  
  
  
  &lt;message name="dduLoginResponse"&gt;
      &lt;part name="Ticket" type="xsd:string"/&gt;
      &lt;part name="LoginId" type="xsd:string"/&gt;
      &lt;part name="Return" type="xsd:string"/&gt;
  &lt;/message&gt;
  &lt;portType name="dduPortType"&gt;
      &lt;operation name="dduLogin"&gt;
          &lt;input message="tns:dduLoginRequest"/&gt;
          &lt;output message="tns:dduLoginResponse"/&gt;
      &lt;/operation&gt;
  
  
  &lt;/portType&gt;
  &lt;binding name="dduBinding" type="tns:dduPortType"&gt;
      &lt;soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
      &lt;operation name="dduLogin"&gt;
          &lt;soap:operation soapAction="urn:ddu#dduLogin" style="rpc"/&gt;
          &lt;input&gt;
              &lt;soap:body use="encoded" namespace="urn:ddu" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
          &lt;/input&gt;
          &lt;output&gt;
              &lt;soap:body use="encoded" namespace="urn:ddu" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
          &lt;/output&gt;
      &lt;/operation&gt;
  
  
  &lt;/binding&gt;
  </code></pre>
  
  <p>It's possible to call this method, and this is the xml that is returned:</p>
  
  <pre><code>&lt;SOAP-ENV:Body&gt;&lt;ns1:dduLoginResponse xmlns:ns1="urn:ddu"&gt;
      &lt;Ticket xsi:type="xsd:string"&gt;M-S%40%2AT6%2F%26179G%23%24%25%25%2A%40%40LDNT%27BP%3F9C%2CRY9-Z8C0C%3D0JXD%24_%2A%5EFKF%26DV%3BIP_8%3DM.E3VBDU7%3CAB%5C9_%22%3A%29E9%2CYO6%5C8I%5D6J%5EZ%60%2C8%3A%26%60%25U%3B.6A4G%2BO%5EQA%5DINI4X2%247%29M%2C%3B%3DZ%5CQ%3C%3A%27%3AB%5CSUB%3F9GAPC%3DRV%3CA%5E%2CE7%40L3%3F%3FY%215T%27%40B%3FKUJIH%3D%2B150Q%3CD%3A%3B%21D%22%3B%3ED%60%60%0A&lt;/Ticket&gt;
      &lt;LoginId xsi:type="xsd:string"&gt;22459&lt;/LoginId&gt;
      &lt;Return xsi:type="xsd:string"&gt;0&lt;/Return&gt;&lt;/ns1:dduLoginResponse&gt;
  &lt;/SOAP-ENV:Body&gt;
  </code></pre>
  
  <p>But after the call, not all the return values are filled as they should be. This is the by Visual Studio generated code for that method:</p>
  
  <pre><code>[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:ddu#dduLogin", RequestNamespace="urn:ddu", ResponseNamespace="urn:ddu")]
  [return: System.Xml.Serialization.SoapElementAttribute("LoginId")]
  public string dduLogin(ref string Ticket, string ServiceId, string Market, string Application, string Brand, string Sincom, string CertificationSystem, out string Return) {
      object[] results = this.Invoke("dduLogin", new object[] {
          Ticket,
          ServiceId,
          Market,
          Application,
          Brand,
          Sincom,
          CertificationSystem});
      Ticket = ((string)(results[1]));
      Return = ((string)(results[2]));
      return ((string)(results[0]));
  }
  </code></pre>
  
  <p>It's like the results are in the wrong order (ticket should be <code>results[0]</code>), and LoginId should be <code>results[1]</code> and <code>results[1]</code> is also empty (null). </p>
  
  <p>What's the problem here? Am I missing something? Is it a bad wsdl? Is it the Visual Studio Web Service Proxy generator? Someone had this before? Any suggestions on how to solve this?</p>
  
  <p>Btw, a co-worker is able to call this web service successfully using another web service toolset (totally not .NET related).</p>
  
  <p><strong>Edit</strong>: here is the output from wsdl.exe for the wsdl in question:</p>
  
  <pre><code>C:\temp&gt;wsdl https://eu.link.fiatauto.com/tsi/DDUWsAut.php?wsdl
  Microsoft (R) Web Services Description Language Utility
  [Microsoft (R) .NET Framework, Version 2.0.50727.3038]
  Copyright (C) Microsoft Corporation. All rights reserved.
  Warning: This web reference does not conform to WS-I Basic Profile v1.1.
  R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal" for the u
  se attribute in all soapbind:body, soapbind:fault, soapbind:header and soapbind:
  headerfault elements.
    -  Input element soapbind:body of operation 'dduLogin' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduLogin' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduLogout' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduLogout' on portType 'dduBindi
  ng' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduDir' on portType 'dduBinding'
  from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduDir' on portType 'dduBinding'
   from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduGetGroupList' on portType 'ddu
  Binding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduGetGroupList' on portType 'dd
  uBinding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduGetGroupFileList' on portType
  'dduBinding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduGetGroupFileList' on portType
   'dduBinding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduCreate' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduCreate' on portType 'dduBindi
  ng' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduOpen' on portType 'dduBinding'
   from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduOpen' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduClose' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduClose' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduAbort' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduAbort' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduRead' on portType 'dduBinding'
   from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduRead' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduWrite' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduWrite' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduGet' on portType 'dduBinding'
  from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduGet' on portType 'dduBinding'
   from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduPost' on portType 'dduBinding'
   from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduPost' on portType 'dduBinding
  ' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduGetAtt' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduGetAtt' on portType 'dduBindi
  ng' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduPostAtt' on portType 'dduBindi
  ng' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduPostAtt' on portType 'dduBind
  ing' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduTransaction' on portType 'dduB
  inding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduTransaction' on portType 'ddu
  Binding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduCommit' on portType 'dduBindin
  g' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduCommit' on portType 'dduBindi
  ng' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduRollback' on portType 'dduBind
  ing' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduRollback' on portType 'dduBin
  ding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduLoginDescr' on portType 'dduBi
  nding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduLoginDescr' on portType 'dduB
  inding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduIsRemoteDebug' on portType 'dd
  uBinding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduIsRemoteDebug' on portType 'd
  duBinding' from namespace 'urn:ddu'.
    -  Input element soapbind:body of operation 'dduLogClient' on portType 'dduBin
  ding' from namespace 'urn:ddu'.
    -  Output element soapbind:body of operation 'dduLogClient' on portType 'dduBi
  nding' from namespace 'urn:ddu'.
  
  For more details on the WS-I Basic Profile v1.1, see the specification
  at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.
  
  Writing file 'C:\temp\ddu.cs'.
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I've followed <a href="https://stackoverflow.com/questions/1953132/whats-the-problem-with-this-web-service-method/1953148#1953148">@Benjamin's</a> advice, and used WCF to create a client. I did have some problems though: the wsdl contained some spaces where there shouldn't be spaces, and the encoding of the service apparently was ISO-8859-1, so I ended up creating my own <a href="http://msdn.microsoft.com/en-us/library/ms751486.aspx" rel="nofollow noreferrer">CustomTextMessageEncoder</a>.</p>
  
  <p>As I am anticipating more problems down the road with this service, I'm still very interested in getting this to work with the old style web service references, so if anybody has another clue why the returned xml isn't parsed right, here is the url to the wsdl:</p>
  
  <blockquote>
    <p><a href="https://eu.link.fiatauto.com/tsi/DDUWsAut.php?wsdl" rel="nofollow noreferrer">https://eu.link.fiatauto.com/tsi/DDUWsAut.php?wsdl</a></p>
  </blockquote>
  
  <p>Note that removing the spaces (which was the problem I encountered while trying the service reference way) did <em>not</em> solve this issue (the output from wsdl.exe is still the same without the spaces).</p>