cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello SCP Document Service experts,

we want to use the SCP Document Service from HANA XSJS (XS Classic, XSC). For that I've implemented a Proxy Bridge in Java to be able to call the Document Service via HTTPS and OAuth / Basic authentication. Using this Proxy I can already create a new document and read it from HANA XS.

But before uploading a document I want to check if for this business object already a document exists. Based on the example I've found in the document CMIS Browser Binding Proposal - Oasis I've added the following

<form id="queryForm" action="" method="GET">
<input name="cmisaction" type="hidden" value="query" />
<table>
<tr><td>Query:</td><td><input name="statement" type="text" size="100" maxlength="1000" 
value="SELECT * FROM cmis:document 
WHERE cmis:name = '00b83148-5d86-aebe-84e0-332ef729a0c3'"></td></tr>
<tr><td>Max Items:</td><td><input name="maxItems" type="text" size="4" maxlength="8" value="100"></td></tr>
<tr><td>Skip Count:</td><td><input name="skipCount" type="text" size="4" maxlength="8" value="0"></td></tr>
<tr><td></td><td><input type="submit" value="Go" /></td></tr>
</table>
</form>

to the sample that is provided in the Documenation Accessing the Document Service from an HTML5 Application. Unfortunately the result that I've got returned isn't filtered by the cmis:name that I'm looking for. All objects in the folder are returned.

Hope someone can guide me in the right direction.

Best regards
Gregor

View Entire Topic
Former Member

There is another issue in your form. Queries must be executed as a POST not a GET request. As you do a GET on the /root collection this is interpreted as an getObjectByPath() call on the root folder. The query parameters are ignored in this case. So you get all children of the root folder. To do a query, try this:

    <form id="queryForm" action="https://cmisproxy<account>.hana.ondemand.com/<servletpath>/json/<repo-ID>" 
      method="POST"> <!-- omit the /root at the end of the URL!!!! -->
      <input name="cmisaction" type="hidden" value="query" />
      ...
  </form>

And one remark: For performance reasons do not a SELECT *, do a SELECT on only those properties you are interested in. Some properties are expensive to get and it will cause a lot of data to be transmitted.

gregorw
SAP Mentor
SAP Mentor

Hi Jens,

thank you for the great guidance. I finally made it work using this form:

	<form id="queryForm" action="/cmis/json/45e890711d092fc031656795" method="POST">
		<input name="cmisaction" type="hidden" value="query" />
		<table>
		<tr><td>Query:</td><td><input name="statement" type="text" size="100" maxlength="1000" 
		value="SELECT cmis:contentStreamMimeType, cmis:name 
			FROM cmis:document 
			WHERE cmis:name = '7ee9bab7-9b9f-0c1c-c2c5-c45ee6d9857c' 
			  AND IN_FOLDER('LJz3ItlxLloqQCVDaAwK0a9ZRUXFwKT7Dcl7R_HKA1k')"></td></tr>
		<tr><td>Max Items:</td><td><input name="maxItems" type="text" size="4" maxlength="8" value="100"></td></tr>
		<tr><td>Skip Count:</td><td><input name="skipCount" type="text" size="4" maxlength="8" value="0"></td></tr>
		<tr><td></td><td>
		<input type="submit" value="Go" /></td></tr>
		</table>
	</form>	

Best regards
Gregor