I am currently trying to consume a SOAP WebService via C#.
The WebServices uses some header authentication I don't get working in C# There is some sample PHP Code, but since it's my first SOAP Client I don't really get the C# equivalent.
I hope somebody can tell me how to do the following in C#:
$client = new SoapClient("http://api.sendcockpit.com/server.php?wsdl");
class SOAPAuth{
public $userid;
public $apikey;
public $version;
public $mode;
public function __construct($userid, $apikey, $version, $mode = 'test') {
$this--->userid = $userid;
$this->apikey = $apikey;
$this->version = $version;
$this->mode = $mode;
}
}
$auth = new SOAPAuth('User ID','API Key','1.0','test');
$header = new SOAPHeader('sendcockpit', 'validate', $auth);
$client->__setSoapHeaders($header);
try{
//get all subscriber lists from account
$response=$client->apiGetList();
}
catch (SoapFault $exception) {
echo ($exception->getMessage());
}