我怎样才能对 WSDL 进行肥皂 AUTH BASIC 身份验证,所以读过 WSDL 的人都知道我需要针对特定方法进行该操作?
问问题
8680 次
2 回答
1
使用下面的示例,我设法将 SOAP 基本身份验证传递给另一端的 php webservice。PHP.net/Soapclient 有一个简单的工作示例,但在 csharp 中我发现这个链接可以解决我的问题。
Michaelis.MockService 是提取的 Web 服务库,您可以在以下位置看到有关如何执行此操作的示例: 链接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();
于 2011-02-10T15:51:46.583 回答
0
据我所知,没有办法指定这一点。
于 2011-02-09T18:05:36.393 回答