Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/Web Service API/DMS Operations

SOAP Requests / Responses for folder-related Operations

SOAP Request for createFolder method: 

The below request will create a folder at root level with name as “MyTestFolder”

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:createFolder>
         <api:parentFolderId>/</api:parentFolderId>
         <api:folderInfo>
            <api:name>MyTestFolder</api:name>
            <api:description>This is MyTestFolder</api:description>
            <api:owner>Rohit Gupta</api:owner>
            <api:dateCreated>2011-11-25T15:44:28</api:dateCreated>
            <api:dateLastModified>2011-11-25T15:44:28</api:dateLastModified>
            <api:metaDataType xmlns:fol="http://www.infinity.com/bpm/model/Model/FolderMetaDataType">fol:FolderMetaDataType</api:metaDataType>
            <api:metaData>
               <fol:FolderMetaType xmlns:fol="http://www.infinity.com/bpm/model/Model/FolderMetaDataType" xmlns="http://www.infinity.com/bpm/model/Model/FolderMetaDataType">
                  <folderType>TAX_FOLDER</folderType>
               </fol:FolderMetaType>
            </api:metaData>
         </api:folderInfo>
      </api:createFolder>
   </soapenv:Body>
</soapenv:Envelope>

Below is the SOAP Response for createFolder method:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <createFolderResponse xmlns="http://infinity.com/bpm/ws/v2009a/api" xmlns:ns2="http://infinity.com/bpm/ws/v2009a/api/query">
         <folder>
            <name>MyTestFolder</name>
            <description>This is MyTestFolder</description>
            <owner>Rohit Gupta</owner>
            <dateCreated>2011-11-25T14:27:03.578+05:30</dateCreated>
            <dateLastModified>2011-11-25T14:27:03.594+05:30</dateLastModified>
            <id>{jcrUuid}d4b5ceee-1761-408f-a806-75be72aa95a0</id>
            <path>/MyTestFolder</path>
            <levelOfDetail>DirectMembers</levelOfDetail>
            <documentCount>0</documentCount>
            <folderCount>0</folderCount>
         </folder>
      </createFolderResponse>
   </S:Body>
</S:Envelope>


This is how it will look inside Stardust portal

Stardust Embedded Usage WS API DMS DocumentRepository.png 


Let’s us assume that below is the folder structure in the repository – TAX_Folder has documents related to income tax while Salalry_Folder has documents related to salary slip


Stardust Embedded Usage WS API DMS FolderStructure.png

SOAP Request for getFolder 

Below is the request to get a folder using its folderId.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:getFolder>
         <api:folderId>{jcrUuid}d4b5ceee-1761-408f-a806-75be72aa95a0</api:folderId>
      </api:getFolder>
   </soapenv:Body>
</soapenv:Envelope>


And below is the SOAP Response for getFolder

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <getFolderResponse xmlns="http://infinity.com/bpm/ws/v2009a/api" xmlns:ns2="http://infinity.com/bpm/ws/v2009a/api/query">
         <folder>
            <name>MyTestFolder</name>
            <description>This is MyTestFolder</description>
            <owner>Rohit Gupta</owner>
            <dateCreated>2011-11-25T14:27:03.578+05:30</dateCreated>
            <dateLastModified>2011-11-25T14:27:03.594+05:30</dateLastModified>
            <id>{jcrUuid}d4b5ceee-1761-408f-a806-75be72aa95a0</id>
            <path>/MyTestFolder</path>
            <levelOfDetail>DirectMembers</levelOfDetail>
            <documentCount>0</documentCount>
            <folderCount>2</folderCount>
            <folders>
               <folder>
                  <name>TAX_Folder</name>
                  <description>This is TAX_Folder</description>
                  <owner>Rohit Gupta</owner>
                  <dateCreated>2011-11-25T14:40:09.020+05:30</dateCreated>
                  <dateLastModified>2011-11-25T14:40:09.020+05:30</dateLastModified>
                  <id>{jcrUuid}961b5919-a6ec-4a9b-ae54-cc783de7608a</id>
                  <path>/MyTestFolder/TAX_Folder</path>
                  <levelOfDetail>DirectMembers</levelOfDetail>
                  <documentCount>0</documentCount>
                  <folderCount>0</folderCount>
               </folder>
               <folder>
                  <name>Salary_Folder</name>
                  <description>This is SALARY_Folder</description>
                  <owner>Rohit Gupta</owner>
                  <dateCreated>2011-11-25T14:40:43.403+05:30</dateCreated>
                  <dateLastModified>2011-11-25T14:40:43.403+05:30</dateLastModified>
                  <id>{jcrUuid}c57f4ec0-c7c6-448e-8600-b98af4705f85</id>
                  <path>/MyTestFolder/Salary_Folder</path>
                  <levelOfDetail>DirectMembers</levelOfDetail>
                  <documentCount>0</documentCount>
                  <folderCount>0</folderCount>
               </folder>
            </folders>
         </folder>
      </getFolderResponse>
   </S:Body>
