I guess, you missed to pass some argument in CreateDataset() function. Or you passed a NULL argument.
Please print ItemID, revision, Outpath, Inputfilename in the code and check if these values are Non-Null.
Thanks for the reply. What I observed is as follows
datasetToolNames = "PDF_Tool"; THis argument should be passed blank and the API should be called within a TRY Catch block.
Although the API gives you an error which is then not displayed because of empty catch block but it creates a dataset and attaches the file to this dataset.