2011-02-09 92 views

回答

0

據我所知,沒有辦法指定它。

+0

我還沒有找到我真正想要的,但找到了解決方案。 因爲在php中使用csharp客戶端,soapclient網站上的例子很簡單。 [鏈接](http://www.intellitechture.com/Calling-web-services-using-basic-authentication/) – 2011-02-10 15:47:00

1

使用示例波紋管,我設法將SOAP基本驗證傳遞給另一端的php webservice。 PHP.net/Soapclient有一個簡單的工作示例,但在csharp中,我發現這個鏈接是我的問題的解決方案。

link

Michaelis.MockService是提取你可以看到如何做到這一點的一個例子,web服務庫: link Mono項目網站。

Michaelis.MockService service = new Michaelis.MockService(); 

// Create the network credentials and assign 
// them to the service credentials 
NetworkCredential netCredential = new NetworkCredential(「Inigo.Montoya」, 「Ykmfptd」); 
Uri uri = new Uri(service.Url); 
ICredentials credentials = netCredential.GetCredential(uri, 「Basic」); 
service.Credentials = credentials; 

// Be sure to set PreAuthenticate to true or else 
// authentication will not be sent. 
service.PreAuthenticate = true; 

// Make the web service call. 
service.Method();