</S:Envelope>



You may specify the folder path also in the folderId at the time of calling getFolder, as shown below in the SOAP Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:getFolder>
         <api:folderId>/MyTestFolder</api:folderId>
      </api:getFolder>
   </soapenv:Body>
</soapenv:Envelope>


SOAP Request for findFolders using NamePattern

In the below request, we are trying to find the folders which has ‘TestFol” in its name.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findFolders>
         <api:folderQuery>
            <api:namePattern>%TestFol%</api:namePattern>
         </api:folderQuery>
      </api:findFolders>
   </soapenv:Body>
</soapenv:Envelope>

SOAP Request for findFolders using xpathQuery

The below query will return folders inside default partition

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findFolders>
         <api:folderQuery>
            <api:xpathQuery>/jcr:root/ipp-repository/partitions/default//*</api:xpathQuery>
         </api:folderQuery>
      </api:findFolders>
   </soapenv:Body>
</soapenv:Envelope>


SOAP Request for findFolders using xpathQuery – here we are specifying that the name of the folder should contain TAX_Fol

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findFolders>
         <api:folderQuery>
            <api:xpathQuery>/jcr:root/ipp-repository/partitions/default//*[jcr:like(vfs:metaData/vfs:name, '%TAX_Fol%')]</api:xpathQuery>
         </api:folderQuery>
      </api:findFolders>
   </soapenv:Body>
</soapenv:Envelope>

 

SOAP Request/Response Samples for Document Related Operations

Let us assume that we have below DocumentMetaType which will be used at the time of creating/fetching the document:

Stardust Embedded Usage WS API DMS DocumentMetaType.png


SOAP Request for Creating a Document 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:createDocument>
         <api:folderId>{jcrUuid}961b5919-a6ec-4a9b-ae54-cc783de7608a</api:folderId>
         <api:createMissingFolders>false</api:createMissingFolders>
         <api:documentInfo>
            <api:name>Rohit_Tax_Doc_Year2011</api:name>
            <api:description>Rohit's Income Tax Document for Year 2011</api:description>
            <api:owner>motu</api:owner>
            <api:dateCreated>2011-11-25T15:20:43.403+05:30</api:dateCreated>
            <api:dateLastModified>2011-11-25T15:20:43.403+05:30</api:dateLastModified>
            <api:metaDataType xmlns:doc="http://www.infinity.com/bpm/model/Model/DocumentMetaType">doc:DocumentMetaType</api:metaDataType>
            <api:metaData>
               <doc:DocumentMetaType xmlns:doc="http://www.infinity.com/bpm/model/Model/DocumentMetaType" xmlns="http://www.infinity.com/bpm/model/Model/DocumentMetaType">
                  <fileName>RohitTAX2011.txt</fileName>
                  <docType>TAX_DOCS</docType>
                  <uploadedBy>motu</uploadedBy>
               </doc:DocumentMetaType>
            </api:metaData>
            <api:contentType>text/plain</api:contentType>
         </api:documentInfo>
         <api:content>cid:724997761511</api:content>
         <api:versionInfo>
            <api:label>1.0</api:label>
         </api:versionInfo>
      </api:createDocument>
   </soapenv:Body>
</soapenv:Envelope>

 

FindDocuments()

Now we assume that we have below folder/document structure in our repository and then we will see different ways to use findDocuments method

Stardust Embedded Usage WS API DMS DocumentStorage.png


The below SOAP Request will fetch document with name pattern Rohit_Tax i.e. Rohit_Tax_Doc_Year2011 in this case.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:namePattern>Rohit_Tax%</api:namePattern>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>

The below SOAP Request (using xPathQuery) will fetch all the documents inside MyTestFolder i.e Rohit_Tax_Doc_Year2011, Vijay_Tax_Doc_Year2011 and Vijay_Salary_Slip_May2011

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:xpathQuery>//MyTestFolder//*</api:xpathQuery>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>


^^Please note that namePattern and xpathQuery cannot be combined as they are exclusive, so if you specify both, only the namePattern is taken.


The below SOAP Request will fetch all the documents inside MyTestFolder whose docType is TAX_DOCS. This docType was specified at the time of creation of the document. The response will contain Rohit_Tax_Doc_Year2011 and Vijay_Tax_Doc_Year2011

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:xpathQuery>/jcr:root/ipp-repository/partitions/default//MyTestFolder//*[jcr:primaryType='nt:file' and vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS']</api:xpathQuery>
            <api:metaDataType xmlns:doc="http://www.infinity.com/bpm/model/Model/DocumentMetaType">doc:DocumentMetaType</api:metaDataType>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>


