Web Service respond with The request failed with HTTP status 401: Unauthorized


Badge +1

I have invoke K2 web service by simple web application.

the code:

K2Services.WorklistItem[] wl;
K2Services.WS client = new K2Services.WS();
client.Credentials = System.Net.CredentialCache.DefaultCredentials;
wl = client.OpenWorklist(true);

 

when i started the page, the web service has been responded with "The request failed with HTTP status 401: Unauthorized"


4 replies

Badge +5

Hi, Maher


 


Please go look into the following link below on How to configure Internet Options to avoid "401" and "Value cannot be null” errors when using K2 Designers


 


http://help.k2.com/KB000294#


 


Regards


 


Julia

Badge +1

Hi Julia 

thank you for your reply.

I have checked the link and I found the suggested steps is already applied in my browser.

 

I want to tell you, that the error is appeared in my web application when I invoke any K2 web service methods.

Are there any configruations in the web.config of the web application?? or may I have to send the the credentials to the web service in a certain way.

 

This the stack trace of the exception:

[WebException: The request failed with HTTP status 401: Unauthorized.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +733994
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +345
WebApplication1.K2Services.WS.OpenWorklist(Boolean IncludeData) +189
WebApplication1.frmAssignInspector.exec() +168
WebApplication1.frmAssignInspector.submit_Click(Object sender, EventArgs e) +51
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

 

Thanks

 

Badge +5

Hi, Maher


 


I'm still busy investigating the issue, in a meantime can you please look into the link below:


 


Troubleshooting 401 unauthorized errors from the Workspace


 


Regards


 


Julia

Badge +1

Hi Julia,

 

Thanks you for your support,

 

The K2 webservice method now is invoked successfuly. the link that you sent was very helpful.

That I did is:

1- I created another application pool in K2 IIS and make it's Identity is NetworkService and it's Managed pipeline mode is Integrated.

2- I chanaged the application pool of the K2 Service web application to the new application pool.

3- I made sure that the K2 WorkSpace & K2 Designer are working fine.

4- I tested the code and I found it's working fine too :)

 

Thanks Julia

Reply