Supported Since: 17.01
HTTP Method Setter processing element set the configured HTTP method for the out going HTTP calls. All HTTP method types are allowed to set using this processing element.
In order to use this processing element, you must first select the HTTP NIO Connector dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the HTTP NIO Connector dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the HTTP NIO Connector dependency.
Message will be emitted from this port after changing the HTTP method from the configured value
The message context will be sent to this outport if any exception occurred while setting the HTTP method
In the following use case, the requirement is to mediate messages to a web service which calls to an external API to get data and prepare a response for user requests. This web service accepts HTTP POST requests and the external API only supports HTTP GET method.
In order to implement above use case you must first select following dependencies when you are creating an empty Ultra project
HTTP NIO Connector from the connector list.
Content Extractor and Transport Header Manager dependencies from the processor list.
|If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies|
For the implementation we should extract out required parameter from the received JSON message using the JSON Path Extractor and then add the extracted value as a query parameter and then send the request to the external web service as a GET request by changing the the HTTP method.
To implement above use case, first let’s create our integration flow named “http-method-setter-sample". Then add an NIO HTTP Ingress Connector and configure the request receiving service path and port.
After that JSON Path Extractor should be added to extract the Symbol which received at the $Organization.Symbol JSON path and then hen Add Query Parameter processing element should be added to set the extracted Symbol value as the query parameter for the out going HTTP request.
Next processing element should be the HTTP Method Setter processing element to set the HTTP method to GET. This will set the current HTTP method as GET and this point onwards all the out going HTTP calls will be considered as HTTP get requests for this particular flow. HTTP Method Setter processing element should be configured as below to change the HTTP method,
As the final element, HTTP Egress Connector should be added to send out the GET HTTP call to the external API.
With all above elements, complete integration flow would be like this,
Now run your integration flow and send a request message to the configured request URL to test your integration flow. Once you send a request, check with the flow tracing, you should be able to see that the x.http.method message property has been changed from POST to GET after the HTTP Method Setter processing element.