ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » No Useful Response to HTTP POST Request

Post new topic  Reply to topic
 No Useful Response to HTTP POST Request « View previous topic :: View next topic » 
Author Message
Trophies
PostPosted: Wed Jun 13, 2018 8:18 am    Post subject: No Useful Response to HTTP POST Request Reply with quote

Newbie

Joined: 13 Jun 2018
Posts: 4

Hello All,

IIB newbie here. So, I'm currently building a rest API and I'd like to make an HTTP POST request to a particular endpoint resource. This resource expects some parameters, one authentication header and two others which should be included in the message body.

Unfortunately, whilst I receive success (200) status response, my message response doesn't include any other information i.e. Content-Length is 0. In addition, I get the following error when I try to access the resource through the command line.

Quote:
Failure when reading Request Message Body. There is no Content-Length or Transfer-Encoding: chunked header.


I'm sure this resource is operational as I've tested it on SOAP UI. Can anyone here provide pointers on what I'm doing wrong? Included below is my operational environment.

Many thanks,

ENVIRONMENT

1. Integration Broker:

IIB V10

2. Sub Flow:

Input -> Compute Node -> HTTP Request -> Output

3. Compute Node :

Code:

SET OutputLocalEnvironment.Destination.HTTP.RequestLine.Method = 'POST';    
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = endpointURL;
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'application/json';
SET OutputRoot.HTTPRequestHeader."Auth" = Key;
      
SET OutputLocalEnvironment.Destination.HTTP.QueryString.key1= value1;
SET OutputLocalEnvironment.Destination.HTTP.QueryString.key2= value2;


3.1. Compute Mode: LocalEnvironment and Message

4. HTTP Request Settings:

SSL: TLS V1.2
Response Message Parsing: JSON
Advanced: All ticked

5. Response Information:

Code:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Content-Type: application/json
Date: Wed, 13 Jun 2018 15:56:15 GMT
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 13, 2018 8:48 am    Post subject: Re: No Useful Response to HTTP POST Request Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Trophies wrote:
I get the following error when I try to access the resource through the command line.

Quote:
Failure when reading Request Message Body. There is no Content-Length or Transfer-Encoding: chunked header.


Using what? curl?

Trophies wrote:
I'm sure this resource is operational as I've tested it on SOAP UI.


What did the SoapUI call return as payload? Are you sure you're providing the same headers/parameters through IIB/command line as SoapUI?

Trophies wrote:
Can anyone here provide pointers on what I'm doing wrong?


From what you've posted, nothing. Both IIB and this command line tool are reporting that there's no payload being returned by the remote resource. That's nothing you're going to immediately fix at your end.

You could try asking whoever owns this resource to look in whatever logging they have to see why this is being reported as successful (a 200 code) but no payload is sent.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Trophies
PostPosted: Thu Jun 14, 2018 12:27 am    Post subject: Reply with quote

Newbie

Joined: 13 Jun 2018
Posts: 4

Quote:
Using what? curl?


Yes

Quote:
What did the SoapUI call return as payload?


Code:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 14 Jun 2018 08:12:45 GMT
Content-Type: application/json
Content-Length: 1753
Connection: keep-alive
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, DELETE
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
Access-Control-Max-Age: 300
Cache-Control: no-cache, no-store
Request-Id: req_cfsl47o43fbPeA
Stripe-Version: 2018-05-21
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload

{
payload: "Excluded for the sake of brevity"
}



Quote:
Are you sure you're providing the same headers/parameters through IIB/command line as SoapUI?


1. Localhost Raw Request

Code:

POST http://localhost:7801/stripe/v1/v1/charges HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Content-Length: 0
Host: localhost:7801
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


2. Localhost Raw Response

Code:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Content-Type: application/json
Date: Thu, 14 Jun 2018 08:17:16 GMT


3. Using the applications endpoint Request

Code:

POST https://api.stripe.com/v1/charges HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
Authorization: Authorization Key
Content-Length: 72
Host: Insert Host Url Here
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


4. Response

Code:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 14 Jun 2018 08:12:45 GMT
Content-Type: application/json
Content-Length: 1753
Connection: keep-alive
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, DELETE
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required
Access-Control-Max-Age: 300
Cache-Control: no-cache, no-store
Request-Id: req_cfsl47o43fbPeA
Stripe-Version: 2018-05-21
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload

{
payload: "Excluded for the sake of brevity"
}
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jun 14, 2018 4:40 am    Post subject: Re: No Useful Response to HTTP POST Request Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Vitor wrote:
From what you've posted, nothing. Both IIB and this command line tool are reporting that there's no payload being returned by the remote resource. That's nothing you're going to immediately fix at your end.

You could try asking whoever owns this resource to look in whatever logging they have to see why this is being reported as successful (a 200 code) but no payload is sent.


Nothing you've posted causes me to change this position.

When you get a payload back with curl, then turn your attention to debugging IIB.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Trophies
PostPosted: Thu Jun 14, 2018 6:02 am    Post subject: Reply with quote

Newbie

Joined: 13 Jun 2018
Posts: 4

Hi Vitor,

Thanks for your help, I have figured out the problem. It turns out that when I set the Request URL, I wrote 'http' instead of 'https'. This particular operation requires the latter. Normally, an error should be generated ( at least it happens when I try to access the endpoint directly), but this didn't happen in my case.

Thanks once again
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jun 14, 2018 6:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Trophies wrote:
Thanks for your help, I have figured out the problem. It turns out that when I set the Request URL, I wrote 'http' instead of 'https'. This particular operation requires the latter. Normally, an error should be generated ( at least it happens when I try to access the endpoint directly), but this didn't happen in my case.


I suspect your browser is bright enough to generate a "missing content" message whereas curl et al are getting a 200 code and calling that good enough. Remember it's actually a valid scenario for an endpoint to return a 200 code and no payload. Not common to be sure, but valid.

But it's working for you now so yay.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 14, 2018 6:42 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Vitor wrote:
Trophies wrote:
Thanks for your help, I have figured out the problem. It turns out that when I set the Request URL, I wrote 'http' instead of 'https'. This particular operation requires the latter. Normally, an error should be generated ( at least it happens when I try to access the endpoint directly), but this didn't happen in my case.


I suspect your browser is bright enough to generate a "missing content" message whereas curl et al are getting a 200 code and calling that good enough. Remember it's actually a valid scenario for an endpoint to return a 200 code and no payload. Not common to be sure, but valid.

But it's working for you now so yay.

Hi Vitor are you sure it should not be a 204 return code if there is no payload?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Sun Jun 17, 2018 10:36 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Vitor wrote:
Trophies wrote:
Thanks for your help, I have figured out the problem. It turns out that when I set the Request URL, I wrote 'http' instead of 'https'. This particular operation requires the latter. Normally, an error should be generated ( at least it happens when I try to access the endpoint directly), but this didn't happen in my case.


I suspect your browser is bright enough to generate a "missing content" message whereas curl et al are getting a 200 code and calling that good enough. Remember it's actually a valid scenario for an endpoint to return a 200 code and no payload. Not common to be sure, but valid.

But it's working for you now so yay.

Hi Vitor are you sure it should not be a 204 return code if there is no payload?


No.

I'll also happily bet the guy who wrote the service wasn't sure either.

In a world where you get a soap fault with a 200 code "because it successfully sent the error" I'm sure of nothing.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » No Useful Response to HTTP POST Request
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.