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 » Setting additional header in HTTP Request Node

Post new topic  Reply to topic
 Setting additional header in HTTP Request Node « View previous topic :: View next topic » 
Author Message
sankritya
PostPosted: Tue Mar 10, 2015 6:01 am    Post subject: Setting additional header in HTTP Request Node Reply with quote

Centurion

Joined: 14 Feb 2008
Posts: 100

Hi All,

I am trying to do a REST call from WMB using HTTP Request node . I have a requirement to set additional header message

Quote:

abcHeader = [ adata = abc, bdata= abc]
.

If I try to set it up in HTTPRequestHeader , it returns HTTP 400 error message. Same message tried with SOAP UI Rest UI project is getting successful. SOAP UI has a placeholder for adding any additional Header in the message. SO I am adding a new header with name abcHeader and value [ adata = abc, bdata= abc] and it is working fine.
So my question is how to set any additional information in the Get request call.
I have set the URI and Request method which is 'GET' correctly.
Broker version = 7.0.0.1[/quote]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 10, 2015 8:15 am    Post subject: Reply with quote

Grand High Poobah

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

Time for a little experimentation:
Set up a simple flow that has an HTTPInput Node and a trace node.
Write the trace with $Root.
Send the request from SOAPUI to your flow.
Inspect the headers and body, and create your request message accordingly...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Tue Mar 10, 2015 10:39 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

The trace node pattern should be
Code:

${Root}

(sorry to be pedantic but it matters here)

Broker 7.0.0.1 is also IMHO pretty buggy. Please apply the latest fixpack (7.0.0.8 ). But please be aware that this version goes out of support in 6 months time.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 10, 2015 11:21 am    Post subject: Reply with quote

Grand High Poobah

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

smdavies99 wrote:
Broker 7.0.0.1 is also IMHO pretty buggy.


It's so buggy it's unsupported (like the rest of v7 after September)

v7.0.0.3 is the lowest supported version.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sankritya
PostPosted: Wed Mar 11, 2015 5:44 am    Post subject: Reply with quote

Centurion

Joined: 14 Feb 2008
Posts: 100

I tried by exposing a WMB service with same endpoint. It passes successfully in HTTPInputHeader. I could set debug mode so did not set the trace node.

The external application I am calling from WMB is Data Power and it fails in the front side handler of data power with error message

Quote:
source-http (ServiceGatewayFSH_80): Request processing failed: Get Or Head with Content-Length,
the malformed header is (Content-Length: 81), from URL:


I tried by adding the HTTP Header node also before the HTTPRequest node without any change in result.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Mar 11, 2015 6:50 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

When using a trace node to output a structure please don't use the debugger at the same time.

Enable usertrace
run your test
disable the usertrace
read and format the trace log to a file

Then you can see everything in a Root tree (And Environment and/or LocalEnvironment) relating to the message in one place.

This file can be used as a reference when developing your code.

Using trace nodes before important nodes is a really good way of getting to understand the message (and other structures).
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Hoshi
PostPosted: Tue Feb 02, 2016 12:51 am    Post subject: Reply with quote

Novice

Joined: 02 Feb 2016
Posts: 10

It's been almost a year now but still if someone is struggling with the same issue:

Quote:
source-http (ServiceGatewayFSH_80): Request processing failed: Get Or Head with Content-Length,
the malformed header is (Content-Length: 81), from URL:


The problem is that despite the request type is set to "GET" on the HTTPRequest node in the message flow, broker will still incapsulate any message contents available before HTTPRequest node into the HTTP request and will calculate a non-zero Content-Length header. DataPower appliance on the other end though is unable to process such requests as it considers sending content inside GET and HEAD requests a security risk.

Quote:
Get Or Head with Content-Length
Explanation:
The request was of a type that should not contain a body (get or head) but a content-length header greater than zero was present. This is often an attempt to subvert the firewall and pass a message through undeteceted.


You solve this by explicitly removing message contents by inserting a Compute node right before HTTP Request like so:
CREATE COMPUTE MODULE HTTPRequest_clearContents
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
RETURN TRUE;
END;
END MODULE;
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Feb 02, 2016 2:50 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Hoshi wrote:

You solve this by explicitly removing message contents by inserting a Compute node right before HTTP Request like so:
Code:
CREATE COMPUTE MODULE HTTPRequest_clearContents
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      RETURN TRUE;
   END;
END MODULE;


What happens to the message tree (InputRoot...) that you are using for your message in the request after it has passed through this compute node?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Hoshi
PostPosted: Tue Feb 02, 2016 9:48 am    Post subject: Reply with quote

Novice

Joined: 02 Feb 2016
Posts: 10

That depends on specific requirements for the flow.

If you need the original message enriched with the data you get from HTTP Request, then you can, for example, store it in the Environment tree beforehand and retrieve it later.
If original message just acts like a trigger and you don't really need the data from it, then it just gets discarded.

Point is if you are making an HTTP GET request you shouldn't really send any payload to the backend within that request. Still, even if you do, most servers won't throw an error but DataPower Appliance in particular will throw an HTTP 400 Bad Request error. That's why you have to make sure the message tree is empty right before HTTPRequest node.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Feb 02, 2016 11:55 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Hoshi wrote:


Point is if you are making an HTTP GET request you shouldn't really send any payload to the backend within that request.


I tend to disagree.

What about params in the http string? That is the payload as far as I'm concerned.

The other thing about your compute node code is that it will also remove any locally overrided properties of the HTTPRequest node. These are In the LocalEnvironment

Do you really want that?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Hoshi
PostPosted: Tue Feb 02, 2016 12:18 pm    Post subject: Reply with quote

Novice

Joined: 02 Feb 2016
Posts: 10

Oh, that was my bad. Of course I meant one should set compute mode to "Message" on the Compute node, so that LocalEnvironment is not lost, but I did not mention it.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Feb 02, 2016 10:57 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Hoshi wrote:
Oh, that was my bad. Of course I meant one should set compute mode to "Message" on the Compute node, so that LocalEnvironment is not lost, but I did not mention it.


That won't do it. You need a different option to get the LocalEnvironment copied.

i.e. Message and LocalEnvironment OR All.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Hoshi
PostPosted: Wed Feb 03, 2016 1:59 am    Post subject: Reply with quote

Novice

Joined: 02 Feb 2016
Posts: 10

Actually it's quite the contrary. If you set the mode to "Message" then LocalEnvironment and ExceptionList will be unmodifiable and will be the same as in the input message. If you set the mode to "All", "LocalEnvironment", or "LocalEnvironment and Message" then you need to manually populate or copy the LocalEnvironment tree.

Here's an excerpt from broker documentation:

Quote:
Setting the mode
The Compute Mode property controls which components are used by default in the output message. Select the property to specify whether the Message, LocalEnvironment (previously specified as DestinationList), and Exception List components that are either generated in the node or contained in the incoming message are used.

...

Those components that are not included in your selection are passed on unchanged; even if you modify those components, the updates are local to this node.

Conversely, those components that are included in the selection are not passed on and the updates that are made in the node persist.
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 » Setting additional header in HTTP Request Node
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.