I hope someone can help me with a problem I have with C# and a SOAP webservice.
I am using visual studio 2010, and I added a soap webservice as a web reference.
Now I'm trying to call a function of that webservice that returns a 2 dimensional array. But I get an exception at the C# side that states there is an error in the XML document.
When I call the same soap function from a PHP client it parses the response correctly.
The webservice server is made in PHP, and the WSDL file is generated dynamically.
I have to say I'm new to SOAP so it could be an error in either the WSDL file or the respone.
WSDL:
<?xml version="1.0" ?> <definitions name="Test" targetNamespace="urn:Test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:Test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types xmlns="http://schemas.xmlsoap.org/wsdl/"> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Test"> <complexType name="ArrayOfStrings"> <complexContent> <restriction base="SOAP-ENC:Array"> <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" /> </restriction> </complexContent> </complexType> <complexType name="EmployeePersonalData"> <complexContent> <restriction base="SOAP-ENC:Array"> <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ArrayOfStrings[]" /> </restriction> </complexContent> </complexType> </schema> </types> <message name="getAllEmployeesRequest"> <part name="requestedFields" type="tns:ArrayOfStrings" /> </message> <message name="getAllEmployeesResponse"> <part name="result" type="tns:EmployeePersonalData" /> </message> <portType name="TestPort"> <operation name="getAllEmployees"> <input message="tns:getAllEmployeesRequest" /> <output message="tns:getAllEmployeesResponse" /> </operation> </portType> <binding name="TestBinding" type="tns:TestPort"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getAllEmployees"> <soap:operation soapAction="http://schemas.xmlsoap.org/soap/envelope/#EmployeeData#getAllEmployees" /> <input> <soap:body use="encoded" namespace="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body use="encoded" namespace="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> </binding> <service name="TestService"> <documentation /> <port name="TestPort" binding="tns:TestBinding"> <soap:address location="http://localhost/services/service.php" /> </port> </service> </definitions>
Response:
<?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Test" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <SOAP-ENV:getAllEmployeesResponse> <result SOAP-ENC:arrayType="ns1:ArrayOfStrings[2]" xsi:type="ns1:EmployeePersonalData"> <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="ns1:ArrayOfStrings"> <item xsi:type="xsd:string">1</item> <item xsi:type="xsd:string">2</item> </item> <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="ns1:ArrayOfStrings"> <item xsi:type="xsd:string">3</item> <item xsi:type="xsd:string">4</item> </item> </result> </SOAP-ENV:getAllEmployeesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>


Sign In
Create Account

Back to top









