Pertti

Pertti

  • NA
  • 1
  • 0

How make soap request using C#

Jul 12 2007 6:35 AM
Hello,

I am tried do query to web service. To content I am put next one:

strSoapEnvelope = "<?xml version=\"1.0\"?>";
strSoapEnvelope +=
"<soap:Envelope ";
strSoapEnvelope +=
"xmlns:xsi = \"http://schemas.xmlsoap.org/wsdl/\" ";
strSoapEnvelope +=
"xmlns:xsd= \"http://www.w3.org/2001/XMLSchema\" ";
strSoapEnvelope +=
"xmlns:soap= \"http://schemas.xmlsoap.org/wsdl/soap/\">";
strSoapEnvelope +=
"<soap:Body>";
strSoapEnvelope +=
"<Method xmlns=\"http://schemas.xmlsoap.org/wsdl/\">";
strSoapEnvelope +=
"<Str1>string_1</Str1>";
strSoapEnvelope +=
"<Str2>string_2</Str2>";
strSoapEnvelope +=
"<Str3></Str3>";
strSoapEnvelope +=
"<complexType name=\"SomeStruct\">";
strSoapEnvelope +=
"<sequence>";
strSoapEnvelope +=
"<element name=\"Param1\"></element>";
strSoapEnvelope +=
"<element name=\"Param2\"></element>";
strSoapEnvelope +=
"<element name=\"Param3\"></element>";
strSoapEnvelope +=
"<element name=\"Param4\"></element>";
strSoapEnvelope +=
"<element name=\"Param5\"></element>";
strSoapEnvelope +=
"</sequence>";
strSoapEnvelope +=
"</complexType>";
strSoapEnvelope +=
"</Method>";
strSoapEnvelope +=
"</soap:Body>";
strSoapEnvelope +=
"</soap:Envelope>";

And response is:

<?xml version="1.0"?><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/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultactor/><faultcode>SOAP-ENV:Server</faultcode><faultstring>Invalid SOAP request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>


First I tried do Web reference, I got all functions and parameters to use. When I made this method I got error: Cannot convert System.bool to System.String.
This function return boolean value, string value and someStruct struct.