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 » JSON error response from HTTPInput timeout

Post new topic  Reply to topic
 JSON error response from HTTPInput timeout « View previous topic :: View next topic » 
Author Message
whiting
PostPosted: Wed Jun 01, 2016 12:49 pm    Post subject: JSON error response from HTTPInput timeout Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

I'm working with IIB 9.0.0.4

I am creating a REST to MQ mediation flow. In the event of an error or timeout, I want to return a JSON formatted response to the calling application.

If I get an error indication from the back-end MQ application there is no problem creating an JSON error reply and sending that through an MQReply node. However, if there is no response from the MQ application, then the response returned to the client is an HTML or SOAP error.

Is there a way to configure the HTTPInput node so that it will return a JSON string?
I've tried catching the timeoput at the HTTP Timeout terminal as well as the Fail or Catch terminals and regardeless of what I put in the OutputBody, the client gets HTML or SOAP.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Wed Jun 01, 2016 1:41 pm    Post subject: Re: JSON error response from HTTPInput timeout Reply with quote

Grand High Poobah

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

whiting wrote:
I'm working with IIB 9.0.0.4

I am creating a REST to MQ mediation flow. In the event of an error or timeout, I want to return a JSON formatted response to the calling application.

If I get an error indication from the back-end MQ application there is no problem creating an JSON error reply and sending that through an MQReply node. However, if there is no response from the MQ application, then the response returned to the client is an HTML or SOAP error.

Is there a way to configure the HTTPInput node so that it will return a JSON string?
I've tried catching the timeoput at the HTTP Timeout terminal as well as the Fail or Catch terminals and regardeless of what I put in the OutputBody, the client gets HTML or SOAP.

You may have to retrieve the HTTP response as a BLOB and evaluate the BLOB.
If it is XML return an XML to JSON transformation.
If if is JSON you know what to do...
On time out catch the time out and create an appropriate JSON to reply with... etc...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
whiting
PostPosted: Wed Jun 01, 2016 3:12 pm    Post subject: Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

If I get a reply message from the MQ backend, then everything works fine. I create a JSON response out of the MQ response and return the JSON via an HTTP Reply node.

If I catch the timeout and create a message body as JSON, then the message flow still returns HTML to the http client.

I can setup my own timeout and return a "timeout" error via HTTP Reply, but I was trying to use the HTTP Input node timeout functionality rather than working around it.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Jun 02, 2016 4:13 am    Post subject: Reply with quote

Grand High Poobah

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

If you want to return anything else than the standard, you need to map the timeout terminal, create the response message and return it through the HTTP Reply node... If that does not give you the expected response, open a PMR
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
whiting
PostPosted: Thu Jun 02, 2016 5:44 am    Post subject: Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

That is exactly what I did.
I thought that should have worked, the infocenter didn't help.
OK, I guess it's time for a PMR.

Thanks!
Back to top
View user's profile Send private message Send e-mail
whiting
PostPosted: Thu Jun 02, 2016 7:42 am    Post subject: Reply with quote

Acolyte

Joined: 26 Mar 2002
Posts: 64
Location: Greenville, SC

I found the solution:

Connect to the HTTP Timeout terminal.
Create the message body in JSON format, but also Add an HTTPReplyHeader with the ContentType set to 'application/json'

When I did that, I got the Json formatted error reply at the client.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Jun 02, 2016 8:29 am    Post subject: Reply with quote

Grand High Poobah

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

whiting wrote:
I found the solution:

Connect to the HTTP Timeout terminal.
Create the message body in JSON format, but also Add an HTTPReplyHeader with the ContentType set to 'application/json'

When I did that, I got the Json formatted error reply at the client.

it all has to do with the ReplyHeader and the ContentType...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JSON error response from HTTPInput timeout
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.