Not able to use the authentication token to get user info using curl command from Linux server

Ayan
Ayan Contributor

{"error":{"message":"System.ArgumentNullException: Exception of type 'System.ArgumentNullException' was thrown.\r\nParameter name: userInfo\r\n
at Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.ProcessStreetEventClaims(Boolean ignoreFiltering)\r\n
at Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GatherProductionData()\r\n
at Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GetAllEntities(QueryOptions queryOptions)\r\n
at Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GetAllEntities()\r\n
at ThomsonReuters.Dss.Core.DataLayer.RepositoryPersistenceStrategy.GetAll[TEntity]()\r\n
at ThomsonReuters.Dss.Core.Entities.ContextBase.GetAll[TEntity]()\r\n
at ThomsonReuters.Dss.StandardExtractions.StandardExtractionsContextBase.get_UserPackages()\r\n
at ThomsonReuters.Dss.Api.StandardExtractions.UserPackagesBaseController.Get()\r\n
at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext() Error ID: [fa1b1168-f968-4f27-bb9b-f086759c7f94]"}}

Can you please help?

Best Answer

Answers

  • @Ayan, can you please share the request that caused this error ?

  • Ayan
    Ayan Contributor

    curl -H "Prefer: respond-async" -H "Content-Type : application/json" -k -H "Accept-Encoding : gzip,deflate" -H "Authorization : Token token_value" https://hosted.datascopeapi.reuters.com/RestApi/v1/StandardExtractions/UserPackages

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    This command is run properly in my environment. I will contact support team to verify the error.

  • Ayan
    Ayan Contributor

    I have used SOAP UI windows
    application and could able to generate the token from windows machine and could
    able to get the list of packages as well. However using the same token trying
    to execute below request

    From Linux server

    curl -v -i -k -X GET -H
    "Prefer: respond-async" -H "Authorization:Token
    _SWCQZ28d5wlevi***********ayanw7UJOo05xyfw0TsU" https://10.xxx.xxx//RestApi/v1/StandardExtractions/UserPackages

    Response:

    * About to connect() to 10.xxx.x.xxx
    port 443 (#0)

    * Trying
    10.xxx.x.xxx... connected

    * Connected to 10.xxx.x.xxx
    (10.xxx.x.xxx) port 443 (#0)

    * Initializing NSS with
    certpath: sql:/etc/pki/nssdb

    * warning: ignoring value of
    ssl.verifyhost

    * skipping SSL peer certificate
    verification

    * SSL connection using
    TLS_RSA_WITH_RC4_128_MD5

    * Server certificate:

    *
    subject: CN=hosted.datascopeapi.reuters.com,O=Thomson Reuters,L=New York,ST=New
    York,C=US

    *
    start date: Nov 14 00:00:00 2015 GMT

    *
    expire date: Nov 14 23:59:59 2017 GMT

    *
    common name: hosted.datascopeapi.reuters.com

    *
    issuer: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust
    Network,O=Symantec Corporation,C=US

    > GET
    //RestApi/v1/StandardExtractions/UserPackages HTTP/1.1

    > User-Agent: curl/7.19.7
    (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3
    libidn/1.18 libssh2/1.4.2

    > Host: 10.xxx.x.xxx

    > Accept: */*

    > Prefer: respond-async

    > Authorization:Token
    _SWCQZ28d5wlevi***********ayanw7UJOo05xyfw0TsU

    >

    < HTTP/1.1 500 Internal
    Server Error

    HTTP/1.1 500 Internal Server
    Error

    < Set-Cookie:
    DSSAPI-COOKIE=R537264362; path=/

    Set-Cookie:
    DSSAPI-COOKIE=R537264362; path=/

    < Cache-Control: no-cache

    Cache-Control: no-cache

    < Pragma: no-cache

    Pragma: no-cache

    < Content-Type:
    application/json; charset=utf-8

    Content-Type: application/json;
    charset=utf-8

    < Expires: -1

    Expires: -1

    < Server: Microsoft-IIS/7.5

    Server: Microsoft-IIS/7.5

    <
    X-Request-Execution-Correlation-Id: 4fb66fda-1fd5-480a-8220-f6ac1a94cd17

    X-Request-Execution-Correlation-Id:
    4fb66fda-1fd5-480a-8220-f6ac1a94cd17

    < X-App-Id: Custom.RestApi

    X-App-Id: Custom.RestApi

    < X-App-Version: 11.1.534.64

    X-App-Version: 11.1.534.64

    < Date: Wed, 12 Jul 2017
    14:59:15 GMT

    Date: Wed, 12 Jul 2017 14:59:15
    GMT

    < Content-Length: 4150

    Content-Length: 4150

    <

    {"error":{"message":"System.ArgumentNullException:
    Exception of type 'System.ArgumentNullException' was thrown.\r\nParameter name:
    userInfo\r\n at
    Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.ProcessStreetEventClaims(Boolean
    ignoreFiltering)\r\n at
    Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GatherProductionData()\r\n
    at Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GetAllEntities(QueryOptions
    queryOptions)\r\n at
    Reuters.DataScopeSelect.DataLayer.Entity.StandardExtractions.UserPackageRepository.GetAllEntities()\r\n
    at ThomsonReuters.Dss.Core.DataLayer.RepositoryPersistenceStrategy.GetAll[TEntity]()\r\n
    at
    ThomsonReuters.Dss.Core.Entities.ContextBase.GetAll[TEntity]()\r\n
    at
    ThomsonReuters.Dss.StandardExtractions.StandardExtractionsContextBase.get_UserPackages()\r\n
    at ThomsonReuters.Dss.Api.StandardExtractions.UserPackagesBaseController.Get()\r\n
    at lambda_method(Closure , Object , Object[] )\r\n at
    System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object
    instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext
    controllerContext, IDictionary`2 arguments, CancellationToken
    cancellationToken)\r\n--- End of stack trace from previous location where
    exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at
    System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at
    System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
    at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at
    System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n---
    End of stack trace from previous location where exception was thrown
    ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task)\r\n at
    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext(*
    Connection #0 to host 10.192.6.222 left intact

    * Closing connection #0

    ) Error ID:
    [a2dd9a6c-3634-4966-a010-372638a7e42f]"}}

  • Ayan
    Ayan Contributor

    We have proxy set up in place for Linux server, where as we can use https://hosted.datascopeapi.reuters.com link directly in SOAP UI.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    If 10.xxx.xxx is a proxy, it should be used with -x or --proxy option in curl.

     -x, --proxy [PROTOCOL://]HOST[:PORT]  Use proxy on given port
    --proxy-anyauth Pick "any" proxy authentication method (H)
    --proxy-basic Use Basic authentication on the proxy (H)
    --proxy-digest Use Digest authentication on the proxy (H)

    How can it be converted to hosted.datascopeapi.reuters.com? Is 10.xxx.xxx a firewall with port forwarding?

    I assume that the 0.xxx.xxx may add something in the request which causes the server error.

  • Ayan
    Ayan Contributor

    10.xx.xxx.xxx is a firewall with port forwarding. It is not proxy.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    It should relate the settings of firewall. What kind of firewall are you using? Is it Iptables on Linux machine?

    I have tested the curl command with port forwarding over SSH tunneling. The request works fine.

  • Ayan
    Ayan Contributor

    My Apologies for late reply, we are using two IPs to connect TRTH.10.192.6.221 and 10.192.6.222. Initially we were using 222 and was not able to connect, now we are using 10.192.6.221 and able to connect. Can you please check from your end why there is a problem with 10.192.6.222? We have check our team and they said both the IPs are good to connect. Please look into the commands and their output as below.

    $ curl -kI https://10.192.6.222/RestApi/v1

    HTTP/1.1 200 OK Set-Cookie: DSSAPI-COOKIE=R868494345; path=/ Cache-Control: private Content-Length: 5020 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNetMvc-Version: 4.0 X-Request-Execution-Correlation-Id: e97f5a6c-ae36-4e81-b3b0-c4e5df243da4 X-App-Id: Custom.RestApi X-App-Version: 811.1.4.64 Date: Tue, 25 Jul 2017 06:49:03 GMT

    $ curl -kI https://10.192.6.221/RestApi/v1

    HTTP/1.1 200 OK Set-Cookie: DSSAPI-COOKIE=R2485808843; path=/ Cache-Control: private Content-Length: 5020 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNetMvc-Version: 4.0 X-Request-Execution-Correlation-Id: b31d471b-453c-421f-abac-abb8604ae711 X-App-Id: Custom.RestApi X-App-Version: 11.1.534.64 Date: Tue, 25 Jul 2017 06:49:12 GMT

    Please help.

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    I assume that 10.192.6.221 and 10.192.6.222 are IP addresses of firewalls.

    The X-App-Version (811.1.4.64) from 10.192.6.222 looks different from 10.192.6.221 and my result.

    C:\Users\xxx\Downloads\curl_7_53_1_openssl_nghttp2_x64>curl -kI https://hosted.datascopeapi.reuters.com/RestApi/v1
    ...
    X-App-Version: 11.1.534.64
    Date: Tue, 25 Jul 2017 10:44:18 GMT

    Could you please verify again that X-App-Version returned from 10.192.6.222 is 811.1.4.64?