Consume Restful
Web Service in mule 4
We can
consume restful web service in mule by HTTP requester component in Mule 4
Flow:
test_rest_consumeFlow1
flow is a restful mule API that is consumed by test_rest_consumeFlow flow.
Method: GET
Method: GET
Output:
XML project
code:
<?xml version="1.0" encoding="UTF-8"?>
<mule 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="ce03dff1-2b7f-408a-b1f4-3b5407071593" >
<http:listener-connection host="0.0.0.0" port="8085" />
</http:listener-config>
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="ad253e62-fdfb-45c3-aaa6-58ee464fe13c" >
<http:request-connection host="localhost" port="8085" />
</http:request-config>
<flow name="test_rest_consumeFlow" doc:id="7a2f3757-03ef-4663-8b1a-41c80041b1e6" >
<http:listener doc:name="Listener" doc:id="f3d2fd3b-0bf2-4ca4-ab59-67f529ff489f" config-ref="HTTP_Listener_config" path="/req"/>
<http:request method="GET" doc:name="Request" doc:id="637ba29a-73e9-478e-bf43-1ec3c4dd8184" config-ref="HTTP_Request_configuration" path="/test"/>
</flow>
<flow name="test_rest_consumeFlow1" doc:id="50625c96-e66e-405d-a06a-49794973acf5" >
<http:listener doc:name="Listener" doc:id="da1393cf-7370-4434-b2fc-5c2b51cdeaa0" config-ref="HTTP_Listener_config" path="/test"/>
<logger level="INFO" doc:name="Logger" doc:id="c7aaa90a-d7aa-4ded-8007-241aa51d1453" message="Hi Everyone"/>
</flow>
</mule>
No comments:
Post a Comment