[#5891] - Need the XML for deleting a folder

Category:
Bug report
Priority:
High
Status:
Feedback Requested
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

Please provide the XML for deleting a folder from the server. I have the following for deleting a resource from a report unit:

<request operationName="delete" locale="en">
<argument name="MODIFY_REPORTUNIT_URI">/reports/JD_New_report</argument>
<resourceDescriptor name="test_img" wsType="img" uriString="/reports/
JD_New_report_files/test_img">
<label>test image</label>
<description>test image</description>
</resourceDescriptor>
</request>

but I don't know exactly what to send to the server to get a folder deleted. Any help would be greatly appreciated.

tomreilly's picture
Joined: Aug 29 2012 - 1:07pm
Last seen: 10 years 6 months ago

9 Comments:

#1

Tom,

Looking at the WebServices Guide and the example of creating a folder combined with deleting a resource from a report unit, the XML you are looking for likely looks like the following:

<request operationName="delete" locale="en">
<resourceDescriptor name="test" wsType="folder" uriString="/reports/samples/test" >
<label>Test</label>
<description>This is a test</description>
<resourceProperty name="PROP_PARENT_FOLDER">
<value>/reports/samples</value>
</resourceProperty>
</resourceDescriptor>
</request>

Did this not work for you? The only thing I am not sure of is whether you need to provide the parent folder property or not.

If you can use the REST web services, instead of SOAP, things are much simpler.

#2

Remove the argument MODIFY_REPORTUNIT_URI, set the correct wsType to Folder and set the proper folder.

<request operationName="delete" locale="en">
<resourceDescriptor name="myfolder" wsType="folder" uriString="/reports/myfolder">
</resourceDescriptor>
</request>

Giulio

#3

Running the XML you suggested, I get the following XML response:

<?xml version="1.0" encoding="UTF-8" ?>
<operationResult version="2.0.1">
<returnCode>
<![CDATA[ 2 ]]>
</returnCode>
<returnMessage>
<![CDATA[ 1 validation error(s) occurred: Specify a label. ]]>
</returnMessage>
</operationResult>

Please try running a little test of your own, using the XML you sent me, and send me the XML response that you get. I don't know what's different, but somehow the XML you asked me to run seems to be rejected as invalid.

Thank you,

Tom

#4

Tom, did you try adding the matching label for the folder in a label element? The error message seems pretty clear. If so, what error did you get after?

If you would be willing to use REST, it would be a simple http DELETE request to http://<server>:<port>/jasperserver/rest/resource/reports/myfolder

#5

This is a delete request generated by iReport. You probably may omit some attributes like the resourceProperty, in my previous version I probably missed label, which by the way can probably even be just empty.

<request operationName="delete" locale="en_US">
<resourceDescriptor name="myfolder" wsType="folder" uriString="/reports/myfolder" isNew="false">
<label><![CDATA[My Folder]]></label>
<creationDate>1347470466548</creationDate>
<resourceProperty name="PROP_HAS_DATA">
<value><![CDATA[false]]></value>
</resourceProperty>
<resourceProperty name="PROP_RESOURCE_TYPE">
<value><![CDATA[com.jaspersoft.jasperserver.api.metadata.common.domain.Folder]]></value>
</resourceProperty>
<resourceProperty name="PROP_PARENT_FOLDER">
<value><![CDATA[/reports]]></value>
</resourceProperty>
<resourceProperty name="PROP_VERSION">
<value><![CDATA[0]]></value>
</resourceProperty>
</resourceDescriptor>
</request>

#6

I prepared the following XML for a folder delete:

<request operationName="delete" locale="en">
<resourceDescriptor name="Test_Client356702" wsType="folder" uriString="/Clients/Test_Client356702" isNew="false">
<label><![CDATA[Test Client356702]]></label>
<resourceProperty name="PROP_HAS_DATA">
<value><![CDATA[false]]></value>
</resourceProperty>
<resourceProperty name="PROP_RESOURCE_TYPE">
<value><![CDATA[com.jaspersoft.jasperserver.api.metadata.common.domain.Folder]]></value>
</resourceProperty>
<resourceProperty name="PROP_PARENT_FOLDER">
<value><![CDATA[/Clients]]></value>
</resourceProperty>
<resourceProperty name="PROP_VERSION">
<value><![CDATA[0]]></value>
</resourceProperty>
</resourceDescriptor>
</request>

It was sent to the server, and the XML response I got had a return code of 0, but the folder was not deleted. I don't see what it is that the server doesn't like, and the 0 return code disguises the fact that nothing was actually deleted.

#7

Check the server log, or just try using iReport to remove the directory. You can also use a tool like tcpmon.jar to log HTTP traffic and see what iReport does for instance.

Are you sure you have the permissions to delete the folder and that the folder is correct? I.e. you may have different paths depending by the user you are using to connect to the repository.

Giulio

#8

The user I am using has "Administer" permissions on the folder that won't go away. Moreover, if permissions are preventing an attempted delete, shouldn't the return code be non-zero?

It still seems as though you have not tried writing a simple test application that tries to delete a folder through the SOAP interface. Would you please do that and - if it works - please send it to me?

#9

Please consider this problem report again, and see if you can spare the time to fix it for us. Thank you!

Feedback
randomness