2011-02-09 219 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();