Author |
Message
|
simon.starkie |
Posted: Thu Oct 11, 2007 10:48 am Post subject: How to override the URL in an HTTPRequest node in ESQL. |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
I have a nagging question about how to override the URL parameter of an HTTPRequest node in ESQL.
I have a requirement to call a particular MS web service from a WMB6 message flow.
My message flow consists of an ESQL Compute node followed by an HTTPRequest node.
This message flow will eventually be deployed to several, different environments (i.e. DEV, QA, PROD).
So each environment may require a different URL for the web service call.
Using the Content Assist (CTRL-SPACE) I ended up with the following ESQL:
-- Set Host for GetLogicalHome HTTPRequest
SET OutputRoot.HTTPRequestHeader.Host
= 'http://simon.snorkel.blort/rencemm/httplistener.ashx';
But this didn't override the URL in the subsequent HTTPRequest node.
Eventually, I learned from another developer that the following syntax should be used:
-- Set Host for GetLogicalHome HTTPRequest
SET OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL"
= 'http://simon.snorkel.blort/rencemm/httplistener.ashx';
This worked, but left me wondering why the ESQL syntax is so obscure.
Apparently, one simply has to be in the know about self-defining term "X-Original-HTTP-URL" to get the URL override to work.
Or is there a better way of coding the ESQL to achieve the desired result?
FWIW, in an effort to try and self-document this item, I coded the URL in the HTTPRequest node as:
http://See_preceeding_Compute_Node_OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL"
Thanks. |
|
Back to top |
|
 |
TonyD |
Posted: Thu Oct 11, 2007 11:40 am Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Quote: |
The HTTPRequest node determines the URL for the Web service to which it sends a request. Set one of the following three options; the node checks these in the order shown (that is, the first always overrides the second, the second overrides the third):
1. X-Original-HTTP-URL in the HTTPRequest header in the input message
2. LocalEnvironment.Destination.HTTP.RequestURL in the input message
3. The Web Service URL property
The first two options provide dynamic methods to set a URL for each input message as it passes through the message flow. To use either of these options, include a Compute node in the message flow, before the HTTPRequest node, to create and initialize the required value.
|
|
|
Back to top |
|
 |
simon.starkie |
Posted: Thu Oct 11, 2007 11:55 am Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
Thanks TonyD. We found that documentation.
But the nagging question remains.
Should the Content Assist (CTRL-SPACE) suggest the same "X-Original-HTTP-URL" choice?
As is is, Content Assist (CTRL-SPACE) only provides the following suggestions:
(Type-Expression)
Content-Type
Host
SoapAction
So how would someone know to use ."X-Original-HTTP-URL" if relying on Content Assist? |
|
Back to top |
|
 |
TonyD |
Posted: Thu Oct 11, 2007 12:27 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I was responding to:
Quote: |
Or is there a better way of coding the ESQL to achieve the desired result? |
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Oct 11, 2007 12:57 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, the LocalEnvironment.Destination is going to be more ... intuitive for the averavge message broker developer. So I suspect that it wasn't a priority to make it easy for said average developer to use the LESS intuitive approach. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Thu Oct 11, 2007 2:10 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi.
The content assist looks correct to me, as you were asking for possible choices under
Code: |
SET OutputRoot.HTTPRequestHeader.Host |
and valid choices here include "Host" as this is an HTTP header. To set the dynamic URL you need to referencing LocalEnvironment.Destination.HTTP.RequestURL.
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
simon.starkie |
Posted: Mon Oct 15, 2007 8:43 am Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
mgk wrote: |
Hi.
The content assist looks correct to me, as you were asking for possible choices under
Code: |
SET OutputRoot.HTTPRequestHeader.Host |
and valid choices here include "Host" as this is an HTTP header. To set the dynamic URL you need to referencing LocalEnvironment.Destination.HTTP.RequestURL.
Cheers, |
Yes, the content assist certainly does look correct.
But the only trouble is, it doesn't achieve the desired result
I tried your suggestion for setting the dynamic URL as follows:
SET InputLocalEnvironment.Destination.HTTP.RequestURL
= 'http://simon.snorkel.blort/rencemm/httplistener.ashx';
I'm very happy to report that this technique works
In fact, this seems to be a much better solution than the rather obscure, self-defining literal:
SET OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL"
= 'http://simon.snorkel.blort/rencemm/httplistener.ashx'; I was using previously. Which was really the point of my opening this thready.
So thanks again and CHEERS!  |
|
Back to top |
|
 |
|