Web Service reference Integrated Authentication not working

  • 26 March 2004
  • 0 replies
  • 0 views

Badge +7
Symptom
Using K2.net Studio, I created a Web Reference to a web service/site that requires authentication via Integrated Authentication.

K2.net Server Service is running under a named account (eg K2_Service). I am able to connect to the site via Internet Explorer, and was correctly prompted for login user credentials.

When the Process and event executes, I get "The request failed with HTTP status 401: Access Denied."

Changing the credentials in K2.net Studio when creating the Reference to the web service seems to have no effect.


Resolution
The credentials specified during the creation of the web service reference in K2.net Studio to Discover its available methods and parameters are not hardcoded into the wrapper class. This behaviour is by design for security reasons.

Therefore, you must specify the credential set when calling the web service (by instantiating the wrapper class). Included below is an example of a webservice (originally located at http://webserver/myservice/service1.asmx) that was included as a web service reference. The class is therefore called Service1 .


Sub Main(ByVal K2 As ServerEventContext)

K2.Synchronous = True

Dim myWebService As New Service1

'>>>> Get the Credentials
Dim myCredentials As New System.Net.NetworkCredential("user1", "password", "domain")
myWebService.Credentials = myCredentials

'>>>> Call the Web Service
K2.ProcessInstance.DataFields("FullName").Value = _
myWebService.GetFullName("John Smith","Some Comments")

End Sub

0 replies

Be the first to reply!

Reply