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 » sending multiple times request to same endpoint

Post new topic  Reply to topic Goto page 1, 2  Next
 sending multiple times request to same endpoint « View previous topic :: View next topic » 
Author Message
mr2kn
PostPosted: Thu Apr 07, 2016 7:57 am    Post subject: sending multiple times request to same endpoint Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

Hi,

Thank you for looking this message/request which im facing it, could you please help on this issue in IIB9 and if possible any code/sample I can get

I will get soap request in this format

<request>
<Item> <article>1</article><part>001</part> </item>
<Item> <article>2</article><part>002</part> </item>
</request>

I need to endpoint through http request node by one by one
1st <Item> after getting the response store it after that send
2nd <Item> after getting the response store it like continues and finally I need to get the response like this

<response>
<itemresponse> ..... </itemresponse>
<itemresponse> ..... </itemresponse>
</response>

im trying to build like this

soapinput --> compute ---> Route to label
label ---> httprequest ---> compute1 --- soapreply

in compute im taking the count how many <item> is there and doing a while loop to construct the 1st <Item> and sending the request aafter getting the response I stored it, after that it compute1 returned back to compute to select next one but im not able to create the 2nd <Item> body and also in compute1 im loosing the 1st <Itemresponse> if any error comes from 2nd <Item>
all request and response travel with JSON format

Please help on this and appreciate,
thank you
Back to top
View user's profile Send private message
timber
PostPosted: Thu Apr 07, 2016 8:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Quote:
in compute im taking the count how many <item> is there
Counted loops in ESQL are slow and cumbersome. A FOR loop is usually the best approach.
Quote:
after that it compute1 returned back to compute to select next one
er...did you read this before you submitted it? There's a Preview button.
Quote:
but im not able to create the 2nd <Item> body
Why not? We cannot help until you explain what you did, and what happened.
Back to top
View user's profile Send private message
mr2kn
PostPosted: Thu Apr 07, 2016 8:49 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

Thank you for reading my concern,

in the compute node I did like this
CREATE LASTCHILD OF Environment.Variables DOMAIN('JSON') IDENTITY(JSON.Array);
DECLARE J INTEGER;
DECLARE S INTEGER 1;

SET J = CARDINALITY(envRef.createOrUpdateVendorRequests.*[]);
WHILE I <= J DO
SET OutputLocalEnvironment.Destination.RouterList.DestinationData.labelName = 'VendorRequest';

FOR S1 AS envRef.createOrUpdateVendorRequests[] DO

CREATE LASTCHILD OF Environment.Variables DOMAIN('JSON');
SET Environment.Variables.JSON.Data.obj[S].entity = envRef.createOrUpdateVendorRequests.createOrUpdateVendorRequest.obj[S].entity;
SET Environment.Variables.I = I;
PROPAGATE DELETE NONE;
SET S = S + 1;
SET I = I + 1;
END FOR;
END WHILE;
RETURN FALSE;

1st <Item> is successfully getting response and store in the env variables from compute1 node
when returning for second time to get the 2nd <Item> then no values and getting error as missing fields from the response

hope this helps to find out my wrong/right coding 1st time im doing it like this
thank you
Back to top
View user's profile Send private message
timber
PostPosted: Thu Apr 07, 2016 11:06 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

When posting code to this forum, please use the Code button to format the code properly. Like this:
Code:
CREATE LASTCHILD OF Environment.Variables DOMAIN('JSON') IDENTITY(JSON.Array);
DECLARE J INTEGER;
DECLARE S INTEGER 1;

SET J = CARDINALITY(envRef.createOrUpdateVendorRequests.*[]);
WHILE I <= J DO
SET OutputLocalEnvironment.Destination.RouterList.DestinationData.labelName = 'VendorRequest';

FOR S1 AS envRef.createOrUpdateVendorRequests[] DO

CREATE LASTCHILD OF Environment.Variables DOMAIN('JSON');
SET Environment.Variables.JSON.Data.obj[S].entity = envRef.createOrUpdateVendorRequests.createOrUpdateVendorRequest.obj[S].entity;
SET Environment.Variables.I = I;
PROPAGATE DELETE NONE;
SET S = S + 1;
SET I = I + 1;
END FOR;
END WHILE;
RETURN FALSE;
There are several things wrong with your code.
1. It is not indented properly. That's very bad practice, and usually leads to defects.
2. Your code uses indexes and a counter for the outer loop, but a FOR statement for the inner loop. Why?
3. Your code is creating the JSON parent node once for every iteration of the inner loop. Is that what you intended?
Back to top
View user's profile Send private message
mr2kn
PostPosted: Thu Apr 07, 2016 11:41 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

im trying to index it so that next <Item> records take it, but its not and im in wrong way
yes, JSON is creating parent node once for every iteration of the inner loop like that, because every request needs to go as a new request header,body
Back to top
View user's profile Send private message
timber
PostPosted: Thu Apr 07, 2016 1:26 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Quote:
im trying to index it so that next <Item> records take it
You can do everything that you need to do using WHILE or FOR statements and CREATE LASTCHILD...

