Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Stardust/Knowledge Base/Web Service API/DMS Operations"

m (Added image for documents list)
m
Line 83: Line 83:
 
Now we assume that we have below folder/document structure in our repository and then we will see different ways to use findDocuments method  
 
Now we assume that we have below folder/document structure in our repository and then we will see different ways to use findDocuments method  
  
[[Image:Stardust_Embedded_Usage_WS_API_DMS_DocumentStorage.png|300x200px]]
+
[[Image:Stardust Embedded Usage WS API DMS DocumentStorage.png|300x200px]]  
 
+
  
 +
<br>
  
 
The below SOAP Request will fetch document with '''name pattern '''Rohit_Tax i.e. Rohit_Tax_Doc_Year2011 in this case.  
 
The below SOAP Request will fetch document with '''name pattern '''Rohit_Tax i.e. Rohit_Tax_Doc_Year2011 in this case.  
Line 97: Line 97:
 
&lt;/api:findDocuments&gt;<br>&lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;<br>
 
&lt;/api:findDocuments&gt;<br>&lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;<br>
  
***Please note that namePattern and xpathQuery cannot be combined they are exclusive, so if you specify both, only the namePattern is taken
+
 
 +
 
 +
#Please note that namePattern and xpathQuery cannot be combined as they are '''exclusive''', so if you specify both, only the namePattern is taken.
  
 
<br>
 
<br>

Revision as of 06:22, 5 December 2011

SOAP Request/Response Samples 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 IPP 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

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>


  1. 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>

Back to the top