如何在 C# 中使用 ServiceReference 或 WebReference 做到这一点
class SoapAuthentificationHeader {
/** @var string sPassword */
public $Password;
/** @var string sLogin */
public $sLogin;
/** @var string anotherCustomParam*/
public $sVod;
public function __construct($sLogin, $sPassword, $sVod) {
$this->sPassword=$sPassword;
$this->sLogin=$sLogin;
$this->sVod=$sVod;
}
}
$oSoap=new SoapClient('http://.[ my path ]...wsdl', array(
'trace' => 1,
'encoding' => 'UTF-8'
));
try {
$oSoap->__setSoapHeaders(array(new SoapHeader('urn:vod_soap', 'AuthenticationHeader', new SoapAuthentificationHeader('login', 'password', 'anotherCustomParam'))));
$iCountVideo = $oSoap->countVideo();
} catch (Exception $oException) {
var_dump($oException);
}
我试图在我的通话之间实例化一个共享的 CookieContainer。但它没有用:目前我有:
vod_soapService s = new vod_soapService();
s.CookieContainer = new CookieContainer();
s.ConnectionGroupName = "test";
// this webmethod works it return me true
s.AuthenticationHeader("foo", "bar", "test");
string test = s.countVideo();