Hallo zusammen,
ich versuche über CURL die DatevConnect Rest Schnittstelle einer on-premises Instanz anzusprechen. Den Aufruf mache ich direkt von dem Server auf dem der DATEV Service läuft.:
curl http://localhost:58454/datev/api/master-data/v1/clients -v --ntlm --negotiate -u username@password
Zurück kommt ein 500er Fehler {"error":"NK000105","error_description":"Es ist ein Fehler am Server aufgetreten.\r\nDetails zu der Fehlermeldung finden Sie am Server in der Ereignisanzeige bzw. im Log-Service."}*
Hat jemand ein Idee was die Ursache für diesen Fehler/die Exception sein kann? Der Fehlerlog vom Server ist weiter unten.
Laut DATEVConnect-Einrichtung ist der DATEVConnect V11.1 HTTP Endpunkt gestartet und erreichbar über die Base URL http://localhost:58454/datev/api.
Danke im voraus.
Auszug aus dem Fehlerlog:
Trigger: Silent Modus: Normal DisplayStyle: ExceptionMessage
InstanceId: 907fe76d-57f6-4a99-8441-3543632819be
#NK000105
#NK00105
Konfigurationsdaten der Nutzungskontrolle können nicht ermittelt werden.
Technische Fehlerinfo:
Die Fehlerursache konnte nicht ermittelt werden.
**************************************************************************
ExceptionType: Datev.Framework.Diagnostics.FrameworkException
#NK000105
#NK00105
Konfigurationsdaten der Nutzungskontrolle können nicht ermittelt werden.
Technische Fehlerinfo:
Die Fehlerursache konnte nicht ermittelt werden.
+--------------------------------------------------------------------------
| ExceptionSource
+--------------------------------------------------------------------------
Datev.Security.Iam.InternalContracts
+--------------------------------------------------------------------------
| TargetSite
+--------------------------------------------------------------------------
Boolean IsOfflineMode()
+--------------------------------------------------------------------------
| Details
+--------------------------------------------------------------------------
ThreadId: 79
ThreadName:
ExtendedStackTrace:
bei Datev.Security.Iam.InternalContracts.ManagedNukoBase.HandleNukoException(NukoException nukoException)
bei Datev.Security.Iam.InternalContracts.ManagedNukoBase.IsOfflineMode()
bei Datev.Security.Iam.InternalContracts.IamEnvironment.CanUseOfflineToken(IConfigDB configDb)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.d()
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.b(String A_0, String A_1, String A_2)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.a(String A_0, String A_1, Boolean A_2, String A_3)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(String windowsSid, String samAccountName, Boolean signToken)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(TokenRequest tokenRequest)
bei Datev.Framework.RemoteServiceModel.Iam.IamClaimServiceHelper.CreateToken(DatevPrincipal datevPrincipal, WindowsIdentity winUserToGetTokenFor, String datevTokenFromCaller)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.SetDatevToken(DatevPrincipal datevPrincipal, WindowsIdentity winCaller, DatevTransportIdentity transportIdentity)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.ExtendDatevPrincipalWithDatevToken(DatevPrincipal datevPrincipal, WindowsIdentity winCaller, DatevTransportIdentity transportIdentity)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.CreateDatevPrincipal(WindowsIdentity winCaller, DatevTransportIdentity transportIdentity, Boolean isCallFromLocalMachine)
bei Datev.Framework.RemoteServiceModel.OnPremiseAuthenticationHandler.AuthenticateCoreAsync()
bei System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.AuthenticateAsync()
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.BaseInitializeAsync(AuthenticationOptions options, IOwinContext context)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler`1.Initialize(TOptions options, IOwinContext context)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.Invoke(IOwinContext context)
bei Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Cors.CorsMiddleware.HandleCorsRequestAsync(IOwinContext context, CorsPolicy policy, CorsRequestContext corsRequestContext)
bei Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Cors.CorsMiddleware.Invoke(IDictionary`2 environment)
bei Datev.Framework.RemoteServiceModel.CorsMiddleware.<Invoke>d__3.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Datev.Framework.RemoteServiceModel.CorsMiddleware.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(IOwinContext context)
bei Datev.Framework.RemoteServiceModel.ExceptionHandlerMiddleware.<Invoke>d__3.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Datev.Framework.RemoteServiceModel.ExceptionHandlerMiddleware.Invoke(IOwinContext context)
bei Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Hosting.Utilities.Encapsulate.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestAsync>d__5.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.ProcessRequestAsync(HttpListenerContext context)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestsAsync>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
bei System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
bei System.Threading.Tasks.Task.FinishContinuations()
bei System.Threading.Tasks.Task.FinishStageThree()
bei System.Threading.Tasks.Task`1.TrySetResult(TResult result)
bei System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
bei System.Threading.Tasks.TaskFactory`1.<>c__DisplayClass35_0.<FromAsyncImpl>b__0(IAsyncResult iar)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bei System.Net.ListenerAsyncResult.IOCompleted(ListenerAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
bei System.Net.ListenerAsyncResult.QueueBeginGetContext()
bei System.Net.ListenerAsyncResult.IOCompleted(ListenerAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
bei System.Net.ListenerAsyncResult.WaitCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
bei System.Threading._IOCompletionCallback.IOCompletionCallback_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
ExceptionDisplayStyle: ExceptionMessage
InstanceId: 907fe76d-57f6-4a99-8441-3543632819be
Marked for transmission to DATEV: True
+--------------------------------------------------------------------------
| StackTrace
+--------------------------------------------------------------------------
bei Datev.Security.Iam.InternalContracts.ManagedNukoBase.IsOfflineMode()
bei Datev.Security.Iam.InternalContracts.IamEnvironment.CanUseOfflineToken(IConfigDB configDb)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.d()
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.b(String A_0, String A_1, String A_2)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.a(String A_0, String A_1, Boolean A_2, String A_3)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(String windowsSid, String samAccountName, Boolean signToken)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(TokenRequest tokenRequest)
bei Datev.Framework.RemoteServiceModel.Iam.IamClaimServiceHelper.CreateToken(DatevPrincipal datevPrincipal, WindowsIdentity winUserToGetTokenFor, String datevTokenFromCaller)
***************************************************************************
* InnerException
***************************************************************************
ExceptionType: Datev.Security.AccessManagement.NukoException
#EXC1702962560
Eine Ausnahme vom Typ "Datev.Security.AccessManagement.NukoException" wurde ausgelöst.
+--------------------------------------------------------------------------
| ExceptionSource
+--------------------------------------------------------------------------
Datev.Nuko.ManagedNukoBase
+--------------------------------------------------------------------------
| TargetSite
+--------------------------------------------------------------------------
Boolean IsNukoSlaveInstallation(System.String*)
+--------------------------------------------------------------------------
| Details
+--------------------------------------------------------------------------
NukoReturnCode: 99
NukoMessageNumber: 105
NukoMessageText: #NK00105
Konfigurationsdaten der Nutzungskontrolle können nicht ermittelt werden.
Technische Fehlerinfo:
Die Fehlerursache konnte nicht ermittelt werden.
ThreadId: 79
ThreadName:
ExtendedStackTrace:
bei Datev.Security.AccessManagement.NukoBase.IsNukoSlaveInstallation(String* shareNameOfMaster)
bei Datev.Security.AccessManagement.NukoBase.Initialize()
bei Datev.Security.AccessManagement.NukoBase.IsOfflineMode()
bei Datev.Security.Iam.InternalContracts.ManagedNukoBase.IsOfflineMode()
bei Datev.Security.Iam.InternalContracts.IamEnvironment.CanUseOfflineToken(IConfigDB configDb)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.d()
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.b(String A_0, String A_1, String A_2)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.a(String A_0, String A_1, Boolean A_2, String A_3)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(String windowsSid, String samAccountName, Boolean signToken)
bei Datev.Security.IdentityManagement.IamClaimService.IamClaimService.IssueTokenForUser(TokenRequest tokenRequest)
bei Datev.Framework.RemoteServiceModel.Iam.IamClaimServiceHelper.CreateToken(DatevPrincipal datevPrincipal, WindowsIdentity winUserToGetTokenFor, String datevTokenFromCaller)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.SetDatevToken(DatevPrincipal datevPrincipal, WindowsIdentity winCaller, DatevTransportIdentity transportIdentity)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.ExtendDatevPrincipalWithDatevToken(DatevPrincipal datevPrincipal, WindowsIdentity winCaller, DatevTransportIdentity transportIdentity)
bei Datev.Framework.RemoteServiceModel.Iam.HostingDatevPrincipalCreator.CreateDatevPrincipal(WindowsIdentity winCaller, DatevTransportIdentity transportIdentity, Boolean isCallFromLocalMachine)
bei Datev.Framework.RemoteServiceModel.OnPremiseAuthenticationHandler.AuthenticateCoreAsync()
bei System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.AuthenticateAsync()
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.BaseInitializeAsync(AuthenticationOptions options, IOwinContext context)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationHandler`1.Initialize(TOptions options, IOwinContext context)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.Invoke(IOwinContext context)
bei Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Cors.CorsMiddleware.HandleCorsRequestAsync(IOwinContext context, CorsPolicy policy, CorsRequestContext corsRequestContext)
bei Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Cors.CorsMiddleware.Invoke(IDictionary`2 environment)
bei Datev.Framework.RemoteServiceModel.CorsMiddleware.<Invoke>d__3.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Datev.Framework.RemoteServiceModel.CorsMiddleware.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(IOwinContext context)
bei Datev.Framework.RemoteServiceModel.ExceptionHandlerMiddleware.<Invoke>d__3.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Datev.Framework.RemoteServiceModel.ExceptionHandlerMiddleware.Invoke(IOwinContext context)
bei Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Hosting.Utilities.Encapsulate.Invoke(IDictionary`2 environment)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestAsync>d__5.MoveNext()
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.ProcessRequestAsync(HttpListenerContext context)
bei Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestsAsync>d__0.MoveNext()
bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
bei System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
bei System.Threading.Tasks.Task.FinishContinuations()
bei System.Threading.Tasks.Task.FinishStageThree()
bei System.Threading.Tasks.Task`1.TrySetResult(TResult result)
bei System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
bei System.Threading.Tasks.TaskFactory`1.<>c__DisplayClass35_0.<FromAsyncImpl>b__0(IAsyncResult iar)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bei System.Net.ListenerAsyncResult.IOCompleted(ListenerAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
bei System.Net.ListenerAsyncResult.QueueBeginGetContext()
bei System.Net.ListenerAsyncResult.IOCompleted(ListenerAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
bei System.Net.ListenerAsyncResult.WaitCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
bei System.Threading._IOCompletionCallback.IOCompletionCallback_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
+--------------------------------------------------------------------------
| StackTrace
+--------------------------------------------------------------------------
bei Datev.Security.AccessManagement.NukoBase.IsNukoSlaveInstallation(String* shareNameOfMaster)
bei Datev.Security.AccessManagement.NukoBase.Initialize()
bei Datev.Security.AccessManagement.NukoBase.IsOfflineMode()
bei Datev.Security.Iam.InternalContracts.ManagedNukoBase.IsOfflineMode()
Gelöst! Gehe zu Lösung.
Der Windows User, der von "extern" Daten aus DATEV lesen will, ist in der Benutzerverwaltung von DATEV auch angelegt und hat entsprechende Rechte?
Hallo @metalposaunist
Genau, der DATEV Benutzer ist in der Benutzerverwaltung als Hauptadministrator angelegt und mit dem Windows Benutzerkonto verknüpft.
Login in den DATEV Arbeitsplatz funktioniert problemlos.
Ich tippe, dass die NTLM Auth Probleme macht. Funktioniert es mit Basic Auth:
curl --request GET -u name:password --basic --url 'http://localhost:58454/datev/api/master-data/v1/clients' --header 'accept: application/json; charset=utf-8'
Hast du es mal mit dem richtigen Hostname oder dem FQDN anstatt "localhost" getestet?
Wenn du direkt auf dem "DATEVconnect Server" unterwegs bist, warum "curl" und nicht PowerShell:
[System.Uri]$Uri = -join (
"https://",
$env:COMPUTERNAME,
":58452/datev/api/master-data/v1/clients"
)
$objHeaders = @{
"Accept" = "application/json"
"Content-Type" = "application/scim+json;charset=utf-8"
}
$wr = Invoke-WebRequest -Uri $Uri `
-Headers $objHeaders `
-ContentType "application/scim+json;charset=utf-8" `
-Method Get `
-UseBasicParsing `
-UseDefaultCredentials
$allClients = ConvertFrom-Json -InputObject $wr.Content
$allClients
Hallo @janm
danke für deine Hilfe. Über den HTTPS Endpunkt mit Port 58452 klappt es. Sowohl mit Basic Auth als auch Windows Auth.
Der HTTP Endpunkt liefert weiterhin den gleichen Fehler. Die Ursache ist hier weiterhin unklar.
Ich habe im gleichen Zug festgestellt, dass ich den HTTPS Endpunkt für meine Zwecke einsetzen kann. Daher ist das Problem für mich gelöst.
Danke für eure Hilfe
@BMohrmann schrieb:Hallo @janm
danke für deine Hilfe. Über den HTTPS Endpunkt mit Port 58452 klappt es. Sowohl mit Basic Auth als auch Windows Auth.
Der HTTP Endpunkt liefert weiterhin den gleichen Fehler. Die Ursache ist hier weiterhin unklar.
Ich habe im gleichen Zug festgestellt, dass ich den HTTPS Endpunkt für meine Zwecke einsetzen kann. Daher ist das Problem für mich gelöst.
Danke für eure Hilfe
Der Server wird Anfragen über HTTP schlichtweg ablehnen (so soll es auch sein), nichts das ich jetzt irgendwie als "Fehler" bezeichnen würde.
Wir haben aktuell ein ähnlich gelagertes Problem.
DATEV Connect ist aktiv und es sollen perspektivisch Daten darüber abgezogen werden.
Wenn wir jetzt beispielsweise die Liste der Mandanten abrufen wollen:
https://servername:58452/datev/api/accounting/v1/clients
Funktioniert das manchmal und manchmal nicht. Wenn es funktioniert, ist alles gut, wenn nicht, sieht man in den Fehlerlogs, dass er versucht hat, mit der SID desjenigen anzuklopfen, der die URL aufruft, d.h. obwohl der Browser die Credentials abfragt, werden diese ignoriert und mit der falschen SID gearbeitet, die halt keinen verknüpften DATEV-User hat -> NK000105 Fehler
Kann man direkt in der URL mitgeben, mit welchem User die Anmeldung stattfinden soll? Wenn ja, mit welcher Syntax? Mich wundert halt, dass es manchmal funktioniert und manchmal nicht.