This discussion is archived
7 Replies Latest reply: Jan 27, 2011 9:11 PM by 765320 RSS

Caching XML Variable in OSB

765320 Newbie
Currently Being Moderated
Hi All,
I have following Requirement

1] Scenario 1: My PS is initializing the variable by reading the XML File. When PS gets invoked first time; the Assign Activity will get executed by OSB. Since Configuration data is static; next time PS gets called; I do not want .xq/assign activity to parse the configuration again. Is there any way that OSB will catch the variable in Proxy and accessible in rest of the Stages/Activities/Message Flows.

2] Scenario 2 : PS1 -->PS2-->PS3 in OSB. I initialize the variable in PS1 by reading the XML Configuration file. I need the same variable in PS2 and PS3 as well without reading the XML file again and Again.

Can I pass the variable from one proxy to another?? Can I catch the variable using first scenario and pass the same for subsequent calls?


Sushil
  • 1. Re: Caching XML Variable in OSB
    Anuj Dwivedi Guru
    Currently Being Moderated
    OSB is stateless product so it does not store/maintain values anywhere. You have to initialize variables everytime the proxy is called but for global variable kind of support you may use Java callout with OSB/Result caching feature of OSB -

    section "34.7.5 Improving Performance by Caching Business Service Results" at http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15867/configuringandusingservices.htm#CHDDCGEE

    For passing variables from one proxy to another, explicitly assign them into user defined transport headers/message headers/message body or again use caching feature.

    Regards,
    Anuj
  • 2. Re: Caching XML Variable in OSB
    765320 Newbie
    Currently Being Moderated
    Hi Anuj,
    Above scenario is applicable when I am using the service Callout/Rote to Business Service.

    For variable that are initialize locally inside the Proxy; is there any configuration by which we can cach the same? If not only way to model the same is Put the variable in Transport Header.

    Since the Transport header will get purged(out os scope) once the PS finishesh its processing; The variable need to be initialize again.

    Is there any pointer on passing this XML as String for Java callout and catch the same . After subsequent call use Java callout to get the same from cache.??

    Regards
    Sushil
  • 3. Re: Caching XML Variable in OSB
    Anuj Dwivedi Guru
    Currently Being Moderated
    Hi Sushil,

    can you elaborate on initialization part? Is it a static data which you are storing in XML currently or you also want to cache certain data of received request (at the first time)?

    If it is static data only (for e.g. a DVM) which has nothing to do with any received request, then I would prefer storing them in database and use result caching to retrieve the values in each and every proxy until and unless it hurts me from performance point of view.

    Regards,
    Anuj
  • 4. Re: Caching XML Variable in OSB
    765320 Newbie
    Currently Being Moderated
    Lets take a simple case

    1] Modeled the Configuration properties as XML(based on schema offcourse)
    <FWKConfig "Strip the namespace part">

    <!-- common config - Synchronous command(s) message map -->
    <Config type="common" key="Key1">value1</Config>
    <Config type="common" key="key2">value2</Config>
    <Config type="common" key="key3">value3</Config>

    </FWKConfig>
    2] As I mentioned I will read these file using fn:doc expression and Assign the same to variable let say "FWKConfigVar"

    3] This assignment will get executed every time whenever there is PS call from client inside OSB.

    4] IS OSB smart enough to cache the "FWKConfigVar" so that Assign activity will not get executed every time and save the CPU cycles?

    5] Let say Ps1 Calling PS2 and PS2 calling PS3. All the Proxy services are using the same variable data "FWKConfigVar". Is there any way that this variable will get initialize first time in PS1 and pass/available across the Message flow of PS2 and PS3??

    6] According to Business Service result caching; I can design the Proxy Services which will be called via Business Service to get the configuration data;
    Let say Business Service will accept the Input type="common" key="Key1" and Send me the output value1(or whole document ). These result can be cached using proper token specified in BS configuration page.

    The problem here is "Service Callout activity(to get Configuration data). Is it a best practice to call BS instead of taking help of small XQuery( use fn:doc() and get the required value using the XQuery)?? Assuming I required configuration data in couple of activities in message flows?

    Regards
    Sushil
  • 5. Re: Caching XML Variable in OSB
    AbhishekJ Pro
    Currently Being Moderated
    Not sure how the XML Document works as a resource, but I know that XQueries are cached in OSB. So instead of saving it as an XML resource save it as an XQuery, which always returns the same XML. If you invoke this XQuery with the same value of input (it can be any hardcoded value) it will come from a cache. To me this seems a better solution than using a combination of a BS and PS. Cant say if this is better than using an XML doc and calling it using fn:doc though.
    May be you can run performance tests with all three scenarios and see which one is better performing.
  • 6. Re: Caching XML Variable in OSB
    Anuj Dwivedi Guru
    Currently Being Moderated
    4] IS OSB smart enough to cache the "FWKConfigVar" so that Assign activity will not get executed every time and save the CPU cycles?
    No, OSB being a stateless product, does not cache/store any process/it's state anywhere.
    5] Let say Ps1 Calling PS2 and PS2 calling PS3. All the Proxy services are using the same variable data "FWKConfigVar". Is there any way that this variable will get initialize first time in PS1 and pass/available across the Message flow of PS2 and PS3??
    As I mentioned earlier as well, you may pass variables as user defined headers/part of message body from PS1 to PS2 and so on.
    The problem here is "Service Callout activity(to get Configuration data). Is it a best practice to call BS instead of taking help of small XQuery( use fn:doc() and get the required value using the XQuery)?? Assuming I required configuration data in couple of activities in message flows?
    Now this is something which requires a performance test because both may be a preferable option depending upon the design, complexity, size of config data file/number of records etc.

    Generally for small range of data I would prefer XQuery but for large data I will always go for different approach. I remember that for one of our client, we stored the key-value pairs in DB and used java callout in OSB 10g to load them once and use across. Now when with 11g, caching feature is available, this is the preferable approach but again it depends upon your design and choice.

    Do few tests and you should have a clear picture.

    You may refer -

    http://forums.oracle.com/forums/thread.jspa?threadID=1131939

    Regards,
    Anuj
  • 7. Re: Caching XML Variable in OSB
    765320 Newbie
    Currently Being Moderated
    Abhishek/Anuj,
    If XQuery is catched; it will be a good lead on performance. To make it more dynamic; if I put just one line in XMl Query

    $configvar := fn:doc("configfile.xml"); will it get cached?
    I mean can we achieve XQuery caching suing fn:doc() instead of putting whole XML as .xq.

    This way I can accommodate the requirement mentioned in the

    Best Practices for Accessing the Configuration data Modelled as XML File in

    Edited by: Sushil Deshpande on Jan 27, 2011 9:11 PM

Legend

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