Reputation: 1740
I'm using node.js to use the Watson Dialog system. I'm using a function to create a new dialog but somewhere along the code I'm getting a weird error related to the xml file that reads
{ code: 400,
error: 'Failed to import file. Possibly due to corrupt or invalid file or system error. - java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a -1 event',
conversionLog: 'WARN: No valid xsd schema specified in XML header. Assuming version="WatsonDialogDocument_1.1".\n' }
I'm using the pizza dialog xml that is available as an example for the dialog system to test so I don't think the problem is that the file is invalid. Here is the code I use to create the dialog.
var params = {
name: req.body.username,
file: fs.createReadStream(__dirname+'/public/dialogs/users/'+req.body.username+'/'+req.body.username+'.xml')
};
dialog_service.createDialog(params, function(err, dialog) {
if (err)
console.log(err)
else
console.log(dialog);
});
I also have the WatsonDialogDocument_1.0.xsd document on the same folder as the xml dialog file. At the xml file for the dialog you can also find this
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Upvotes: 0
Views: 258
Reputation: 2430
try to bump up a version to WatsonDialogDocument_1.1.xsd. You should also try to first POST your xml from a REST client. cURL or Rest Console. Just to make sure the problem is in the xml and not in the code.
BTW, you don't need the XSD file to do the POST.
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Upvotes: 1