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 » How to override the URL in an HTTPRequest node in ESQL.

Post new topic  Reply to topic
 How to override the URL in an HTTPRequest node in ESQL. « View previous topic :: View next topic » 
Author Message
simon.starkie
PostPosted: Thu Oct 11, 2007 10:48 am    Post subject: How to override the URL in an HTTPRequest node in ESQL. Reply with quote

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
View user's profile Send private message
TonyD
PostPosted: Thu Oct 11, 2007 11:40 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
simon.starkie
PostPosted: Thu Oct 11, 2007 11:55 am    Post subject: Reply with quote

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
View user's profile Send private message
TonyD
PostPosted: Thu Oct 11, 2007 12:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Oct 11, 2007 12:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
mgk
PostPosted: Thu Oct 11, 2007 2:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
simon.starkie
PostPosted: Mon Oct 15, 2007 8:43 am    Post subject: Reply with quote

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
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 » How to override the URL in an HTTPRequest node in ESQL.
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.