Answer the question
In order to leave comments, you need to log in
How to send request and read response via SOAP protocol using WDSL?
I'm trying to write a C Sharp program that will send a request using the SOAP 1.1 protocol (boolean GetBlock (string Login, string Password, string Text)) and read the response.
Please tell me where to start or tell me where you can find an example code.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="urn:SysIntf" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="ISysservice" targetNamespace="http://tempuri.org/">
<message name="SendBlockRequest">
<part name="Text" type="xs:string"/>
</message>
<message name="SendBlockResponse">
<part name="return" type="xs:boolean"/>
</message>
<message name="GetBlockRequest">
<part name="Login" type="xs:string"/>
<part name="Password" type="xs:string"/>
<part name="Text" type="xs:string"/>
</message>
<message name="GetBlockResponse">
<part name="Text" type="xs:string"/>
<part name="return" type="xs:boolean"/>
</message>
<portType name="ISys">
<operation name="SendBlock">
<input message="tns:SendBlockRequest"/>
<output message="tns:SendBlockResponse"/>
</operation>
<operation name="GetBlock">
<input message="tns:GetBlockRequest"/>
<output message="tns:GetBlockResponse"/>
</operation>
</portType>
<binding name="ISysbinding" type="tns:ISys">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="SendBlock">
<soap:operation soapAction="urn:SysInt" style="rpc"/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="SysInt" use="encoded"/>
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="SysInt" use="encoded"/>
</output>
</operation>
<operation name="GetBlock">
<soap:operation soapAction="urn:SysInt" style="rpc"/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="SysInt" use="encoded"/>
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="SysInt" use="encoded"/>
</output>
</operation>
</binding>
<service name="ISysservice">
<port binding="tns:ISysbinding" name="ISysPort">
<soap:address location="http://xxx.xxx.xxx.xxx:yyyy/zzz/soap"/>
</port>
</service>
</definitions>
SysClient client = new SysClient();
client.Endpoint.Name = "ISysbinding";
string login = "login";
string password = "password";
string text = "text";
client.Open();
bool response = client.GetBlock(login, password, ref text);
client.Close();
Console.WriteLine(response.ToString());
Console.ReadKey();
Answer the question
In order to leave comments, you need to log in
look in the direction of WCF
PS: in short: in VisualStudio, click AddServiceReference, feed the link to wsdl
and use
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question