SetCredentials()

Top  Previous  Next

The SetCredentials() method is an alternative to using GetLoginKey() and PopulateObjAcctSoapHeader() and is typically use in automated applications without a user interface where data is submitted under program control and where storing a LoginKey is not feasible or desired.

 

Example

 

' ----------------------------------------

' Use WebServices.SoapHeader.SetCredentials() to set the

' CompanyID, UserID and Password on each call to the web service.

' ----------------------------------------

 

Dim ws As New WebServices.ClassWebService()

 

WebServices.SoapHeader.SetCredentials("SmithCo","John","abc123","")

 

Dim ds As New DataSet()

ds = ws.GetFirstEntity(ReturnType.Standard)

 

' Change the ID to something new.

ds.tables("Entity").rows(0).items("ID") = "Consulting"

 

' Save back to the webservice.

ws.SaveEntity(ds)

 

Remarks

 

The SetCredentials() method requires that the web service to perform a complete validation and generate a new LoginKey on each call.  As a result, it is not as efficient using GetLoginKey() and storing it in Session or ViewState.