Author |
Message
|
Pallavi31 |
Posted: Wed Jan 23, 2013 12:34 am Post subject: How to call webservice in loop? |
|
|
Newbie
Joined: 23 Jan 2013 Posts: 3
|
Hi
How to call service for each loop of while in Java compute node or esql.
I have a requirment that I have to call service for each element in message. So how does control come back after calling a service |
|
Back to top |
|
 |
exerk |
Posted: Wed Jan 23, 2013 12:45 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
This sounds like Broker to me, so moving it to that forum... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
Pallavi31 |
Posted: Wed Jan 23, 2013 12:54 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2013 Posts: 3
|
Can you please link me there |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 23, 2013 1:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
Pallavi31 |
Posted: Wed Jan 23, 2013 1:35 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2013 Posts: 3
|
Throgh SOAP request we can call the service once
If we want to call service multiple times throgh loop in previous ESQL/JCN, Then how to do that |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 23, 2013 1:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
pallavi.bhasme wrote: |
Throgh SOAP request we can call the service once
If we want to call service multiple times throgh loop in previous ESQL/JCN, Then how to do that |
using propagate. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jan 23, 2013 5:47 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
pallavi.bhasme wrote: |
Throgh SOAP request we can call the service once
If we want to call service multiple times throgh loop in previous ESQL/JCN, Then how to do that |
Do you have a coach or mentor on your site? Have you read the InfoCentre? Have you attended the required training?
Your question is a basic question answered in all these other forums. This forum is generally used by people who get stuck on a particular problem after having attended the training or read thoroughly the InfoCentre. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
arun4ruu |
Posted: Mon Jan 28, 2013 12:29 pm Post subject: |
|
|
Newbie
Joined: 13 Jan 2012 Posts: 8
|
Hello Pallavi,
Here is the code:
Before the soap request Node write this part of code in compute node:
Code: |
SET Environment.RequestRecords = CARDINALITY (InputRoot.SOAP.Body.Records[]);
WHILE ( Environment.RequestRecords > 0 ) DO
SET OutPutRoot.SOAP.Body.Address = SET InputRoot.SOAP.Body.Address[Environment.RequestRecords];
PROPAGATE;
END WHILE;
RETURN FALSE; |
After the soap request node, write this part of code in compute node:
Code: |
IF (Environment.RequestRecords > 0) THEN
SET Environment.address[Environment.ResponseRecords] = InputRoot.XMLNSC.address;
SET Environment.RequestRecords = Environment.RequestRecords - 1;
SET Environment.ResponseRecords = Environment.ResponseRecords +1;
END IF;
IF (Environment.RequestRecords = 0) THEN
DECLARE NEXT INTEGER 1;
SET Environment.ResponseRecords = Environment.ResponseRecords - 1;
WHILE ( Environment.ResponseRecords > 0 ) DO
SET OutputRoot.XMLNSC.address = Environment.address[Environment.ResponseRecords];
SET Environment.ResponseRecords = Environment.ResponseRecords - 1;
SET NEXT = NEXT + 1;
END WHILE;
PROPAGATE;
END IF;
RETURN FALSE;
END; |
Hope this will help you to call service multiple times through loop.
Good Luck |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Jan 28, 2013 12:33 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
arun4ruu wrote: |
Hello Pallavi,
Here is the code:
Before the soap request Node write this part of code in compute node:
Code: |
SET Environment.RequestRecords = CARDINALITY (InputRoot.SOAP.Body.Records[]);
WHILE ( Environment.RequestRecords > 0 ) DO
SET OutPutRoot.SOAP.Body.Address = SET InputRoot.SOAP.Body.Address[Environment.RequestRecords];
PROPAGATE;
END WHILE;
RETURN FALSE; |
After the soap request node, write this part of code in compute node:
Code: |
IF (Environment.RequestRecords > 0) THEN
SET Environment.address[Environment.ResponseRecords] = InputRoot.XMLNSC.address;
SET Environment.RequestRecords = Environment.RequestRecords - 1;
SET Environment.ResponseRecords = Environment.ResponseRecords +1;
END IF;
IF (Environment.RequestRecords = 0) THEN
DECLARE NEXT INTEGER 1;
SET Environment.ResponseRecords = Environment.ResponseRecords - 1;
WHILE ( Environment.ResponseRecords > 0 ) DO
SET OutputRoot.XMLNSC.address = Environment.address[Environment.ResponseRecords];
SET Environment.ResponseRecords = Environment.ResponseRecords - 1;
SET NEXT = NEXT + 1;
END WHILE;
PROPAGATE;
END IF;
RETURN FALSE;
END; |
Hope this will help you to call service multiple times through loop.
Good Luck |
This is hardly the solution as the message tree is not reset before every call and therefore has extraneous elements in it left over from previous iterations. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 28, 2013 3:05 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
This is hardly the solution as the message tree is not reset before every call and therefore has extraneous elements in it left over from previous iterations. |
It's also not using the right way to access the next child of the response set. You should always code using references rather than [ indexVariable ] syntax.
always.
No, really. Always. |
|
Back to top |
|
 |
|