Hiee Team:I am facing issues in creating schedule for DSS legal entity detail report template.Kin...

...dly provide the solution as I have been trying for many days.
public String createSchedule(String scheduleName) {
String scheduleId = "";
try {
System.out.println("Inside try");
String urlGet =urlHost + "/Extractions/Schedules";
Client client = Client.create();
WebResource webResource = client.resource(urlGet);
JSONObject recurrence = new JSONObject();
recurrence.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.Schedules.SingleRecurrence");
recurrence.put("IsImmediate",true);
// reccurrence.put("ExtractionDateTime","2016-03-18T16:51:42.000Z");
JSONObject trig= new JSONObject();
trig.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.Schedules.ImmediateTrigger");
JSONObject scheduleJSONObject = new JSONObject();
scheduleJSONObject.put("name",scheduleName);
scheduleJSONObject.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.Schedules.Schedule");
scheduleJSONObject.put("ListId","0x05321cff4db579e6");
scheduleJSONObject.put("OutputFileName","Immediate_extarct.csv");
scheduleJSONObject.put("Recurrence",recurrence );
scheduleJSONObject.put("ReportTemplateId","0x05330bf6e7eafc5b");
//scheduleJSONObject.put("ScheduleId","null");
scheduleJSONObject.put("TimeZone","(UTC+05:30) Chennai,Kolkata,Mumabi,New Delhi");
scheduleJSONObject.put("Trigger",trig);
String params = scheduleJSONObject.toString();
System.out.println("Before print params");
System.out.println(params);
System.out.println("After print params");
ClientResponse response = null;
response = webResource
.header("Content-Type", "application/json;charset=UTF-8")
.header("Authorization", "Token " + sessionToken)
.post(ClientResponse.class, params);
System.out.println(response.toString());
System.out.println("After Response");
System.out.println("Before String.class");
String jsonStr = response.getEntity(String.class);
System.out.println("aftre String.class");
JSONObject jsonResponse=new JSONObject(jsonStr);
StringWriter out = new StringWriter();
jsonResponse.write(out);
System.out.println("JSON response: "+ out);
scheduleId = jsonResponse.getString("ScheduleId");
} catch (JSONException e) {
e.printStackTrace();
}
return scheduleId;
}
Error I am getting is :
JSON response: {"error":{"innererror":{"message":"\n\nMapping types:\r\nSchedule -> ScheduleDescription\r\nThomsonReuters.Dss.Extractions.Schedules.Schedule -> ThomsonReuters.Dss.Extractions.Schedules.ScheduleDescription\n\nDestination path:\nScheduleDescription\n\nSource value:\nSchedule - ID: 0x053354546cf52703","internalexception":{"message":"Value cannot be null.\r\nParameter name: name","stacktrace":" at ThomsonReuters.Dss.Extractions.Schedules.ScheduleDescription..ctor(String name, String outputFileName, String timeZone, ScheduleContent content, ScheduleRecurrence recurrence, ScheduleTrigger trigger)\r\n at ThomsonReuters.Dss.Extractions.Schedules.Schedule.<.cctor>b__0(Schedule s)\r\n at AutoMapper.MappingExpression`2.<>c__DisplayClass12.<ConvertUsing>b__11(ResolutionContext source)\r\n at AutoMapper.Mappers.TypeMapObjectMapperRegistry.CustomMapperStrategy.Map(ResolutionContext context, IMappingEngineRunner mapper)\r\n at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngineRunner mapper)\r\n at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context)","type":"System.ArgumentNullException"},"stacktrace":" at ThomsonReuters.Dss.Extractions.Schedules.Schedule.BeforeSave(IList`1 warningAndInfoMessages)\r\n at ThomsonReuters.Dss.Core.Entities.ContextBase.DoBeforeSaveChanges(IList`1 warningAndInfoMessages)\r\n at ThomsonReuters.Dss.Core.Entities.ContextBase.Validate(IList`1 warningAndInfoMessages)\r\n at ThomsonReuters.Dss.Core.Entities.ContextBase.SaveChanges()\r\n at ThomsonReuters.Dss.Core.RestApi.Controllers.ContextBatchHandler.SaveChanges()\r\n at ThomsonReuters.Dss.Api.Extractions.Schedules.SchedulesBaseController.CreateEntity(Schedule entity)\r\n at ThomsonReuters.Dss.Core.RestApi.Controllers.EntitySetController`2.Post(TEntity entity)\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.ActionExecutor.Execute(Object instance, Object[] arguments)\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.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.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.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()","type":"AutoMapper.AutoMapperMappingException"},"message":"\n\nMapping types:\r\nSchedule -> ScheduleDescription\r\nThomsonReuters.Dss.Extractions.Schedules.Schedule -> ThomsonReuters.Dss.Extractions.Schedules.ScheduleDescription\n\nDestination path:\nScheduleDescription\n\nSource value:\nSchedule - ID: 0x053354546cf52703","code":""}}
Best Answer
-
The error message is pointing to a null value for the 'name' parameter (which is the Schedule name). And you'd provided the Schedule Name in the code; so probably the order of the parameters in the JSON Request had been reshuffled. Attached it's an example of creating a Schedule for the Legal Entity Report (see the 'createReportSchedule' method). (dss2legalentitydetailreportscheduleclient.zip)
0
Answers
-
I don't have a Java environment installed, so I can't test your code. But the error message contains an internal exception with this message: "Value cannot be null.\r\nParameter name: name".
This tells us the name parameter has a null value, which should not be the case. It is set in this line of your code:
scheduleJSONObject.put("name",scheduleName);
scheduleName is the input parameter of createSchedule.
How was createSchedule called ? Was a value assigned to scheduleName ? What value ?
To test if scheduleName is null or has a value I'd try adding the following line inside the try code block:
System.out.println("scheduleName: " + scheduleName);
As a test you could also replace the variable scheduleName with a hard coded string:
scheduleJSONObject.put("name", "myScheduleName");
That might help you find the source of the error.
0 -
Dear Christiaan Meihsl,
This is not the issue ,I am providing the value to schedule name it's not null .I am not getting which name is refered in the error.
0 -
Looking at your code again, I see that name does not start with a capital N. Try this:
scheduleJSONObject.put("Name",scheduleName);
0 -
Hi..Christiaan Meihs --This thing also i have tried..this is not the issue the issue is with the request ...AS i am getting bad request error..the parameters I am passing is not in synchronization with ,what the service needs,but there is no such documentation where i can get what to pass and which format to use.
0 -
Attach an example to get Leget Audit data from DSS REST API.
You will need to download libs from http://hc.apache.org/downloads.cgi
Please add reference to commons-logging-1.2.jar, httpclient-4.5.2.jar and httpcore-4.4.4.jar to your project to run this sample code.
You also have to pass 2 parameter to the app which are DSS login ID and password.dss-rest-test.zip0 -
Have you looked at the Sample application available in the DSS REST API Downloads page here. It has many samples including how to create a schedule. The C# might not be that useful for you because it uses the SDK, but you can see the HTTP request and response. Once you have the JSON required for the request, you should be able to build that in Java
0 -
This new sample has just been added to the Java Code Examples package.
0 -
From the sample app the request to create a schedule under Scheduled Extractions | Immediate, is
POST https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/Schedules HTTP/1.1
Authorization: Token <your_auth_token_goes_here>
X-Client-Version: restapiv1.10.2.884.0
Prefer: respond-async
{
"Name": "ImmediateNonCustomized",
"TimeZone": "GMT Standard Time",
"Recurrence": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.Schedules.SingleRecurrence",
"ExtractionDateTime": "2016-03-31T10:03:34.926Z",
"IsImmediate": true
},
"Trigger": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.Schedules.ImmediateTrigger",
"LimitReportToTodaysData": true
},
"ListId": "0x0534033979eafc5b",
"ReportTemplateId": "0x0534033aee9a2eab"
}Your request looks like this
{
"name": "LegalEntity_SCHEDULE2",
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.Schedules.Schedule",
"ListId": "0x05321cff4db579e6",
"OutputFileName": "Immediate_extarct.csv",
"Recurrence": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.Schedules.SingleRecurrence",
"IsImmediate": true
},
"ReportTemplateId": "0x05330bf6e7eafc5b",
"TimeZone": "(UTC+05:30) Chennai,Kolkata,Mumabi,New Delhi",
"Trigger": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.Schedules.ImmediateTrigger"
}
}0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 37 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 705 Datastream
- 1.5K DSS
- 633 Eikon COM
- 5.2K Eikon Data APIs
- 14 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 6 Trading API
- 3K Elektron
- 1.5K EMA
- 259 ETA
- 569 WebSocket API
- 40 FX Venues
- 16 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 4 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 284 Open PermID
- 47 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 24 RDMS
- 2.2K Refinitiv Data Platform
- 879 Refinitiv Data Platform Libraries
- 5 LSEG Due Diligence
- 1 LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 123 Open DACS
- 1.1K RFA
- 108 UPA
- 196 TREP Infrastructure
- 232 TRKD
- 919 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 103 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