1
我想通過使用php肥皂執行遠程功能。Web服務是通過使用c#.net.There必須進行身份驗證,以調用遠程功能。我總是會被授權錯誤,每當我試圖調用遠程function.However,當我通過使用wget這樣soapclient請求從PHP到c#web服務與身份驗證
wget -c --user=my_username --password=my_password http://path/to/wsdl
獲得Web服務的內容和我得到這個輸出:
--2011-02-09 09:55:10-- http://path/to/wsdl
Connecting to my_ip:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to my_ip:80.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to my_ip:80.
HTTP request sent, awaiting response... 200 OK
Length: 3300 (3.2K) [text/html]
Saving to: `my_webservice.asmx'
100%[====================================================================================================================================================================================================>] 3,300 --.-K/s in 0.001s
2011-02-09 09:55:11 (3.81 MB/s) - `my_webservice.asmx' saved [3300/3300]
當我用肥皂序調用遠程功能如下:
$connSoap = new SoapClient($WebServiceUrl, array('login' => $username,
'password' => $password));
$requestOutput = $connSoap->GetVal (1, 1, 1);
我得到這個錯誤:
SoapClient::SoapClient(http://path/to/wsdl): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized
有何評論?
預先感謝
根據需要使用的示例:用戶,狀陣列(「用戶」 => $用戶名, 「密碼」 => $密碼) – 2011-02-09 08:21:03