I do not understand what you meant when you said:
Quote:
when returning for second time to get the 2nd <Item> then no values and getting error as missing fields from the response
No values get automatically 'returned' after the PROPAGATE statement. What 'error' are you getting?

Remember that we cannot see your message flow. We cannot read your screen. We don't know what design decisions you have taken. You need to tell us these things.
Back to top
View user's profile Send private message
mr2kn
PostPosted: Thu Apr 07, 2016 5:20 pm    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

thank you for the patience

2nd<Item> means

<request>
1st <Item> <article>1</article><part>001</part> </item>
2nd <Item> <article>2</article><part>002</part> </item>
</request>

this is the message flow,
soapinput --> compute ---> Route to label
label ---> httprequest ---> compute1 --- soapreply

when I process 1st<Item> it will process it and success response received in compute1 node after that it will returned to compute node again and to get the 2nd <Item> structure that time there is no structure in the body and received an error missing data in the object

the request im processing through environment.variables

And not sure this is right approach or not

and I want to make like in WESB fan-out primitive where in the properties
we are mentioning like by selecting the option

-for each element xpath expression <body path>
-Check for asynchronous response after 1 message have been fired

hope tried to explained

thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 07, 2016 5:35 pm    Post subject: Reply with quote

Grand High Poobah

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

mr2kn wrote:
when I process 1st<Item> it will process it and success response received in compute1 node after that it will returned to compute node again and to get the 2nd <Item> structure that time there is no structure in the body and received an error missing data in the object


What do you mean by "success response received in compute1 node"? Something propagated does not return a response.

mr2kn wrote:
and I want to make like in WESB fan-out primitive where in the properties


Then why not use the IIB fan-out primitives (the Aggregation nodes) rather than rolling your own in this unlikely way?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 08, 2016 5:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
Something propagated does not return a response.
Except for an, umm, Exception...

_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
timber
PostPosted: Fri Apr 08, 2016 6:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

I think I understand now. This inner loop...
Code:
FOR S1 AS envRef.createOrUpdateVendorRequests[] DO

    CREATE LASTCHILD OF Environment.Variables DOMAIN('JSON');
    SET Environment.Variables.JSON.Data.obj[S].entity = envRef.createOrUpdateVendorRequests.createOrUpdateVendorRequest.obj[S].entity;
    SET Environment.Variables.I = I;
    PROPAGATE DELETE NONE;
    SET S = S + 1;
    SET I = I + 1;
END FOR;
...is executing successfully the first time. But on the second iteration of the loop ( after the PROPAGATE ) you are finding that envRef.createOrUpdateVendorRequests.createOrUpdateVendorRequest.obj[2].entity is empty.

Is that correct?
Back to top
View user's profile Send private message
mr2kn
PostPosted: Fri Apr 08, 2016 7:13 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

Thank you Timber,
yes, correct for the second iteration all are empty

Hi Vitor,
success response received in compute1 node means after httprequest node giving me the response to compute1 node, where I need to store one by one response

im not sure to use the aggregate node I can use it, because MQ's also need to introduce here to use it if im aware, and difficult for me to introduce in our application

thank you for looking into this
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 08, 2016 7:17 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Study the aggregation samples.

Read Vitor's comment about propagate not returning anything. Think about it, several times.

Think about where you can get the responses you are trying to aggregate.

Study the aggregation samples.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mr2kn
PostPosted: Fri Apr 08, 2016 9:32 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

now im able to send the request one by one from compute node to httprequest node and getting the Item response in compute1 node

and here I need to know how I can store it one by one
<response>
<itemresponse> ..... </itemresponse>
<itemresponse> ..... </itemresponse>
</response>

please provide any help
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Apr 09, 2016 3:54 am    Post subject: Reply with quote

Grand High Poobah

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

mr2kn wrote:
im not sure to use the aggregate node I can use it, because MQ's also need to introduce here to use it if im aware, and difficult for me to introduce in our application


You're not trying to introduce it into your application.

You're trying to use it within your flow because the aggregation nodes use it. It's one of the reasons your IIBv9 broker is associated with a queue manager.

As my most worthy associate advises, look at the samples. There's no reason why you can't use aggregation to make multiple web service calls and produce a single response. Indeed, it's one of the typical use cases for such a pattern.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mr2kn
PostPosted: Tue Apr 12, 2016 7:21 am    Post subject: Reply with quote

Apprentice

Joined: 26 Jan 2016
Posts: 46

Hi,
Sorry for late response,
I tried to use and working fine, but my architect told try to use without aggregate and reason behind I don't know, that is the reason im tying it without aggregate,
will update in the post if anything comes positive results
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 » sending multiple times request to same endpoint
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.