Wednesday, December 14, 2016

Sample sequence to call https backend service

Here is the sample sequence to call HTTPS backend service


<?xml version="1.0" encoding="UTF-8"?>  
 <sequence xmlns="http://ws.apache.org/ns/synapse" name="request" onError="fault">  
   <log level="full"/>  
   <property name="POST_TO_URI" value="true" scope="axis2"/>  
   <call blocking="true">  
    <endpoint>  
      <http method="GET" uri-template="https://httpbin.org/get"/>  
    </endpoint>  
   </call>  
 </sequence>

Here the HTTP endpoint allows you to define REST endpoints using URI templates.

You can use HTTP endpoint Syntex as below,


<http uri-template="URI Template" method="GET|POST|PUSH|PUT|DELETE|OPTIONS|HEAD" />

HTTP Endpoint Attributes
  • uri-template - The URI template that constructs the RESTful endpoint URL at runtime.
  • method - The HTTP method to use during the invocation.
Call mediator

The Call mediator is used to send messages out of the ESB to an endpoint. You can call services either in blocking or non-blocking manner. When you call a service in non-blocking mode, the worker thread returns without waiting for the response from back-end service. In blocking mode, the underlying worker thread gets blocked and waits for the response after sending the request to the endpoint. Call mediator in blocking mode is similar to the Callout mediator.

No comments:

Post a Comment