01.
{
02.
03.
// Create a request
04.
05.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
"https://webservice.emida.net/soap/servlet/rpcrouter"
);
06.
07.
08.
09.
// Set the Method property of the request to POST.
10.
request.Method =
"CommTest"
;
11.
12.
// Create POST data and convert it to a byte array.
13.
string
postData =
""
;
14.
byte
[] byteArray = Encoding.ASCII.GetBytes(postData);
15.
// Set the ContentType property of the WebRequest.
16.
request.ContentType =
"urn:debisys-soap-services"
;
17.
request.Accept =
"text/xml"
;
18.
19.
// Set the ContentLength property of the WebRequest.
20.
request.ContentLength = byteArray.Length;
21.
22.
// Get the request stream.
23.
Stream dataStream = request.GetRequestStream();
24.
25.
// Write the data to the request stream.
26.
dataStream.Write(byteArray, 0, byteArray.Length);
27.
// Close the Stream object.
28.
29.
Label2.Text = dataStream.ToString();
30.
31.
dataStream.Close();
32.
33.
//Get response
34.
WebResponse response = request.GetResponse();
35.
36.
//Get the stream containing content
37.
dataStream = response.GetResponseStream();
38.
//Open the stream
39.
StreamReader reader =
new
StreamReader(dataStream);
40.
//Read content
41.
string
responseFromServer = reader.ReadToEnd();
42.
//Display the content
43.
Label1.Text = responseFromServer;
44.
//Clean up the streams
45.
reader.Close();
46.
dataStream.Close();
47.
response.Close();
48.
}
With "CommTest" I should be able to send "None" and receive an "OK". The error that I have is
I guess that means that Im not sending it properly. But I dont know how to accomplish a SOAP request and response.