调用CMIS服务时出错

时间:2012-05-02 13:08:12

标签: web-services soap sharepoint-2010 soapui cmis

我正在尝试使用CMIS wsdl在SharePoint存储库中创建文档。但得到一些错误。我正在使用soapui来拨打这项服务。

以下是创建的xml的一部分:

Request : <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:ns1="http://docs.oasis-open.org/ns/cmis/core/200908/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:createDocument>
         <!--Optional:-->
         <ns:repositoryId>64bec929-945e-46f1-9c74-d0ab24803283</ns:repositoryId>
         <!--Optional:-->
         <ns:properties>
            <propertyString propertyDefinitionId="cmis:name" localName="FileLeafRef" displayName="Name" queryName="cmis:name">
               <value>test.txt</value>
            </propertyString>
            <propertyId propertyDefinitionId="cmis:objectId" localName="cmis:objectId" displayName="cmis:objectId" queryName="cmis:objectId">
               <value>123123</value>
            </propertyId>
            <propertyId propertyDefinitionId="cmis:baseTypeId" localName="cmis:baseTypeId" displayName="cmis:baseTypeId" queryName="cmis:baseTypeId">
               <value>cmis:document</value>
            </propertyId>
            <propertyId propertyDefinitionId="cmis:objectTypeId" localName="cmis:objectTypeId" displayName="cmis:objectTypeId" queryName="cmis:objectTypeId">
               <value>cmis:document</value>
            </propertyId>
            <propertyBoolean propertyDefinitionId="cmis:isImmutable" localName="cmis:isImmutable" displayName="cmis:isImmutable" queryName="cmis:isImmutable">
               <value>true</value>
            </propertyBoolean>
            <propertyBoolean propertyDefinitionId="cmis:isLatestVersion" localName="cmis:isLatestVersion" displayName="cmis:isLatestVersion" queryName="cmis:isLatestVersion">
               <value>true</value>
            </propertyBoolean>
            <propertyBoolean propertyDefinitionId="cmis:isMajorVersion" localName="cmis:isMajorVersion" displayName="cmis:isMajorVersion" queryName="cmis:isMajorVersion">
               <value>true</value>
            </propertyBoolean>
            <propertyBoolean propertyDefinitionId="cmis:isLatestMajorVersion" localName="cmis:isLatestMajorVersion" displayName="cmis:isLatestMajorVersion" queryName="cmis:isLatestMajorVersion">
               <value>true</value>
            </propertyBoolean>
            <propertyString propertyDefinitionId="cmis:versionLabel" localName="cmis:versionLabel" displayName="cmis:versionLabel" queryName="cmis:versionLabel">
               <value>1.0</value>
            </propertyString>
            <propertyId propertyDefinitionId="cmis:versionSeriesId" localName="cmis:versionSeriesId" displayName="cmis:versionSeriesId" queryName="cmis:versionSeriesId">
               <value>1</value>
            </propertyId>
            <propertyBoolean propertyDefinitionId="cmis:isVersionSeriesCheckedOut" localName="cmis:isVersionSeriesCheckedOut" displayName="cmis:isVersionSeriesCheckedOut" queryName="cmis:isVersionSeriesCheckedOut">
               <value>true</value>
            </propertyBoolean>
            <propertyInteger propertyDefinitionId="cmis:contentStreamLength" localName="File_x0020_Size" displayName="File Size" queryName="cmis:contentStreamLength">
               <value>19444</value>
            </propertyInteger>
            <propertyString propertyDefinitionId="cmis:contentStreamMimeType" localName="cmis:contentStreamMimeType" displayName="cmis:contentStreamMimeType" queryName="cmis:contentStreamMimeType">
               <value>text/plain</value>
            </propertyString>
            <propertyString propertyDefinitionId="cmis:contentStreamFileName" localName="FileLeafRef" displayName="Name" queryName="cmis:contentStreamFileName">
               <value>test.txt</value>
            </propertyString>
         </ns:properties>
         <ns:folderId/>
         <ns:contentStream>
            <!--Optional:-->
            <ns:length>19444</ns:length>
            <!--Optional:-->
            <ns:mimeType>text/plain</ns:mimeType>
            <!--Optional:-->
            <ns:filename>a1.txt</ns:filename>
            <!--Optional:-->
            <ns:stream>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</ns:stream>
         </ns:contentStream>
         <ns:versioningState>major</ns:versioningState>
         <!--Zero or more repetitions:-->
         <ns:policies/>
         <ns:addACEs>
            <!--Zero or more repetitions:-->
            <ns1:permission>
               <!--Optional:-->
               <ns1:principal>
                  <!--Optional:-->
                  <ns1:principalId/>
               </ns1:principal>
               <!--Zero or more repetitions:-->
               <ns1:permission>cmis:all</ns1:permission>
               <ns1:direct>false</ns1:direct>
            </ns1:permission>
         </ns:addACEs>
         <ns:removeACEs/>
         <ns:extension/>
      </ns:createDocument>
   </soapenv:Body>
</soapenv:Envelope>

我得到的回应是:

   <faultcode>s:constraint</faultcode>
             <faultstring>The operation violates a Repository- or Object-level constraint defined in the CMIS domain model.</faultstring>
             <detail>
                <cmisFault xmlns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                   <code>409</code>
                   <message>The operation violates a Repository- or Object-level constraint defined in the CMIS domain model.</message>
                   <type>constraint</type>
                </cmisFault>
             </detail>
          </s:Fault>

请帮忙......

3 个答案:

答案 0 :(得分:1)

您正在尝试设置只读属性,例如cmis:object:id,cmis:versionSeriesId和其他。检查CMIS规范哪些属性是读写属性。

答案 1 :(得分:0)

您需要确保版本控制的参数与您在SharePoint上启用的参数相匹配

答案 2 :(得分:0)

嗨,这是解决方案,它有效!

检查图片中的附件

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    
    <S:Body>
        <ns2:createDocument xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
            <ns2:repositoryId>A1</ns2:repositoryId>
            <ns2:properties>
                <propertyId propertyDefinitionId="cmis:name">
                    <value>DADADAAAAAA.txt</value>
                </propertyId>
                <propertyId propertyDefinitionId="cmis:objectTypeId">
                    <value>DocumentTopLevel</value>
                </propertyId>
            </ns2:properties>
            <ns2:folderId>100</ns2:folderId>
            <ns2:contentStream>
                <ns2:length>32768</ns2:length>
                <ns2:mimeType>text/plain</ns2:mimeType>
                <ns2:filename>data442.txt</ns2:filename>
                <ns2:stream>
                    <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1ee9605a-a27d-41e9-9c77-d2c1ad244768@example.jaxws.sun.com"/>
                </ns2:stream>
            </ns2:contentStream>
            <ns2:versioningState>none</ns2:versioningState>
        </ns2:createDocument>
    </S:Body>
</S:Envelope>

enter image description here