使用Mule从URL获取XML

时间:2020-11-26 16:05:45

I have a basic mule flow:

我有一个基本的骡子流:

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

<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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.5.2"
    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/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">
    <flow name="flow_test" doc:name="flow_test">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" doc:name="HTTP"/>
        <logger level="INFO" doc:name="Logger"/>
        <logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>

    </flow>
</mule>

I use the logger to show a message by console using this value:

我使用记录器通过控制台使用此值显示消息:

#[message.payloadAs(java.lang.String)]

The problem is that I only get this message:

问题是我只收到这条消息:

INFO 2015-05-27 12:36:42,659 [[test].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: /

INFO 2015-05-27 12:36:42,659 [[test] .connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor:/

Where the "/" value would be the XML. What should I need to do to display the XML?

其中“/”值是XML。我应该怎么做才能显示XML?

Update: The problem is that the http.method INBOUND is GET and it would be POST to display the data. Can I transform the GET to POST?

更新:问题是http.method INBOUND是GET,它将是POST以显示数据。我可以将GET转换为POST吗?

Thanks.

1 个解决方案

#1


0  

You don't need to transform anything in http inbound endpoint inorder to get data... if you post certain data to this flow using a Rest client or postman, you will automatically get that data in you flow and can print it in logger.

您无需转换http入站端点中的任何内容以获取数据...如果您使用Rest客户端或邮递员将某些数据发布到此流,您将自动获取流中的数据并可以在记录器中打印。

You just need to post data from outside to this flow as I mentioned using Rest client or postman.. you will automatically get the data in the flow

您只需要将外部数据发布到此流程,就像我提到的使用Rest客户端或邮递员一样..您将自动获取流中的数据

#1


0  

You don't need to transform anything in http inbound endpoint inorder to get data... if you post certain data to this flow using a Rest client or postman, you will automatically get that data in you flow and can print it in logger.

您无需转换http入站端点中的任何内容以获取数据...如果您使用Rest客户端或邮递员将某些数据发布到此流,您将自动获取流中的数据并可以在记录器中打印。

You just need to post data from outside to this flow as I mentioned using Rest client or postman.. you will automatically get the data in the flow

您只需要将外部数据发布到此流程,就像我提到的使用Rest客户端或邮递员一样..您将自动获取流中的数据