question

Upvotes
Accepted
2 0 0 1

Hi I am trying to GetBrokerUsersEntitlements_1 from salesforce, I am using HTTP. If i use the same json body from within the thomsonreuters site it will give me the response.

I am getting this error from salesforce as the response.

"{"Fault":{"Code":{"Value":"s:Receiver","Subcode":{"Value":"a:Security_MissingAuthorization"}},"Reason":{"Text":{"lang":"en-US","Value":"Missing the mandatory 'http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1:Authorization' SOAP header in the user request."}},"Detail":{"ClientErrorReference":{"Timestamp":"2017-10-13T18:33:06.31979Z","ErrorReference":"df3ba8bccdaa40f584bef8aae519f08d","ServerReference":"D0B4498C3E7872E69F382B5CE83AEDFCFC5D463AB8375163"}}}}"


// Below is the code

String username = 'removed';
String password = 'removed';
string appId =  'removed';




 // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setEndpoint('https://api.trkd.thomsonreuters.com/api/BrokerEntitlementsManagement/BrokerEntitlementsManagement.svc/REST/BrokerEntitlementsManagement_1/GetBrokerUsersEntitlements_1');


Blob headerValue = Blob.valueOf(username +':'+ appId +':'+ password);




system.debug('authorizationHeader '+ authorizationHeader);
req.setHeader('Authorization', authorizationHeader);
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept', 'application/json');
     


stirng jsonBody = '{"GetBrokerUsersEntitlements_Request_1":{"getUserLogin":true,"ctbId":sampleID-Number,"sortByCompany":{"field1":"Id","field2":"Id","field3":"Id","order":"Asc"},"sortByUser":{"field1":"FirstName","field2":"FirstName","field3":"FirstName","order":"Asc"},"search":{"byUserEmail":{"email":[{"type":"some sample data"}]}}}}';
req.setBody(jsonBody);


// Send the request, and return a response
HttpResponse res = new http().send(req);
system.debug('PSM ' + res.getBody());
 


rkd-apirkd
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
11.5k 16 7 10

Hello @pradeepsm36

The "Missing the mandatory 'http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1:Authorization' SOAP header in the user request." error message means the application does not set the authorize information in the request message header.

Basically, the application need to authenticate with TRKD Authentication service first to get an authen token, then sends a request message to the interested TRKD service with the following authentication information in the request message header:

  • X-Trkd-Auth-ApplicationID: 'app id'
  • X-Trkd-Auth-Token: 'authen toker'

Please see more detail in TRKD Token Management service page.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
2 0 0 1

Hi Thank you for the response, I would like to know should I go through the entire

Create Service Token

after that

Create Impersonation Token v3

entire process in the below URL "https://www.trkd.thomsonreuters.com/SupportSite/TestApi/Svc?svc=TokenManagement_1"

because, I got the token from first method (create service token) and passing the token to get users but yet getting the same error. Cloud please give me a suggestion.

			HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setEndpoint(MASKED);
            Blob headerValue = Blob.valueOf(appId +':'+ token);
            string authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
            req.setHeader('Authorization', authorizationHeader);
            req.setHeader('Content-Type', 'application/json');
            string jsonBody = '{"GetBrokerUsersEntitlements_Request_1":{"getUserLogin":true,"ctbId":MASKED,"sortByCompany":{"field1":"Id","field2":"Id","field3":"Id","order":"Asc"},"sortByUser":{"field1":"FirstName","field2":"FirstName","field3":"FirstName","order":"Asc"},"search":{"byUserEmail":{"email":[{"type":"MASKED"}]}}}}';
            req.setBody(jsonBody);
            
            
            HttpResponse res = new http().send(req);
            system.debug('PSM fetchBrokerUserfromTKRD' + res.getBody());


Error MSG Below:

fetchBrokerUserfromTKRD{"Fault":{"Code":{"Value":"s:Receiver","Subcode":{"Value":"a:Security_MissingAuthorization"}},"Reason":{"Text":{"lang":"en-US","Value":"Missing the mandatory 'http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1:Authorization' SOAP header in the user request."}},"Detail":{"ClientErrorReference":{"Timestamp":"2017-10-16T08:43:30.1477549Z","ErrorReference":"0876f77abc1d4886824d6cf4f2cb41a1","ServerReference":"CC9119A1C7AF6EE8A4AC539448F190A4CCE7101831609249"}}}}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
2 0 0 1

is there some encoding that needs to be done for the token. For example: SHA256 or something that I might be missing.

Any help would be greatly appreticated.

Thank you

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
9.7k 49 38 60

Hi @pradeepsm36,

Try setting your headers to look like this instead:

req.setHeader('X-Trkd-Auth-ApplicationID', appId);
req.setHeader('X-Trkd-Auth-Token', token);

The above 'token' is what is returned when you requested for your service token.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Hi Nick, Thank you so much for the solution also :).

Thank you

Pradeep

Click below to post an Idea Post Idea