【问题标题】:How to assign array in a BPEL process如何在 BPEL 流程中分配数组
【发布时间】:2011-10-20 08:50:12
【问题描述】:

我有一个简单的字符串作为输入,并在调用将字符串添加到数组的 Web 服务之后。现在我必须将数组分配给输出(我已在架构中设置为字符串数组)。企业经理给出错误并说结果包含给定 XPath 表达式的多个节点。分配活动显示为待处理。所以基本上我如何将数组或列表分配给也设置为数组的输出变量。wsdl使用的文件是:

<?xml version = '1.0' encoding = 'UTF-8'?>

<definitions
     name="ReturnTypeService"
     targetNamespace="http://examples2/"
     xmlns="http://schemas.xmlsoap.org/wsdl/"
     xmlns:tns="http://examples2/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
    <types>
        <xsd:schema>
            <xsd:import namespace="http://examples2/" schemaLocation="http://localhost:7101/Examples2-Examples2-context-root/ReturnTypePort?xsd=1"/>
        </xsd:schema>
    </types>
    <message name="display">
        <part name="parameters" element="tns:display"/>
    </message>
    <message name="displayResponse">
        <part name="parameters" element="tns:displayResponse"/>
    </message>
    <portType name="ReturnType">
        <operation name="display">
            <input message="tns:display"/>
            <output name="displayResponse"
            message="tns:displayResponse"/>
        </operation>
    </portType>
    <binding name="ReturnTypePortBinding" type="tns:ReturnType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="display">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="ReturnTypeService">
        <port name="ReturnTypePort" binding="tns:ReturnTypePortBinding">
            <soap:address location="http://localhost:7101/Examples2-Examples2-context-root/ReturnTypePort"/>
        </port>
    </service>
</definitions>

@vanto 有没有办法将输入变量中的数组分配给 invoke_input 变量?问题是我的 Web 服务中有多个输入,所以我无法将输入变量中的包装元素复制到调用变量中的包装变量.将代码的sn-p复制到这里:

<assign name="Assign1">
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:dsaName"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/dsaName"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:linesOfData"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/linesOfData"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:description"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/description"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:application"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/application"/>
            </copy>
        </assign>

问题是只有一个是列表类型,所有其他都是字符串类型。用于此的 XML 是:

<element name="process">
            <complexType>
                <sequence>
                     <element name="dsaName" type="string" minOccurs="0"/>
                    <element name="linesOfData" type="string" minOccurs="0" maxOccurs="unbounded"/>

                    <element name="description" type="string" minOccurs="0"/>
            </sequence>
    </complexType>
        </element>
    <element name="processResponse">
        <complexType>
            <sequence>
                <element name="result" type="string" minOccurs="0" maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
</schema>

【问题讨论】:

  • 如果没有看到 &lt;assign&gt; 和 XSD 内容,很难判断。
  • ^这是 xsd。 是:

标签: jdeveloper bpel


【解决方案1】:

from-spec 和 to-spec 不能选择多个元素或属性。在您的情况下,它似乎选择了变量部分中的所有 &lt;return&gt; 元素(即数组的项目)。尝试复制包装项目的元素(即 ns1:displayResponse 元素)并将此元素复制到 ns2:processResponse(to-variable 中的包装元素)。

由于源元素和目标元素似乎都位于不同的命名空间并且属于不同的类型,您可能需要通过 XSLT 脚本(使用 doXSLTransform)运行它以将其从源模式转换为目标模式。

【讨论】:

  • 很高兴听到这个消息。在这个问题上您需要更多帮助吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-05
  • 1970-01-01
  • 2018-01-08
相关资源
最近更新 更多