在调用端点之前,如何将标签有条件地插入肥皂请求主体中?

发布于 2025-02-01 10:13:20 字数 5606 浏览 2 评论 0原文

我想根据某种条件将标签添加到肥皂请求主体中

,应在 ActionProperties 标签下添加标签

,因此我尝试使用以下方式使用Enrich Mediator:

<filter regex="false" source="get-property('IsValid')">
    <then>
    <enrich>
      <source clone="true" type="inline">
         <p857:Property propertyId="isArchived" settable="0" xsi:type="p857:SingletonString" 
           xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <p857:Value>1</p857:Value>
           </p857:Property>
      </source>
      <target 
      xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      action="child" 
      type="custom" xpath="//p857:ExecuteChangesRequest/p857:ChangeRequest/p857:ActionProperties" />
   </enrich>
   </then>
        <else/>
   </filter>
    
    
    <payloadFactory media-type="xml">
        <format>
            <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Header>
                    <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
                        <hd:UsernameToken xmlns:hd="http://schemas.xmlsoap.org/ws/2002/12/secext">
                            <hd:Username>$1</hd:Username>
                            <hd:Password>$2</hd:Password>
                        </hd:UsernameToken>
                    </Security>
                </soapenv:Header>
                <soapenv:Body>
                    <p857:ExecuteChangesRequest refresh="1" xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
                        <p857:ChangeRequest id="1" updateSequenceNumber="0">
                            <p857:TargetSpecification classId="ObjectStore" objectId="$3" serializationDuplicate="0"/>
                            <p857:Action autoUniqueContainmentName="1" classId="$4" defineSecurityParentage="0" xsi:type="p857:CreateAction"/>
                            <p857:Action autoClassify="0" checkinMinorVersion="0" xsi:type="p857:CheckinAction"/>
                            <p857:ActionProperties>

                                <p857:Property propertyId="DocumentTitle" settable="0" xsi:type="p857:SingletonString">
                                    <p857:Value>$5</p857:Value>
                                </p857:Property>
                                <p857:Property propertyId="ContentElements" settable="0" xsi:type="p857:ListOfObject">
                                    <p857:Value accessAllowed="0" classId="ContentTransfer" dependentAction="Insert" newIndex="0" originalIndex="0" serializationDuplicate="0" updateSequenceNumber="0">
                                        <p857:Property propertyId="ContentType" settable="0" xsi:type="p857:SingletonString">
                                            <p857:Value>$7</p857:Value>
                                        </p857:Property>
                                        <p857:Property propertyId="RetrievalName" settable="0" xsi:type="p857:SingletonString">
                                            <p857:Value>$5</p857:Value>
                                        </p857:Property>
                                        <p857:Property propertyId="Content" settable="0" xsi:type="p857:ContentData">
                                            <p857:Value xsi:type="p857:InlineContent">
                                                <p857:Binary>$6</p857:Binary>
                                            </p857:Value>
                                        </p857:Property>
                                    </p857:Value>
                                </p857:Property>
                            </p857:ActionProperties>
                            <p857:RefreshFilter levelDependents="0" maxElements="0" maxRecursion="0">
                                <p857:ExcludeProperties>DateCreated</p857:ExcludeProperties>
                                <p857:ExcludeProperties>DateLastModified</p857:ExcludeProperties>
                            </p857:RefreshFilter>
                        </p857:ChangeRequest>
                    </p857:ExecuteChangesRequest>
                </soapenv:Body>
            </soapenv:Envelope>
        </format>
        <args>
            <arg evaluator="xml" expression="get-property('Username')"/>
            <arg evaluator="xml" expression="get-property('Password')"/>
            <arg evaluator="xml" expression="get-property('ObjectStore')"/>
            <arg evaluator="xml" expression="get-property('DocumentClass')"/>
            <arg evaluator="xml" expression="get-property('FileName')"/>
            <arg evaluator="xml" expression="get-property('FileData')"/>
            <arg evaluator="xml" expression="get-property('ContentType')"/>
        </args>
    </payloadFactory>

但是我始终遇到错误:无效的目标对象要丰富

I want to add tag to soap request body based on some condition

It should be added under the ActionProperties tag

so I tried to use the enrich mediator as follows :

