How can I had soap AUTH BASIC auth to a WSDL, so who ever reads the WSDL knows I require that operation for a specific method ?
Asked
Active
Viewed 9,028 times
2
2 Answers
1
Using the example bellow I have managed to pass the SOAP basic autentication to the php webservice on the other end. The PHP.net/Soapclient has a simple working example, but in csharp I found this link to be a solution to my problem.
Michaelis.MockService is the Webservice library extracted you may see an example on how to do this in: link Mono project website.
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();

Fernando André
- 1,213
- 3
- 19
- 32
0
There is no way to specify this, as far as I know.

John Saunders
- 160,644
- 26
- 247
- 397
-
I have not found what I was really intending but found a solution. Using csharp client since in php the example on the website of soapclient is simple. [link](http://www.intellitechture.com/Calling-web-services-using-basic-authentication/) – Fernando André Feb 10 '11 at 15:47
-
@netcrash: then please post your solution as an answer, and I'll upvote it. – John Saunders Feb 10 '11 at 15:47
-
Done should have submited has an answer did not realise that sorry. – Fernando André Feb 10 '11 at 15:52