c# - How can I add a Basic Auth Header to my SOAP? -
i'm trying send authentication header through wsdl
service not have authentication requirement specified on wsdl
.
how can add auth header call web service ?
code have been working with:
using system; using system.web.services.protocols; namespace testesoap { class mainclass { public static void main (string[] args) { wsdlservice service = new wsdlservice(); /* how can add authentication call of webservice ? */ service.get(); console.writeline ("hello world!"); } } }
this problem questioned in other link in different way related wsdl including question user/password.
they aren't same question problem related.
michaelis.mockservice webservice library extracted may see example on how in: link mono project website.
michaelis.mockservice service = new michaelis.mockservice(); // create network credentials , assign // them service credentials networkcredential netcredential = new networkcredential("inigo.montoya", "ykmfptd"); uri uri = new uri(service.url); icredentials credentials = netcredential.getcredential(uri, "basic"); service.credentials = credentials; // sure set preauthenticate true or else // authentication not sent. service.preauthenticate = true; // make web service call. service.method();
Comments
Post a Comment