Search This Blog

Monday, January 23, 2012

Microsoft.Web.Services2 401 Unauthorized

If you encountered this error using Web.Services2 from Microsoft just try:

var service = new JasperService("http://localhost:8088/jasperserver/services/repository");
var cred = new NetworkCredential("someUser", "somePass");
service.Credentials = cred;

If this does not work for you try:

SoapContext requestContext = service.RequestSoapContext;
UsernameToken userToken =
    new UsernameToken("someUser", "somePass",
                      PasswordOption.SendPlainText);
requestContext.Security.Tokens.Add(userToken);
requestContext.Security.Timestamp.TtlInSeconds = 86400;

2 comments:

  1. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    ReplyDelete
  2. Obviously, the collection of a writer must be a bundle of creativity. New ideas of writing become the reason of success. It makes your work worthwhile. Everyone wants to praise your writing because they bound by creativity.Australia SMS for business

    ReplyDelete

If you like this post, please leave a comment :)