<filter regex="false" source="get-property('IsValid')">
    <then>
    <enrich>
      <source clone="true" type="inline">
         <p857:Property propertyId="isArchived" settable="0" xsi:type="p857:SingletonString" 
           xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <p857:Value>1</p857:Value>
           </p857:Property>
      </source>
      <target 
      xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      action="child" 
      type="custom" xpath="//p857:ExecuteChangesRequest/p857:ChangeRequest/p857:ActionProperties" />
   </enrich>
   </then>
        <else/>
   </filter>
    
    
    <payloadFactory media-type="xml">
        <format>
            <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Header>
                    <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
                        <hd:UsernameToken xmlns:hd="http://schemas.xmlsoap.org/ws/2002/12/secext">
                            <hd:Username>$1</hd:Username>
                            <hd:Password>$2</hd:Password>
                        </hd:UsernameToken>
                    </Security>
                </soapenv:Header>
                <soapenv:Body>
                    <p857:ExecuteChangesRequest refresh="1" xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
                        <p857:ChangeRequest id="1" updateSequenceNumber="0">
                            <p857:TargetSpecification classId="ObjectStore" objectId="$3" serializationDuplicate="0"/>
                            <p857:Action autoUniqueContainmentName="1" classId="$4" defineSecurityParentage="0" xsi:type="p857:CreateAction"/>
                            <p857:Action autoClassify="0" checkinMinorVersion="0" xsi:type="p857:CheckinAction"/>
                            <p857:ActionProperties>

                                <p857:Property propertyId="DocumentTitle" settable="0" xsi:type="p857:SingletonString">
                                    <p857:Value>$5</p857:Value>
                                </p857:Property>
                                <p857:Property propertyId="ContentElements" settable="0" xsi:type="p857:ListOfObject">
                                    <p857:Value accessAllowed="0" classId="ContentTransfer" dependentAction="Insert" newIndex="0" originalIndex="0" serializationDuplicate="0" updateSequenceNumber="0">
                                        <p857:Property propertyId="ContentType" settable="0" xsi:type="p857:SingletonString">
                                            <p857:Value>$7</p857:Value>
                                        </p857:Property>
                                        <p857:Property propertyId="RetrievalName" settable="0" xsi:type="p857:SingletonString">
                                            <p857:Value>$5</p857:Value>
                                        </p857:Property>
                                        <p857:Property propertyId="Content" settable="0" xsi:type="p857:ContentData">
                                            <p857:Value xsi:type="p857:InlineContent">
                                                <p857:Binary>$6</p857:Binary>
                                            </p857:Value>
                                        </p857:Property>
                                    </p857:Value>
                                </p857:Property>
                            </p857:ActionProperties>
                            <p857:RefreshFilter levelDependents="0" maxElements="0" maxRecursion="0">
                                <p857:ExcludeProperties>DateCreated</p857:ExcludeProperties>
                                <p857:ExcludeProperties>DateLastModified</p857:ExcludeProperties>
                            </p857:RefreshFilter>
                        </p857:ChangeRequest>
                    </p857:ExecuteChangesRequest>
                </soapenv:Body>
            </soapenv:Envelope>
        </format>
        <args>
            <arg evaluator="xml" expression="get-property('Username')"/>
            <arg evaluator="xml" expression="get-property('Password')"/>
            <arg evaluator="xml" expression="get-property('ObjectStore')"/>
            <arg evaluator="xml" expression="get-property('DocumentClass')"/>
            <arg evaluator="xml" expression="get-property('FileName')"/>
            <arg evaluator="xml" expression="get-property('FileData')"/>
            <arg evaluator="xml" expression="get-property('ContentType')"/>
        </args>
    </payloadFactory>

But I always get an error : Invalid Target object to be enrich

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨洒年华 2025-02-08 10:13:20

我能够通过在PayloadFactory标签之后添加 renrich 标签来解决:

<enrich>
        <source clone="true" type="inline">
            <p857:Property propertyId="isArchived" settable="0" 
            xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="p857:SingletonString">
                <p857:Value>1</p857:Value>
            </p857:Property>
        </source>
        <target action="child" xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
        xpath="//p857:ExecuteChangesRequest/p857:ChangeRequest/p857:ActionProperties"/>
    </enrich>

I was able to fix by adding the enrich tag after the payloadFactory tag :

<enrich>
        <source clone="true" type="inline">
            <p857:Property propertyId="isArchived" settable="0" 
            xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="p857:SingletonString">
                <p857:Value>1</p857:Value>
            </p857:Property>
        </source>
        <target action="child" xmlns:p857="http://www.filenet.com/ns/fnce/2006/11/ws/schema" 
        xpath="//p857:ExecuteChangesRequest/p857:ChangeRequest/p857:ActionProperties"/>
    </enrich>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文