Author |
Message
|
latitude |
Posted: Mon Aug 17, 2009 7:53 am Post subject: Setting Up CORREL_ID after Web Service call |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Hi Guys,
I need to restore CORREL_ID to a message reply of a web service call. Im using the following
SET OutputRoot.MQMD.Report = MQRO_EXPIRATION_WITH_FULL_DATA + MQRO_PASS_CORREL_ID;
on a COMPUTE node but it doesnt seams be working. Not sure if im doing it right.
MqInput ->SOAP Web Service ->Compute ->MQOutput
Appreciate your guidance on this.
thanks |
|
Back to top |
|
 |
Luke |
Posted: Mon Aug 17, 2009 8:38 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Hi,
I think MQRO_PASS_CORREL_ID is right if you want the MQOutput node to pass the CORREL_ID from the one in the MQMD in the message tree (this would typically be the MQMD copied from the input message).
Have you ensured that the input MQMD has been preserved whilst you've been doing your http/soap call though? I seem to remember having problems myself when headers disappeared after a HTTPRequest node. Suggest you run a trace and see?
Cheers |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 17, 2009 10:05 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I do not think that any Report Options will affect the contents of the Correlation ID field on the MQMD when the MQMD parser serializes the tree that is passed to the MQOutput node. |
|
Back to top |
|
 |
Luke |
Posted: Mon Aug 17, 2009 10:20 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
I think it will ... IF the destination mode is Reply To Queue in the MQOutput node. Infocenter says:
Quote: |
Following values in MQMD are set conditionally, based on values in the MQOutput node and the Root.MQMD folder:
IF MsgTree.MQMD.MsgType = MQMT_REQUEST THEN
MQMD.MsgType = MQMT_REPLY;
IF Nodes Message Context is Default, PassAll or PassIdentity THEN
MQMD.UserIdentifer = MsgTree.MQMD.UserIdentifier;
IF MsgTree.MQMD.Report contains MQRO_PASS_CORREL_ID THEN
MQMD.CorrelId = MsgTree.MQMD.CorrelId;
ELSE
MQMD.CorrelId = MsgTree.MQMD.MsgId; |
Although perhaps latitude isn't using a Destination Mode of Reply To Queue? Quite possible, as I'd probably go for MQReply node for this. |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 18, 2009 2:15 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Thanks for all the replys.
MQMD has disappeared after Web Service Call and I thought it is the normal behaviour of WMB 6.1 but please let me know if im wrong.
I receive messages with MQMD settings such as;
CorrelId
ReplyToQ
ReplyToQMger
and I need to preserve these and send them back to sender with the web service reply message. What I need to use is MQReply but I was using MQOutput for testing purpose.
Only concern of the above solution is, there is a chance of loosing MQMD due to a web Service call delay.
I was also thinking about the following as an alternative; Second Option
When a message enters the message flow read the MQMD settings and preserve them as environment variables and restore them after web Service reply.
What do you guys think?
On arrival: SET Environment.Variables.CorrelId = InputRoot.MQMD.CorrelId;
On Departure : SET OutputRoot.MQMD.CorrelId = Environment.Variables.CorrelId; |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 18, 2009 3:03 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
I've used Environment in the past to do this, and it worked OK for me.
Think I actually copied the whole MQMD to Environment, then restored it later. Need to be careful if you do this though - create an area in Environment to copy it to with the appropriate domain, or the formatting of your header will be trashed.
Quote: |
Only concern of the above solution is, there is a chance of loosing MQMD due to a web Service call delay. |
Not sure what the solution you are suggesting is, can you clarify please?
Thanks |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 18, 2009 3:31 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Thanks for the reply Luke.
If i use
SET OutputRoot.MQMD.Report = MQRO_EXPIRATION_WITH_FULL_DATA + MQRO_PASS_CORREL_ID;
to restore MQMD there is a chance of loosing or not being able to restore the MQMD dont you think?
What did you mean by coping the Domain? |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 18, 2009 3:50 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Setting a value in MQMD.Report will not restore anything. An MQMD may be generated with some default values because you've created a field in the MQMD domain, but it won't restore any previous values for you. As I said in an earlier post, the Report options may determine what gets set in the CorrelId, but you still have to make sure the MQMD is populated correctly when you get to MQOutput node or MQReply ...
Check out the CREATE statement and DOMAIN clause within it. Environment is a simple tree structure, and if you copied the whole of the MQMD to it without telling it how to parse it correctly, then unexpected results will occur. |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 18, 2009 4:33 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Im knew to this and developing my very first flow . Have you got a sample that i could use?
many thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Aug 18, 2009 5:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Skip the report options, it's really going the long way around to do it.
In compute before SOAP node,
Code: |
Set Environment.Variables.CorrelID = InputRoot.MQMD.CorrelID |
In compute node after SOAP node
Code: |
Set OutputRoot.MQMD.CorrelID = Environment.Variables.CorrelID |
Note, I probably spelled CorrelID wrong. |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 18, 2009 5:43 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Thanks Jeff,
I have already tried this. i could see CorrelID on the Environment Variable but when Set OutputRoot.MQMD.CorrelID = Environment.Variables.CorrelID is executed on the compute node after SOAP, CorrelID becomes empty.
I also tried Set Environment.MQMD = InputRoot.MQMD
and OutputRoot.MQMD = Environment.MQMD
evrything get populated through the environment variables except CorrelID. I could see it on the Environment Variable ie. 231232hj12h3kjh12323j12k
but once assigned ie 000000000000000000000000000000000000000
thanks |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 18, 2009 5:47 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Quote: |
I receive messages with MQMD settings such as;
CorrelId
ReplyToQ
ReplyToQMger
and I need to preserve these and send them back to sender with the web service reply message. What I need to use is MQReply but I was using MQOutput for testing purpose. |
So you'll also need to code similar lines for ReplyToQ and QMger.
If you're going to use MQReply node as you say, then I still think you need to make sure the report options are set correctly. I could be wrong though ...
Can I suggest if you are going to use MQReply, then use it for your testing too. You can specify a local queue in the MQMD ReplyToQ of your input test message (using RFHUtil or similar) and the result should be sent there. |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 18, 2009 5:51 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
|
Back to top |
|
 |
jbanoop |
Posted: Tue Aug 18, 2009 7:42 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
shouldnt you be setting the msg id of the incoming message as the corel id of the outgoing one ?
Can you share the snippets of code where you save to the environment and then try to assign it back to the MQMD ?
If the incoming corel id field is empty, then copying the incoming corelid field to the outgoing corel id field would not help.
In the request response scenarios I have worked on, we have had to copy the incoming msg id as the corel id for the response. |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 18, 2009 8:01 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Before SOAP Request
SET Environment.Variables.MQMD = InputRoot.MQMD;
After SOAP Response
CREATE NEXTSIBLING of OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.MQMD = Environment.Variables.MQMD;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.ReplyIdentifier = OutputRoot.MQMD.MsdId;
SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
now i get the CorrelId setted properly on the output message however following fileds apear as false tho they are true on the Environment.Variables.MQMD
MQMD.Transactional : false
Properties.Transactional : false
I could hardcode the value but doesn't sound very good does it?
and also
Encoding is set to a different value than the original |
|
Back to top |
|
 |
|