cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Client POST call does not return response body in DATA Hub

boudhayan-dev
Advisor
Advisor
0 Kudos
946

Hi,

I am using an HTTP operator to make a POST request to an endpoint in a Data HUB pipeline as follows -

The POST request succeeds. I can verify that by checking the logs of the application to which the call is made. The application returns a transformed JSON of the POST request. I have verified the behavior using POSTMAN client as well.

The following is a snippet of the logs when the POST call from the pipeline is made -

The problem arises with the response from the HTTP Client. I have tried to see the response using a wiretap operator but nothing shows up in the wiretap console. I have also noticed that if I am making a GET call to an endpoint, then the response is captured in wiretap operator. Why is that ? Why am I not able to receive the POST request's response from the pipeline ?

Regards,

Boudhayan Dev

Accepted Solutions (1)

Accepted Solutions (1)

boudhayan-dev
Advisor
Advisor
0 Kudos

So, the HTTP Operator is designed to works as follows -

1. GET polling without consuming input.

2. POST call without producing output (in this case output = server's response).

In order to get around this restriction, we need to manually pass the request to the HTTP Client in it's inMessage(message) port. The response from the server will now be available in the outResponse(message) port.

The JS operator contains the following script -

$.addTimer("1000ms",sendPOST);


function sendPOST(ctx) {
    $.outMessage({
        Attributes: {
            "http.url" : "https://example.com/map",
            "http.method" : "POST",
            "http.Content-Type" : "application/json"
        },
        Body: {
                "CONTACT": "12344",
                "EMAIL": "boudhayan.dev@test.com",
                "FIRST_NAME": "Boudhayan",
                "ID": 14,
                "LAST_NAME": "Dev"
            }
    });


}


Regards,

Boudhayan Dev

Answers (1)

Answers (1)

michael_eaton3
Active Contributor
0 Kudos

It looks like you're viewing the output port outMessage, have you tried checking the data from the out port?

Michael

boudhayan-dev
Advisor
Advisor
0 Kudos

Yes, I have tried checking the output on both the ports. But as I said earlier, the outputs exist only in case of GET requests. Here is the modified pipeline with wiretap on both the endpoints

michael_eaton3
Active Contributor
0 Kudos

It is probably there, its just not displayed. The wiretap does not display the message body by default, try the Terminal.

boudhayan-dev
Advisor
Advisor
0 Kudos

I tried with the Terminal operator but no output over there as well. I have also tried to write the response to a file. Did not work either. But writing to a file/terminal with GET request works fine.

michael_eaton3
Active Contributor
0 Kudos

Its possibly a bug then.