Author |
Message
|
New_2_IIB9 |
Posted: Wed Dec 17, 2014 10:32 am Post subject: setting multiple parameter in HTTP Post URL |
|
|
Newbie
Joined: 17 Dec 2014 Posts: 6
|
Hi All,
I have successfully configured the flow for HTTP Post with hard-coding it on http URL using "SET OutputLocalEnvironment.Destination.HTTP.RequestURL " and it is working fine for that one , but my actual requirement is like we are getting input from copybook with 50 occurrences of ITEM_DETAILS and in that it is having ITEM_NAME and ITEM_NUM as sub-fields and then pass to http url
Code: |
SET HTTP_String = 'https://'|| HostName
|| '/services/test/1.0/query/itemId?'
||'&UserId=' || LoginId
||'&Password=' || password
||'&itemID=' || 'BOOK223434'
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = HTTP_String;
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.Method = 'POST'; |
HostName, UserID, Password is defined as UDP and the values is constant , but i have send "itemID " based on on input it will be 50 occurrences of concatenate of ITEM_NAME and ITEM_NUM . so in the above code it is now hard-coded as 'BOOK223434' but i have send multiple instances on it by comma separated , like "BOOK223434, BOOK223423, BOOK223436 " in the same http url .
Code: |
SET HTTP_String = 'https://'|| HostName
|| '/services/test/1.0/query/itemId?'
||'&UserId=' || LoginId
||'&Password=' || password
||'&itemID=' || ('BOOK223434, BOOK223423, BOOK223436') |
Multiple instances of "itemID" is working fine from SOAP UI , but can any one give me any idea how could i do the same from ESQL . i have done the cardinality of and saved in array but not able to put in logic to use.
Please any one guide me on this. TIA
 |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 17, 2014 10:41 am Post subject: Re: setting multiple parameter in HTTP Post URL |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
New_2_IIB9 wrote: |
but can any one give me any idea how could i do the same from ESQL |
Concatenate all the values in the string?
Seriously.
If you have n values in an input copybook and you want to put all n values in a string then do so, noting that references and pointers are more performant in IIB than cardinality and indexes. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
New_2_IIB9 |
Posted: Wed Dec 17, 2014 10:44 am Post subject: |
|
|
Newbie
Joined: 17 Dec 2014 Posts: 6
|
I did cardinality of Input like below,
Code: |
DECLARE I INT 1;
DECLARE J INT;
SET J = CARDINALITY(InputRoot.MRM.ITEM_DETAILS[]);
WHILE I < 50 DO
SET Environment.Variables.itemName[I] = InputRoot.MRM.ITEM_DETAILS[I].ITEM_NAME;
SET Environment.Variables.itemNum[I] = TRIM(LEADING '0' FROM InputRoot.MRM.ITEM_DETAILS[I].ITEM_NUM);
SET Environment.Variables.itemId[I] = TRIM('"' FROM TRIM(Environment.Variables.itemName[I]||Environment.Variables.itemNum[I]));
SET I = I + 1;
END WHILE; |
now in EV.itemID have 50 values but how can put it on same URL and what could be the maximum length i can use on it , one itemID length is 10 * 50 that means 500. will it able to handle it ?
Any help will be really appreciated  |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 17, 2014 11:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
New_2_IIB9 wrote: |
I did cardinality of Input like below |
Why? What does that achieve for you? I repeat my earlier comments about references performing better than indexes.
New_2_IIB9 wrote: |
now in EV.itemID have 50 values but how can put it on same URL |
The same way you put the other values on the URL. If you're looking for ESQL such as:
Code: |
SET HTTP_String = 'https://'|| HostName
|| '/services/test/1.0/query/itemId?'
||'&UserId=' || LoginId
||'&Password=' || password
||'&itemID=' || {Environment.Variables.itemId[1-50] comma delimited};
|
then it doesn't exist; you need to code it. My suspicion is that you loaded this into an array in the Environment tree because you wanted to simply concateate the array with the URL; you can't. If that's not why, please explain.
New_2_IIB9 wrote: |
and what could be the maximum length i can use on it , one itemID length is 10 * 50 that means 500. will it able to handle it ? |
What is "it" in this context? IIB or the server you're posting to?
What is the standard limit for any URL? Does it work if you a) pass 50 values in SoapUI or b) hardcode 50 values in IIB? That will provide a definiative answer. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
New_2_IIB9 |
Posted: Wed Dec 17, 2014 11:24 am Post subject: |
|
|
Newbie
Joined: 17 Dec 2014 Posts: 6
|
Thanks Vitor for reply , i will try the reference for array.
Quote: |
My suspicion is that you loaded this into an array in the Environment tree because you wanted to simply concatenate the array with the URL;; you can't. If that's not why, please explain. |
i did not understand when you said i want to concatenate the array with URL , i have saved in EV to use it further processing in the flow. i am concatenate the "itemName" and "itemNum" to "itemID" and need to sed the multiple values of "itemID" in the same URL.
for string length i asked for broker performance , i did not checked in SOAP UI but i guess it might not be a problem |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 17, 2014 11:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
New_2_IIB9 wrote: |
i did not understand when you said i want to concatenate the array with URL |
So I was wrong; happens about 3 times an hour on average.
New_2_IIB9 wrote: |
i have saved in EV to use it further processing in the flow. |
Fair point.
New_2_IIB9 wrote: |
i am concatenate the "itemName" and "itemNum" to "itemID" and need to sed the multiple values of "itemID" in the same URL. |
So concatenate them as well. I don't see your question (which probably isn't your fault).
New_2_IIB9 wrote: |
for string length i asked for broker performance , i did not checked in SOAP UI but i guess it might not be a problem |
As I said above, it's easy enough to test.
If I say, "oh it's fine, no problem", you proceed on that basis and it fails, what are you going to tell your management? "Some random stranger on the Internet who claims to know something about IIB but whose knowledge I can't actually verify said it was ok?"
People who actually know me don't trust me that much. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Dec 17, 2014 11:40 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 17, 2014 11:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
This is exactly why people don't trust my advice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
New_2_IIB9 |
Posted: Wed Dec 17, 2014 9:14 pm Post subject: |
|
|
Newbie
Joined: 17 Dec 2014 Posts: 6
|
mqjeff
Quote: |
Don't concatenate them.
Use the OutputLocalEnvironment.Destination.HTTP.QueryString
|
how the Query String gonna work here , i have send mutiple values of "itemID" in comma seperated format in same string like below,
Code: |
SET HTTP_String = 'https://'|| HostName
|| '/services/test/1.0/query/itemId?'
||'&UserId=' || LoginId
||'&Password=' || password
||'&itemID=' || ('BOOK223434, BOOK223423, BOOK223436') |
URL will be : HTTPS://127.0.0.1/services/test/1.0/itemId?&UserId=XXXX&Password=XXXXX&itemID=BOOK223434,BOOK223423,BOOK223436 and so on for 50 Occurrences.
any sample sudo code would help  |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Dec 18, 2014 5:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to populate one param element for each distinct parameter you want on the URL.
For a snigle parameter that needs to hold multiple values, you should populate the single param element with a ROW or LIST, and see if that works.
I don't know if it works.
If you read the link I posted, you would *see* sample code.
Best of luck! |
|
Back to top |
|
 |
|