After spending a lot of time on research, trying it with various approaches, I've decided to ask a question here, as I'm out of ideas now. What I want to achieve is call a sendDocument operation on a webservice, which is located right here:
https://test-bramka.edeklaracje.gov.pl/uslugi/dokumenty?wsdl
I've added a service reference to my VS project successfully. Then I've tried to do it as everyone was suggesting through the Internet:
eDeklaracjeTest client = new eDeklaracjeTest();
client.sendDocument(b1);
But VS keeps on telling me, that eDeklaracjeTest is a namespace, but is used like a type. When declaring it like:
var client = new eDeklaracjeTest.sendDocument();
It sounds right and afterwards I can do:
client.document = b1;
But that does not call sendDocument method. What is wrong with my call? How to call sendDocument correctly so I can confirm, that my request was received and how could I receive an answer?
UPDATE After some hours of research and one question to colleague from work, I've finally received an answer (thanks to CodeCaster, as his help was also really helpful). Correct code for that WebService looks like:
eDeklaracjeTest.sendDocumentResponse resp;
byte[] b1 = null;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
var client = new eDeklaracjeTest.GateServicePortTypeClient("GateServiceSOAP11port");
var documentToSend = new eDeklaracjeTest.sendDocument();
documentToSend.document = b1;
client.Open();
resp = client.sendDocument(documentToSend);
Thanks to everyone, who tried to help me with that issue.