Further we can use date creation filter in the xpathQuery. The below query will search for the document whose creation date is between 2011-11-20T15:20:17.565+05:30 and 2011-11-25T15:25:17.565+05:30

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:xpathQuery>//MyTestFolder//*[vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS' and jcr:created > xs:dateTime('2011-11-20T15:20:17.565+05:30') and jcr:created lt xs:dateTime('2011-11-25T15:25:17.565+05:30') ]</api:xpathQuery>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>


Below query will search for a document on the basis of name (apart from docType)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:xpathQuery>//MyTestFolder//*[vfs:metaData/vfs:attributes/vfs:docType='TAX_DOCS' and fn:name() ='Rohit_Tax_Doc_Year2011' ]</api:xpathQuery>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>



The below query will search for documents on the basis of description

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://infinity.com/bpm/ws/v2009a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:xpathQuery>//MyTestFolder//*[jcr:like(vfs:metaData/vfs:description,'%Tax%') ]</api:xpathQuery>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>

getDocumentContent()

The below query will fetch the document's content

Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://eclipse.org/stardust/ws/v2012a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:getDocumentContent>
         <api:documentId>{jcrUuid}8d49604a-1969-485c-8a67-d9423dd7ff34</api:documentId>
      </api:getDocumentContent>
   </soapenv:Body>
</soapenv:Envelope>
 
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header/>
   <soap:Body>
      <getDocumentContentResponse xmlns="http://eclipse.org/stardust/ws/v2012a/api" xmlns:ns2="http://eclipse.org/stardust/ws/v2012a/api/query">
         <content>
            <xop:Include href="cid:620a8f2e-c7d7-402a-afdc-f0a1a990825e-4@eclipse.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
         </content>
      </getDocumentContentResponse>
   </soap:Body>
</soap:Envelope>

In SOAPUI, you will get it as response attachment. Using WS API getDocumentContent, the return type is Base64Binary, fetch text out of the Base64Binary to get the text form of the document content.

The supplied documentId is the document ID one gets as a response of findDocuments request/WS call.

E.g.

Request:
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://eclipse.org/stardust/ws/v2012a/api">
   <soapenv:Header/>
   <soapenv:Body>
      <api:findDocuments>
         <api:documentQuery>
            <api:namePattern>my%</api:namePattern>
         </api:documentQuery>
      </api:findDocuments>
   </soapenv:Body>
</soapenv:Envelope>
 
Response:
 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header/>
   <soap:Body>
      <findDocumentsResponse xmlns="http://eclipse.org/stardust/ws/v2012a/api" xmlns:ns2="http://eclipse.org/stardust/ws/v2012a/api/query">
         <documents>
            <document>
               <name>myDoc1.txt</name>
               <owner>motu</owner>
               <dateCreated>2013-12-03T10:48:22.157+05:30</dateCreated>
               <dateLastModified>2013-12-03T10:49:18.369+05:30</dateLastModified>
               <contentType>text/plain</contentType>
               <id>{jcrUuid}8d49604a-1969-485c-8a67-d9423dd7ff34</id>
               <path>/TestFolder/myDoc1.txt</path>
               <size>14</size>
               <revisionId>{jcrRev}9eb9edf4-60ff-4eed-b702-1d045128f25b</revisionId>
               <revisionName>1.1</revisionName>
               <revisionComment/>
               <versionLabels/>
            </document>
            <document>
               <name>myDoc2.txt</name>
               <owner>motu</owner>
               <dateCreated>2013-12-03T10:48:40.196+05:30</dateCreated>
               <dateLastModified>2013-12-03T10:49:36.735+05:30</dateLastModified>
               <contentType>text/plain</contentType>
               <id>{jcrUuid}c58c94e6-883c-4bb0-bbe1-255d7d8d1f64</id>
               <path>/TestFolder/myDoc2.txt</path>
               <size>14</size>
               <revisionId>{jcrRev}aa89bbb2-4362-45f4-b7a9-3fad0f0ec2ea</revisionId>
               <revisionName>1.1</revisionName>
               <revisionComment/>
               <versionLabels/>
            </document>
            <document>
               <name>myDoc3.txt</name>
               <owner>motu</owner>
               <dateCreated>2013-12-03T10:48:47.731+05:30</dateCreated>
               <dateLastModified>2013-12-03T10:49:52.260+05:30</dateLastModified>
               <contentType>text/plain</contentType>
               <id>{jcrUuid}8a1700d7-f776-4213-9447-95bf378a0d44</id>
               <path>/TestFolder/myDoc3.txt</path>
               <size>14</size>
               <revisionId>{jcrRev}a8899079-d0f2-4803-80c5-0c2d6421197e</revisionId>
               <revisionName>1.1</revisionName>
               <revisionComment/>
               <versionLabels/>
            </document>
         </documents>
      </findDocumentsResponse>
   </soap:Body>
</soap:Envelope>

Back to the top