不同流中的HTTP请求响应

时间:2014-05-19 07:39:54

标签: http request mule esb mule-studio

目前我正在与Mule合作并需要做类似的事情:

- 流程更新 -

Flow

http端点是请求 - 响应(不是单向)。我的意思是,我想在RequestFlow中查询我的http请求,并从ServiceResponse中的http获取响应。

怎么做?谢谢你的帮助。

- 添加了XML配置请求 - 更新标记已更新

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

<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd">
    <custom-transformer name="StringToNameString" class="de.fraport.sources.StringtoAusweis" doc:name="Java"/>
    <wmq:connector name="WMQ" hostName="localhost" port="1414" queueManager="localmanager" validateConnections="true" doc:name="WMQ" ccsId="819"/>
    <data-mapper:config name="json_to_xml" transformationGraphPath="json_to_xml.grf" doc:name="json_to_xml"/>

    <flow name="RequestFlow" doc:name="RequestFlow">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="uebermittleAusweisdaten" doc:name="HTTP"/>
        <expression-filter expression="#[message.payload !='/favicon.ico']" doc:name="Expression"/>
        <set-variable variableName="id" value="#[message.id]" doc:name="Variable"/>
        <data-mapper:transform config-ref="json_to_xml" doc:name="JSON To XML">
            <data-mapper:input-arguments>
                <data-mapper:input-argument key="id">#[flowVars['id']]</data-mapper:input-argument>
            </data-mapper:input-arguments>
        </data-mapper:transform>
        <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="D:\Workspace\soaptest\mobako.sender.xsl" doc:name="XSLT" encoding="ISO8859-1"/>
        <mulexml:dom-to-xml-transformer  doc:name="DOM to XML" outputEncoding="ISO8859-1"/>
        <wmq:outbound-endpoint queue="LSMH.ZKSEAP.SERVICEBUS" connector-ref="WMQ" doc:name="ZKSEAP IN" encoding="ISO8859-1" />
        <request-reply storePrefix="mainFlow">
        <wmq:outbound-endpoint queue="LSMH.ZKSEAP.SERVICEBUS" connector-ref="WMQ" doc:name="ZKSEAP IN" encoding="ISO8859-1" correlationId="#[message.id]"/>
        <wmq:inbound-endpoint queue="ZKSEAP.LSMH.SERVICEBUS" connector-ref="WMQ" doc:name="ZKSEAP OUT" encoding="UTF-8"/>
    </request-reply>
        <http:response-builder doc:name="HTTP Response Builder"/>
    </flow>
    <flow name="ServiceResponse" doc:name="ServiceResponse">
        <wmq:inbound-endpoint queue="ZKSEAP.LSMH.SERVICEBUS" connector-ref="WMQ" doc:name="ZKSEAP OUT" encoding="UTF-8"/>
        <json:object-to-json-transformer doc:name="Object to JSON"/>
    </flow>
</mule>

- 错误更新 -

在我更改流程并使用回复响应路由消息后,我尝试调试流程。我发现了一些奇怪的东西。当调试器到达

  

请求 - 应答

组件,它会自动返回

  

表达

组件(循环)。我该如何解决?

1 个答案:

答案 0 :(得分:2)

要实现目标,您需要:

相关问题