Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 3 Monaten
Letzter Beitrag:
vor 1 Jahr, 3 Monaten
Beteiligte Autoren:
Paulo Oliveira, Peter Holemans

SOAPxxx functions and NTLM authentication

Startbeitrag von Paulo Oliveira am 22.11.2016 12:23

I need to call one web service using NTLM authentication.

Any one have done it?
Can it be done using only the SOAPxxx fuunctions?



Hi Paulo,

Yep, been working on this and there are at least two options and one works pratically out of the box...
Don't have much time to explain it in full detail now but here's a clue for the easiest one:
- Import your web service wsdl in your WX project (Via the web services node in the project explorer)
- In code set your authentication values like the below sample (WX will pass the negotiate/ntlm authentification during the call)

//Imported the QueryService wsdl from a SharePoint site which has a web service
//to get the status of the search engine

//Declare a web service variable
ctx is a wsRequest

//Set the address and credentials to use for the web service
QueryService..Address = "http://MySharepointServer.com/_vti_bin/search.asmx";
QueryService..User = Domain+["\"]+UserName
QueryService..Password = Password

//Execute web service
stRes is StatusResponse = QueryService.Status(ctx)

A second solution is to create an authentication/bearer token which you add to the http header using API calls (AcquireCredentialsHandleA+InitializeSecurityContextA for an ANSI project AcquireCredentialsHandleW+InitializeSecurityContextW for a unicode project). There is an example in the "WD SharePoint" project that works with the current logged on user. I modified and enhanced this so that you can pass specific authentication credentials to the API's to get a token for impersonation of another user during the web service call but I will need to look it up again if you want the full details. Instead of setting the user credentials like in the above exemple it would then be coded instead to be like this:

ctx.HTTPHeader["Authorization"] = GenerateBearerToken(...)

I hope this helps,

Peter Holemans

von Peter Holemans - am 22.11.2016 14:10
Thanks Peter,

I will test your first sugestion when possible.
For now, it must be in prduction this week, the web service provider gave us access to another server with basic authentication and i can use it passing the user/password in the URL of the soapxxx functions.

von Paulo Oliveira - am 23.11.2016 14:17
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.