Author Message
Fred
Joined: Aug 11, 2014
Messages: 2
Offline
While trying to use the System Manager API and sending the below XML into the API to delete a user, I get the following message returned from the API

Operation=Delete User, LoginId: admin, Action: Delete, Object=, Status: Error! Failed to parse XML user: cvc-elt.1: Cannot find the declaration of element 'tns:loginName'. invalid XML file.

Does anyone see anything wrong with the XML string below? I have compared it to the sample xml file from the SDK for the delete user method and do not see anything different other than the values within the fields.

<?xml version="1.0" encoding="UTF-8"?>
<tns:deleteUsers xmlns:tns="http://xml.avaya.com/schema/bulkdelete" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xml.avaya.com/schema/bulkdelete UserProfileSchemaDefinitionForBulkDelete.xsd ">
<tns:deleteType>permanent</tns:deleteType>
<tns:user>
<tns:loginName>jdoe@somewhere.com</tns:loginName>
</tns:user>
</tns:deleteUsers>
Fred
Joined: Aug 11, 2014
Messages: 2
Offline
I have found a solution to this problem.

When you pass the XML string into the entityXMLData field for the API, you have to ensure that there is a carriage return following the </tns:deleteType> tag. Without this the parser cannot find the <tns:user> tag and therefore does not understand the <tns:loginName> tag.

I tested this by putting carriage returns following all closing xml tags in the string I pass to the API and this worked, however, there was no server response message. I was able to see that it was successful only by looking on the System Manager directly and seeing that the user had been deleted.

If you ensure that the XML string you pass has the exact same indentation and carriage returns as the source code, the sample works. If you do any kind of string manipulation or build your xml dynamically from your front end, you need to ensure that you either produce an xml string that has the exact same carriage returns and indentation as the sample xml in the programmers reference or SDK, or simply put one carriage return following the </tns:deleteType> tag to ensure that the <tns:user> tag is at the beginning of a line allowing the parser to find it.
Go to:   
Mobile view