Consume Restful Web Service in Mule 4


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.

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>


© 2020 goformule.com

Share on :

Mule 4:

XML to JSON in mule 4 Web service consumer VM Validation in Mule 4 Until Successful
Sub flow Set Variable & Remove Variable Set Transaction ID Scatter Gather Round Robin
Consume Restful Service CRUD in Mule 4 Parse Template Object to JSON Load Static Resource
JSON to XML Invoke Idempotent Filter ForEach Flat file to JSON
Fixwidth to JSON First Successful File Execute Error Handling
Email Dynamic Evaluate Custom Business Event CSV to JSON Copybook to JSON
Choice Router Async RabbitMQ


Mule 3:


Database Connector Async CXF Attachement XSLT
Mongo DB Cache scope Custom Business Event Gzip Compress Expression
SMTP For Each Expression Javascript Filter Reference
Salesforce Message Enricher Groovy Parse Template Idempotent
VM Poll Invoke Ruby Message
Webservice consumer Python Transformer reference Message Property Not
Collection Aggregator First Sucessful Catch Exception Strategy Reference Exception Strategy Or
Choice Message Chunk Aggregator Choice Exception Strategy Global Exception Strategy Schema Validation
Custom Aggregator Scatter Gather Custom Exception Strategy Batch Processing MEL
M Unit RAML Map Operator API Mocking Dataweave