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 » Query on HTTP Input & HTTP Reply

Post new topic  Reply to topic Goto page 1, 2  Next
 Query on HTTP Input & HTTP Reply « View previous topic :: View next topic » 
Author Message
sivaguru
PostPosted: Wed Jun 18, 2008 11:10 pm    Post subject: Query on HTTP Input & HTTP Reply Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi ,

Iam a beginner in Msg Broker . So i have some queries which are basic , so kindly bear with me.

I have a requirement of accepting a HTTP Input and propagating to (MQ/HTTP) based on the input payload info and has to reply back for both success and failure case.

So i defined the flow as

FLOWS
--------

HTTPInput --> Compute Node ---> ( 3 terminals connects below details )
--- > MQ Output ( MQ Ouput Type )
--- > MQ Output ( HTTP Ouput Type )
--- > Err SubFow
( failing Validate the Input file )

I have one MQ - Output node connected to the HTTPInput's Failure terminal

I also have one error subflow connected to the HTTPInput's Catch terminal, Subflow nodes details are

Catch --> Compute( error xml generator ) --> MQ_Output

Below are our queries
-------------------------

Can we place HTTP file in the MQ Output node ( HTTP Output case )

We dont know how to handle the reply both in the success and failure case
i.e ( from error hanlding how to link to http reply node & in the normal successful o/p ( MQ/HTTP ).

We also have query on fetching httpinput headers properties

Is it a must the http reply should have soap info. or just xml file itself enough.

Please guide us to meet our requirement as it is of greater necessity. If possible pls provide us some samples with code. Expecting reply and guidance at the earliest.


Back to top
View user's profile Send private message
vsr
PostPosted: Thu Jun 19, 2008 11:24 am    Post subject: Re: Query on HTTP Input & HTTP Reply Reply with quote

Centurion

Joined: 04 Apr 2006
Posts: 104

sivaguru wrote:

Can we place HTTP file in the MQ Output node ( HTTP Output case )


Yes, you can do that in the compute node placed before MQOutput node.

sivaguru wrote:

We dont know how to handle the reply both in the success and failure case
i.e ( from error hanlding how to link to http reply node & in the normal successful o/p ( MQ/HTTP ).


Well, connect the terminals to a trace node and find what gets populated for each condition.

sivaguru wrote:

Is it a must the http reply should have soap info. or just xml file itself enough.


Please go through the web service samples in the Samples Gallary which can be found in the toolkit 'Help' -->'Samples Gallary'. Search in the 'Technology Samples'

And don't forget to create a MQMD before writing to a queue as mqmd is not created by default when using httpinput node.
Back to top
View user's profile Send private message
sivaguru
PostPosted: Thu Jun 19, 2008 9:29 pm    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi ,



Thanks for ur reply for our queries and it is of greater value to us . As you mentioned , we referred the webservice samples and we have a few more queries.

I have pasted a part of the esql code which has to propagate to MQ output from HTTP input file and send a acknowledgement by replying back in HTTP format .

Here what I try to do is,

Query 1
----------

expected Desc of the code
-------------------------------

Checking the Input payload and finding the value of the destination node and if it is HTTP, Iam just copying the entire headers & message as the o/p is also of same type HTTP.

If the destination node value of the Input payload is MQ, Iam

1. Removing the HTTP Header and replacing it with MQMD
2. Copying the body part alone ( SET OutputRoot.XML = InputRoot.XML; )
3. Setting the Correlation Id from the Input Message Id
4. Propogate to MQ-output terminal ( Out1 ) with out deleting

To Reply back the Iam doing the following things consecutively.

1. Adding HTTP Header
2. Assigning the HTTP RequestIdentifier to reply back
3. Propogating to the HTTP Reply node. ( Out4 )

code
-------

CALL CopyMessageHeaders();
IF InputRoot.XML.input.protocol.destination = 'HTTP' THEN
CALL CopyEntireMessage();
SET OutputRoot.XML.DestDescription ='Successfully transmitted to HTTP Terminal';
PROPAGATE TO TERMINAL 'Out4';
RETURN TRUE;
END IF;


IF InputRoot.XML.input.protocol.destination = 'MQ' THEN

SET OutputRoot.HTTPInputHeader = null;
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.XML = InputRoot.XML;
SET OutputRoot.MQMD.CorrelId = Environment.Variables.MesgIdentifier;
SET OutputRoot.XML.DestDescription ='Successfully transmitted to MQMD Terminal';
PROPAGATE TO TERMINAL 'Out1' DELETE NONE;

SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageFormat = 'XML';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
SET OutputRoot.XML.ReplyDescription ='Successfully Replied';
PROPAGATE TO TERMINAL 'Out4';
RETURN TRUE;

END IF;


Query 2
----------

In case of mulitple use of propagate do we need to call the
CopyMessageHeaders() method for each propagate.

We have a doubt whether will the above code will do the expected functionality, since we are having some issue with setting up Default Broker, we were not able to test the flow and we have parallely working for that.


Please help us to proceed with as it would be of great help.

Thanks in advance.

Back to top
View user's profile Send private message
AkankshA
PostPosted: Thu Jun 19, 2008 10:31 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

The output trees that are finalized are cleared, regardless of which ones are propagated.

so i feel... you also need to copy the properties tree while sending to MQ...

also populate the MQMD with other fields like destination queue, QM etc...
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
sivaguru
PostPosted: Thu Jun 19, 2008 11:00 pm    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi,

Thanks for your reply. So as per my understanding from your comments

1. I have to call the CopyMessageHeaders() method
each time when I try to propagate. ( HTTP & MQ-Output case )

2. Setting the InputRoot's properties separately in the MQ-Output segment of code in addition

3. I have set the destination queue, QM and other details in the design
time properties of the MQ-Output node.Is that ok and will it work

I have a basic doubt, whether the code within the segment of MQ (i.e if destination of the input payload value = MQ ), will propogate the o/p to MQ-Output node and also acknowledge in the HTTP format thru HTTP-reply node.


Below is the modified code for your reference.



IF InputRoot.XML.input.protocol.destination = 'MQ' THEN

SET OutputRoot.HTTPInputHeader = null;
SET OutputRoot.Properties = InputRoot.Properties;
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.XML = InputRoot.XML;
SET OutputRoot.MQMD.CorrelId = Environment.Variables.MesgIdentifier;
SET OutputRoot.XML.DestDescription ='Successfully transmitted to MQMD Terminal';
PROPAGATE TO TERMINAL 'Out1' DELETE NONE;

SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageFormat = 'XML';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
SET OutputRoot.XML.ReplyDescription ='Successfully Replied';
PROPAGATE TO TERMINAL 'Out4';
RETURN TRUE;

END IF;


Please reply me as it will be of greater importance to me.
Back to top
View user's profile Send private message
AkankshA
PostPosted: Fri Jun 20, 2008 12:18 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

sivaguru wrote:


1. I have to call the CopyMessageHeaders() method
each time when I try to propagate. ( HTTP & MQ-Output case )


yes...

sivaguru wrote:


3. I have set the destination queue, QM and other details in the design
time properties of the MQ-Output node.Is that ok and will it work


yess....

sivaguru wrote:


I have a basic doubt, whether the code within the segment of MQ (i.e if destination of the input payload value = MQ ), will propogate the o/p to MQ-Output node and also acknowledge in the HTTP format thru HTTP-reply node.

NO.. you need to use HTTPRequest Node in that case....
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
AkankshA
PostPosted: Fri Jun 20, 2008 12:22 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

hey pls dont use XML domain,,, its deprecated by IBM.... use XMLNS or XMLNSC either..
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
sivaguru
PostPosted: Fri Jun 20, 2008 12:31 am    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi,

Thanks for the reply. We have read from the Help of the Msg broker toolkit --- > Built in nodes -- > HTTPRequest Node that

You can use this node in a message flow that does not contain an HTTPInput or HTTPReply node.

So can you please explain in detail how to send our acknowledgement after the propagate to MQ-Output node.

Ok as you said we will replace xml by xmlns.

Waiting for your reply.


[/quote]
Back to top
View user's profile Send private message
AkankshA
PostPosted: Fri Jun 20, 2008 12:36 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

if the i/p message has come from MQ protocol... then you ll not have the request identifier and hence HTTPReply ll not be of use...



hold on... did u say that you would be having only HTTP as i/p protocol for your flow... in that case yes.. it shall.. reply logic is what u hv to feed in..

i had work on assignments wherein we were sending reply to hhtp as well as mq for failure msgs received through http...
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
sivaguru
PostPosted: Fri Jun 20, 2008 12:43 am    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi,

In my case I have copied the request identifier in the environment variable and used that while reply. Please see my code below and confirm me whether the approach will work or not.

please see the below code after PROPAGATE TO TERMINAL 'Out1' DELETE NONE; which is related to reply part and propagated to HTTP Reply node and those code before that is propagated to MQ Output node - will this work ????

Can we wire the failure node of HTTP input node to MQ Output ? pls explain.


code
------
IF InputRoot.XML.input.protocol.destination = 'MQ' THEN

SET OutputRoot.HTTPInputHeader = null;
SET OutputRoot.Properties = InputRoot.Properties;
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.XML = InputRoot.XML;
SET OutputRoot.MQMD.CorrelId = Environment.Variables.MesgIdentifier;
SET OutputRoot.XML.DestDescription ='Successfully transmitted to MQMD Terminal';
PROPAGATE TO TERMINAL 'Out1' DELETE NONE;

SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageFormat = 'XML';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
SET OutputRoot.XML.ReplyDescription ='Successfully Replied';
PROPAGATE TO TERMINAL 'Out4';
RETURN TRUE;

END IF;
Back to top
View user's profile Send private message
Bill.Matthews
PostPosted: Fri Jun 20, 2008 5:37 am    Post subject: Reply with quote

Master

Joined: 23 Sep 2003
Posts: 232
Location: IBM (Retired)

I hope that you understand that when you do the following
Quote:

Code:

PROPAGATE TO TERMINAL 'Out4';
RETURN TRUE;

that an empty message will be sent to what ever node is connected to the out terminal. Im your example, you should follow the last Propagate with a Return False.

Also - the correct spelling of any of the out terminals is all lowercase - not with a capital letter.
Code:

PROPAGATE TO TERMINAL 'out4';
RETURN False;

_________________
Bill Matthews
Back to top
View user's profile Send private message
sivaguru
PostPosted: Fri Jun 20, 2008 7:09 am    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi Sir ( Bill.Matthews ),

We are beginner to Msg broker so we are not sure on our code, so please guide us. Our scenario is that based on the Input payload we have to propagate to any one of the output terminal ( MQ / HTTP )

As per your say, the Return True will implicitly call a propagate and to avoid that we have to replace it by Return False. Is that my understanding is correct.

One more query sir, Does the return true / false will have any impact on the further message flow.

Below are our code for your reference. Please go your valuable feedback

CALL CopyMessageHeaders();

IF InputRoot.XMLNS.input.protocol.destination = 'HTTP' THEN
CALL CopyEntireMessage();
SET OutputRoot.XMLNS.DestDescription ='Successfully transmitted to HTTP Terminal';
PROPAGATE TO TERMINAL 'out4';
RETURN TRUE;
END IF;

--CALL CopyMessageHeaders();
IF InputRoot.XMLNS.input.protocol.destination = 'MQ' THEN

SET OutputRoot.HTTPInputHeader = null;
SET OutputRoot.Properties = InputRoot.Properties;
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.XMLNS = InputRoot.XMLNS;
SET OutputRoot.MQMD.CorrelId = Environment.Variables.MesgIdentifier;
SET OutputRoot.XMLNS.DestDescription ='Successfully transmitted to MQMD Terminal';
PROPAGATE TO TERMINAL 'out1' DELETE NONE;

SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
SET OutputRoot.XMLNS.ReplyDescription ='Successfully Replied';
PROPAGATE TO TERMINAL 'out4';
RETURN TRUE;

END IF;

Back to top
View user's profile Send private message
Bill.Matthews
PostPosted: Fri Jun 20, 2008 11:35 am    Post subject: Reply with quote

Master

Joined: 23 Sep 2003
Posts: 232
Location: IBM (Retired)

Before I give you my comments - let me make one point - I retired from IBM 6 months ago, so all of my statements are made from memory. Therefore, should any of the "knowledgeable" guys question my answers - javascript:emoticon('')

In your initial question, you described the message flow as follows:

Quote:

FLOWS
--------

HTTPInput --> Compute Node ---> ( 3 terminals connects below details )
--- > MQ Output ( MQ Ouput Type )
--- > MQ Output ( HTTP Ouput Type )
--- > Err SubFow
( failing Validate the Input file )

I have one MQ - Output node connected to the HTTPInput's Failure terminal

I also have one error subflow connected to the HTTPInput's Catch terminal, Subflow nodes details are

Catch --> Compute( error xml generator ) --> MQ_Output


1. First suggestion - until you have verified the operation of your message flow with a valid message, I strongly suggest that you do NOT have anything attached to any Failure terminal. That way, if the flow does fail, you will get better information in about the error in the "error log" - location does depend on where the Message Broker is running.

2. Next, I would do the same for the Catch terminal - don't wire it initially. Once the flow is working with a good message, then start on the error handling via the Catch node...

3. It is always a good idea when asking a question here to also include the Operating System, Version and modification levels for both the Message Broker as well as the Message Broker Toolkit. Sometimes, the answer to your question could be different - because of increased capabilities. Right now, I cannot tell which version & release you are using ... other than it is V6 - since the additional options on the Propagate were not provided on V5 (based on my memory).


4. In a Compute node a RETURN or RETURN TRUE will cause the current output message tree to be sent out the Out terminal regardless of its contents. Therefore, the combination of a Propagate 'out4'; Return True; is going to have an empty message going down the out terminal. A Return False; does not send an empty message. Its a matter of semenatics. The Return False; ends the Compute node with the "option" set that no message is needed.

5. Concerning your question:
Quote:
Does the return true / false will have any impact on the further message flow.


If there is a single "path" leading up to that Compute node - then the Message Flow is finished. This would be your case.

6. I am a bit confused about your Message Flow - in the initial question you only showed an HTTPInput node - but yet, in the compute node you are also checking for an MQ based message. Do you also have an MQInput node?

7. However, in the 2nd havf of the Compute node, you are building a message to go to an MQOutput node as well as an HTTPReply node. If the flow is started by a MQInput node, then a HTTPReply node can not be used. There is no HTTP session to receive the reply.

Good luck.
_________________
Bill Matthews
Back to top
View user's profile Send private message
vsr
PostPosted: Fri Jun 20, 2008 11:43 am    Post subject: Reply with quote

Centurion

Joined: 04 Apr 2006
Posts: 104

sivaguru wrote:

I have a requirement of accepting a HTTP Input and propagating to (MQ/HTTP) based on the input payload info and has to reply back for both success and failure case.


I didn't really understand what do you mean by propagating to http and then reply back (arent' they same!?). Or does it mean you need to call another web service ?

Based on your post I assume that you have a requirement like this:

1. You get a HTTP request ( your flow acts as a web service ).
2. You may want to create a MQ message based on a input parameter.
3. If successful, then sends HTTP response back.

If my assumption is correct, I would have done this way:

Create a MQ message ( Assuming XML message ):

SET OutputRoot.HTTPInputHeader = null;
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = '';
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID;
SET OutputRoot.MQMD.Version = MQMD_CURRENT_VERSION;
SET OutputRoot.MQMD.MsgType = MQMT_DATAGRAM;
SET OutputRoot.MQMD.Format = MQFMT_STRING;
PROPAGATE TO TERMINAL 'out1' DELETE NONE;

Create a HTTPReply:

SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
----------------------------------------------------------------------------
Build HTTP Response payload here
----------------------------------------------------------------------------
PROPAGATE TO TERMINAL 'out2' ;
RETURN FALSE; ------ Assuming out2 terminal is connected to HTTPReply node
Back to top
View user's profile Send private message
sivaguru
PostPosted: Sun Jun 22, 2008 8:43 pm    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2008
Posts: 40

Hi,



Thanks for your valuable comments. We have modified the code as per your advice and pasted below for your kind reference.

Your assumption on our requirement is correct. We will receive

1. HTTP input file and based on the input payload value we may have to
propagate to MQ - Output / HTTP Output.

2. The Input payload's Destination node ( input.protocol.destination ) will
provide that info, which we are checking that in the Compute node.

3. Inorder to copy the entire message We have used SET
OutputRoot.XMLNS = InputRoot.XMLNS; will that do our expected
funtionality? Pls comment.

4. We have wired the Initial HTTP Input node failure terminal to MQ-Output is that a correct way to handle. We have to reply the Client Application ( VB Web Service Enabled ) both for the Success and failure case. Pls comment on this.


Please advise us,

IF InputRoot.XMLNS.input.protocol.destination = 'MQ' THEN

-- Creating the MQ Message and Propagating to the MQ-Output node
SET OutputRoot.HTTPInputHeader = null;
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = '';
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
SET OutputRoot.MQMD.StrucId = MQMD_STRUC_ID;
SET OutputRoot.MQMD.Version = MQMD_CURRENT_VERSION;
SET OutputRoot.MQMD.MsgType = MQMT_DATAGRAM;
SET OutputRoot.MQMD.Format = MQFMT_STRING;
SET OutputRoot.XMLNS = InputRoot.XMLNS;
SET OutputRoot.MQMD.CorrelId = Environment.Variables.MesgIdentifier;
SET OutputRoot.XMLNS.DestDescription ='Successfully transmitted to MQMD Terminal';
PROPAGATE TO TERMINAL 'out1' DELETE NONE;

-- Creating the HTTP Message and Propagating it to the HTTPreply node
SET OutputRoot.MQMD = null;
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageDomain = 'XMLNS';
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier =
CAST(Environment.Variables.HTTPContextText AS BLOB);
SET OutputRoot.XMLNS.ReplyDescription ='Successfully Replied';
PROPAGATE TO TERMINAL 'out4';
RETURN FALSE;

END IF;

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Query on HTTP Input & HTTP Reply
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.