This discussion is archived
8 Replies Latest reply: Jan 23, 2013 5:08 AM by Abhinav RSS

Very Urgent How to do For each  for proxyService in oepe eclipse ?

546919 Newbie
Currently Being Moderated
I have made a proxyservice in oepe eclipsde then put a stage then inside that stage I have a For each.
when select the For each inside the stage, then itis properties
1. For each variables
2. xpath
3. In Variable
4.Index Variable
5. Count Variable
How do I do this ? any examples ?


Edited by: user543916 on Jan 19, 2013 4:32 AM

Edited by: user543916 on Jan 20, 2013 3:27 AM
  • 1. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    Abhinav Journeyer
    Currently Being Moderated
    Hi ,
    1. For each variables
    This will be the new variable ( be it forVar ) that will be used to hold xml parsed value for each iteration.
    2. xpath
    This is the existing xpath location(under $request) where the iteration is to be performed.
    3. In Variable
    This is the variable ( request) which holds the request payload.
    4.Index Variable
    The variable (currIndex) will hold the current iteration count of For loop( Used in dynamic assignment of payload depending upon the index value)
    5. Count Variable
    This is the existing variable (Count) to be pre assigned which hold the count of payload elements under variable request.
    How do I do this ? any examples ?
    Let assume the payload received in vairable ( request ) is as below and you want to iterate over company elements

    <CompanyCollection>
    <company>
    <name>name1</name>
    </company>
    <company>
    <name>name2</name>
    </company>
    </CompanyCollection>

    For Each forVar in */CompanyCollection/company* of *$request* indexed by currIndex with total count in *$Count*

    Hope it helps !

    Regards,
    Abhinav Gupta

    Edited by: Abhinav on Jan 20, 2013 10:21 PM
  • 2. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    546919 Newbie
    Currently Being Moderated
    Tks very much.
    if I understand you correctly in in the sate with my For each, then select property fane
    for example I should do the follwoing
    1. For each variables = forvar
    2. xpath=/CompanyCollection/company
    3. In Variable=$request
    4.Index Variable=$currIndex
    5. Count Variable= $Count Variable

    then the osb will fill thsese variables with the necesary data ?
    tks
  • 3. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    Abhinav Journeyer
    Currently Being Moderated
    Hi,

    Yes, But you have to pre populate Count variable before using for each action.
    Please, if it helped you mark the answer as helped or answered.
  • 4. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    546919 Newbie
    Currently Being Moderated
    Tks very very much for your help.
    One last question
    how do I prepopulate the Count variable ? please a small example.
    For example :
    For each
    This For each call java callout from the service bus.
    how do I prepopulate Count Variable ?
    how to I pass 4.Index Variable value to the caller ?
    using For each properties visualy that mean when I select the property in the stage when For each is ?
    end for each

    Edited by: user543916 on Jan 21, 2013 9:11 AM
  • 5. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    Abhinav Journeyer
    Currently Being Moderated
    Hi,

    You can use an assign action to count the company nodes in company collection
    fn:count($request/company) and assign it to user context variable Count

    or
    you can explicitly define that above expression inside for each action for total count of fn:count($request/company)
    how to I pass 4.Index Variable value to the caller ?
    You must use [xs:int($currIndex)] as xquery predicates expression while passing value to caller.

    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
  • 6. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    546919 Newbie
    Currently Being Moderated
    Once again tks.
    I have used many hours today without succes to make it work.
    in my request-body/payload I will have someething liek this 2 request <CompanyCollection> in the Payload
    <request>
    <CompanyCollection>
    <company>
    <name>name1</name>
    </company>
    <company>
    <name>name2</name>
    </company>
    </CompanyCollection>

    <CompanyCollection>
    <company>
    <name>name1</name>
    </company>
    <company>
    <name>name2</name>
    </company>
    </CompanyCollection>
    </request>

    For example :
    if I have to loop true my request to select an elelemt a a gving index in the For each ? not index values but the data itself ?
    then pass this to java callout method getData(String reg) where reg is equal = <CompanyCollection>
    <company> ?
    For each
    This For each call java callout from the service bus.
    how do I prepopulate Count Variable ?
    how to I pass 4.Index Variable value to the caller ?
    using For each properties visualy that mean when I select the property in the stage when For each is ?
    end for each
    -----------------------------------------------------------------------------------------------------------------------
    You can use an assign action to count the company nodes in company collection
    fn:count($request/company) and assign it to user context variable Count
    I have use asigne on this
    or
    you can explicitly define that above expression inside for each action for total count of fn:count($request/company)
    how to I pass 4.Index Variable value to the caller ?
    You must use [xs:int($currIndex)] as xquery predicates expression while passing value to caller.
    but [xs:int($currIndex)] I have never found out how to use
    tks
  • 7. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    546919 Newbie
    Currently Being Moderated
    Abhinav where are you ? please help
  • 8. Re: Very Urgent How to do For each  for proxyService in oepe eclipse ?
    Abhinav Journeyer
    Currently Being Moderated
    user543916,

    I think , you should first identify what you are intended to do with For Each Action and why ? Please elaborate.

    Sorry to say but it's impossible to interpret what you want to achieve. But I can give one more try as per you previous replies.

    I have made a post regarding the same.
    http://abhinavgupta3.blogspot.in/2013/01/for-each-loop-in-osb.html

    Please go through it ~!

    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points