title: Error Consuming a RPC/Encoded SOAP web service in .NET
body: <p>I am receiving the following error when calling a web service method.</p>
  
  <p><strong>Cannot assign object of type System.Xml.XmlNode[] to an object of type System.String.</strong></p>
  
  <p>The web service is a PHP service. I created my proxy class using wsdl.exe from the wsdl document defined here - <a href="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php?wsdl" rel="nofollow noreferrer">http://webservice.intelecast.com.au/traffic/PublicSoap/server.php?wsdl</a></p>
  
  <p>Below is the proxy client method I am calling.</p>
  
  <pre><code>[System.Web.Services.Protocols.SoapRpcMethodAttribute("http://webservice.intelecast.com.au/traffic/PublicSoap/server.php#getAllTraffic", RequestNamespace="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php", ResponseNamespace="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php")]
   [return: System.Xml.Serialization.SoapElementAttribute("return")]
   public TmcInfo[] getAllTmcTraffic(string[] States, int[] EventCodes) {
       object[] results = this.Invoke("getAllTmcTraffic", new object[] { //Error here
                   States,
                   EventCodes});
  </code></pre>
  
  <p>It appear the proxy class is failing to deal with the complex types/arrays defined in the wsdl...I am unsure now how to proceed can't find a solution on the web anywhere.</p>
  
  <p>Below is the SOAP response i am receiving. This all appears valid.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &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/"
         xmlns:tns="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:getAllTrafficResponse 
              xmlns:ns1="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php"&gt;
              &lt;return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:TrafficInfo[2]"&gt;
                  &lt;item xsi:type="tns:TrafficInfo"&gt;
                      &lt;id xsi:type="xsd:string"&gt;1245632068110&lt;/id&gt;
                      &lt;entryDate xsi:type="xsd:datetime"&gt;22/06/2009 10:54:28&lt;/entryDate&gt;
                      &lt;direction xsi:type="xsd:int"&gt;0&lt;/direction&gt;
                      &lt;extent xsi:type="xsd:int"&gt;1&lt;/extent&gt;
                      &lt;locationCode xsi:type="xsd:int"&gt;31593&lt;/locationCode&gt;
                      &lt;countryCode xsi:type="xsd:int"&gt;4&lt;/countryCode&gt;
                      &lt;ltn xsi:type="xsd:int"&gt;56&lt;/ltn&gt;
                      &lt;diversionAdvice xsi:type="xsd:int"&gt;0&lt;/diversionAdvice&gt;
                      &lt;slAdvice xsi:type="xsd:int"&gt;0&lt;/slAdvice&gt;
                      &lt;quantifier xsi:type="xsd:int"&gt;0&lt;/quantifier&gt;
                      &lt;suppInfoCode xsi:type="xsd:int"&gt;0&lt;/suppInfoCode&gt;
                      &lt;addEvent xsi:type="xsd:int"&gt;0&lt;/addEvent&gt;
                      &lt;detDivAdvice xsi:type="xsd:int"&gt;0&lt;/detDivAdvice&gt;
                      &lt;destinations xsi:type="xsd:int"&gt;0&lt;/destinations&gt;
                      &lt;clSourceProblem xsi:type="xsd:int"&gt;0&lt;/clSourceProblem&gt;
                      &lt;eventCode xsi:type="xsd:int"&gt;802&lt;/eventCode&gt;
                      &lt;timeInfo xsi:type="tns:TimeInfo"&gt;
                          &lt;start xsi:type="xsd:string"&gt;21/06/2009 14:00:00&lt;/start&gt;
                          &lt;finish xsi:type="xsd:string"&gt;05/11/2009 14:00:00&lt;/finish&gt;
                          &lt;timeZone xsi:type="xsd:string"&gt;Australia/Brisbane&lt;/timeZone&gt;
                      &lt;/timeInfo&gt;
                      &lt;location xsi:type="tns:Point"&gt;
                          &lt;lat xsi:type="xsd:float"&gt;-27.3112692120521&lt;/lat&gt;
                          &lt;lon xsi:type="xsd:float"&gt;153.029100894928&lt;/lon&gt;
                      &lt;/location&gt;
                      &lt;additionalStreetInfo 
                        xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalStreetInfo[1]"&gt;
                          &lt;item xsi:type="tns:AdditionalStreetInfo"&gt;
                              &lt;street xsi:type="xsd:string"&gt;Bracken Ridge Rd&lt;/street&gt;
                              &lt;type xsi:type="xsd:string"&gt;CROSS&lt;/type&gt;
                          &lt;/item&gt;
                      &lt;/additionalStreetInfo&gt;
                      &lt;address xsi:type="tns:Address"&gt;
                          &lt;streetNumber xsi:type="xsd:string"/&gt;
                          &lt;streetName xsi:type="xsd:string"&gt;Bracken Ridge Rd&lt;/streetName&gt;
                          &lt;suburb xsi:type="xsd:string"&gt;Bracken Ridge&lt;/suburb&gt;
                          &lt;state xsi:type="xsd:string"&gt;QLD&lt;/state&gt;
                      &lt;/address&gt;
                  &lt;/item&gt;
                  &lt;item xsi:type="tns:TrafficInfo"&gt;
                      &lt;id xsi:type="xsd:string"&gt;1245632111995&lt;/id&gt;
                      &lt;entryDate xsi:type="xsd:datetime"&gt;22/06/2009 10:55:11&lt;/entryDate&gt;
                      &lt;direction xsi:type="xsd:int"&gt;1&lt;/direction&gt;
                      &lt;extent xsi:type="xsd:int"&gt;1&lt;/extent&gt;
                      &lt;locationCode xsi:type="xsd:int"&gt;31592&lt;/locationCode&gt;
                      &lt;countryCode xsi:type="xsd:int"&gt;4&lt;/countryCode&gt;
                      &lt;ltn xsi:type="xsd:int"&gt;56&lt;/ltn&gt;
                      &lt;diversionAdvice xsi:type="xsd:int"&gt;0&lt;/diversionAdvice&gt;
                      &lt;slAdvice xsi:type="xsd:int"&gt;0&lt;/slAdvice&gt;
                      &lt;quantifier xsi:type="xsd:int"&gt;0&lt;/quantifier&gt;
                      &lt;suppInfoCode xsi:type="xsd:int"&gt;0&lt;/suppInfoCode&gt;
                      &lt;addEvent xsi:type="xsd:int"&gt;0&lt;/addEvent&gt;
                      &lt;detDivAdvice xsi:type="xsd:int"&gt;0&lt;/detDivAdvice&gt;
                      &lt;destinations xsi:type="xsd:int"&gt;0&lt;/destinations&gt;
                      &lt;clSourceProblem xsi:type="xsd:int"&gt;0&lt;/clSourceProblem&gt;
                      &lt;eventCode xsi:type="xsd:int"&gt;802&lt;/eventCode&gt;
                      &lt;timeInfo xsi:type="tns:TimeInfo"&gt;
                          &lt;start xsi:type="xsd:string"&gt;21/06/2009 14:00:00&lt;/start&gt;
                          &lt;finish xsi:type="xsd:string"&gt;05/11/2009 14:00:00&lt;/finish&gt;
                          &lt;timeZone xsi:type="xsd:string"&gt;Australia/Brisbane&lt;/timeZone&gt;
                      &lt;/timeInfo&gt;
                      &lt;location xsi:type="tns:Point"&gt;
                          &lt;lat xsi:type="xsd:float"&gt;-27.3125370752656&lt;/lat&gt;
                          &lt;lon xsi:type="xsd:float"&gt;153.042898178101&lt;/lon&gt;
                      &lt;/location&gt;
                      &lt;additionalStreetInfo 
                         xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalStreetInfo[1]"&gt;
                          &lt;item xsi:type="tns:AdditionalStreetInfo"&gt;
                              &lt;street xsi:type="xsd:string"&gt;Bracken Ridge Rd&lt;/street&gt;
                              &lt;type xsi:type="xsd:string"&gt;CROSS&lt;/type&gt;
                          &lt;/item&gt;
                      &lt;/additionalStreetInfo&gt;
                      &lt;address xsi:type="tns:Address"&gt;
                          &lt;streetNumber xsi:type="xsd:string"/&gt;
                          &lt;streetName xsi:type="xsd:string"&gt;Bracken Ridge Rd&lt;/streetName&gt;
                          &lt;suburb xsi:type="xsd:string"&gt;Bracken Ridge&lt;/suburb&gt;
                          &lt;state xsi:type="xsd:string"&gt;QLD&lt;/state&gt;
                      &lt;/address&gt;
                  &lt;/item&gt;
              &lt;/return&gt;
          &lt;/ns1:getAllTrafficResponse&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>