I am receiving the following error when calling a web service method.
Cannot assign object of type System.Xml.XmlNode[] to an object of type System.String.
The web service is a PHP service. I created my proxy class using wsdl.exe from the wsdl document defined here - http://webservice.intelecast.com.au/traffic/PublicSoap/server.php?wsdl
Below is the proxy client method I am calling.
[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});
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.
Below is the SOAP response i am receiving. This all appears valid.
<?xml version="1.0" encoding="iso-8859-1"?>
<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">
<SOAP-ENV:Body>
<ns1:getAllTrafficResponse
xmlns:ns1="http://webservice.intelecast.com.au/traffic/PublicSoap/server.php">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:TrafficInfo[2]">
<item xsi:type="tns:TrafficInfo">
<id xsi:type="xsd:string">1245632068110</id>
<entryDate xsi:type="xsd:datetime">22/06/2009 10:54:28</entryDate>
<direction xsi:type="xsd:int">0</direction>
<extent xsi:type="xsd:int">1</extent>
<locationCode xsi:type="xsd:int">31593</locationCode>
<countryCode xsi:type="xsd:int">4</countryCode>
<ltn xsi:type="xsd:int">56</ltn>
<diversionAdvice xsi:type="xsd:int">0</diversionAdvice>
<slAdvice xsi:type="xsd:int">0</slAdvice>
<quantifier xsi:type="xsd:int">0</quantifier>
<suppInfoCode xsi:type="xsd:int">0</suppInfoCode>
<addEvent xsi:type="xsd:int">0</addEvent>
<detDivAdvice xsi:type="xsd:int">0</detDivAdvice>
<destinations xsi:type="xsd:int">0</destinations>
<clSourceProblem xsi:type="xsd:int">0</clSourceProblem>
<eventCode xsi:type="xsd:int">802</eventCode>
<timeInfo xsi:type="tns:TimeInfo">
<start xsi:type="xsd:string">21/06/2009 14:00:00</start>
<finish xsi:type="xsd:string">05/11/2009 14:00:00</finish>
<timeZone xsi:type="xsd:string">Australia/Brisbane</timeZone>
</timeInfo>
<location xsi:type="tns:Point">
<lat xsi:type="xsd:float">-27.3112692120521</lat>
<lon xsi:type="xsd:float">153.029100894928</lon>
</location>
<additionalStreetInfo
xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalStreetInfo[1]">
<item xsi:type="tns:AdditionalStreetInfo">
<street xsi:type="xsd:string">Bracken Ridge Rd</street>
<type xsi:type="xsd:string">CROSS</type>
</item>
</additionalStreetInfo>
<address xsi:type="tns:Address">
<streetNumber xsi:type="xsd:string"/>
<streetName xsi:type="xsd:string">Bracken Ridge Rd</streetName>
<suburb xsi:type="xsd:string">Bracken Ridge</suburb>
<state xsi:type="xsd:string">QLD</state>
</address>
</item>
<item xsi:type="tns:TrafficInfo">
<id xsi:type="xsd:string">1245632111995</id>
<entryDate xsi:type="xsd:datetime">22/06/2009 10:55:11</entryDate>
<direction xsi:type="xsd:int">1</direction>
<extent xsi:type="xsd:int">1</extent>
<locationCode xsi:type="xsd:int">31592</locationCode>
<countryCode xsi:type="xsd:int">4</countryCode>
<ltn xsi:type="xsd:int">56</ltn>
<diversionAdvice xsi:type="xsd:int">0</diversionAdvice>
<slAdvice xsi:type="xsd:int">0</slAdvice>
<quantifier xsi:type="xsd:int">0</quantifier>
<suppInfoCode xsi:type="xsd:int">0</suppInfoCode>
<addEvent xsi:type="xsd:int">0</addEvent>
<detDivAdvice xsi:type="xsd:int">0</detDivAdvice>
<destinations xsi:type="xsd:int">0</destinations>
<clSourceProblem xsi:type="xsd:int">0</clSourceProblem>
<eventCode xsi:type="xsd:int">802</eventCode>
<timeInfo xsi:type="tns:TimeInfo">
<start xsi:type="xsd:string">21/06/2009 14:00:00</start>
<finish xsi:type="xsd:string">05/11/2009 14:00:00</finish>
<timeZone xsi:type="xsd:string">Australia/Brisbane</timeZone>
</timeInfo>
<location xsi:type="tns:Point">
<lat xsi:type="xsd:float">-27.3125370752656</lat>
<lon xsi:type="xsd:float">153.042898178101</lon>
</location>
<additionalStreetInfo
xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalStreetInfo[1]">
<item xsi:type="tns:AdditionalStreetInfo">
<street xsi:type="xsd:string">Bracken Ridge Rd</street>
<type xsi:type="xsd:string">CROSS</type>
</item>
</additionalStreetInfo>
<address xsi:type="tns:Address">
<streetNumber xsi:type="xsd:string"/>
<streetName xsi:type="xsd:string">Bracken Ridge Rd</streetName>
<suburb xsi:type="xsd:string">Bracken Ridge</suburb>
<state xsi:type="xsd:string">QLD</state>
</address>
</item>
</return>
</ns1:getAllTrafficResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>