This discussion is archived
9 Replies Latest reply: Dec 30, 2012 9:38 PM by Luckys RSS

How to create a Savepoint and Rollback to that savepoint usingXAI Services

OATSExplorer Newbie
Currently Being Moderated
Hi Folks,

Is it possible to create a savepoint and restore back the savepoint using XAI Inbound service?

I have a set of operations to do, so initially i want to create savepoint and then perform operations and then restore back the savepoint in order to have my application in a clean state.

This is on QA/test environment .
  • 1. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    Luckys Pro
    Currently Being Moderated
    Why would you want to execute a SavePoint from a XAI Inbound Service?
    I don't see any reason to do that, you'd perform SavePoints within Scripts, where your custom logic is encapsulated.

    Define/Develop your algorithm (Plug-In Script), encapsulate your business logic within a Service Script, invoke the Service Script using Business Service F1-SavePointDispatcher and deal with hadError switch.
  • 2. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    OATSExplorer Newbie
    Currently Being Moderated
    Hi Luckys,

    Could you kindly explain me with an example of how to invoke the service script using F1-Savepoint Dispatcher.

    I am a newbie to OUAF and config tools.

    Your help will be much appreciated and Thanks in advance.
  • 3. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    Luckys Pro
    Currently Being Moderated
    Configure the Service Script (SS) that has the business logic for which you'd like to enable the SavePoint:

    SS: RXS-StartSA - This has only one Edit Data step for demonstration purposes
    --Step 1 - Edit Data:
    terminate with error (90000, 1 %1='Report error/exception for SavePoint');
    
    --Schema
    <schema> 
        <saId mdField="SA_ID"/>  
        <acctId mdField="ACCT_ID"/> 
    </schema>
    SS: RXS-StartSAO - This SS will also have other part of the business logic. It will invoke above SS along with SavePoint handling
    -- Step 1 - Edit Data:
    move "parm/saId" to"RXS-StartSA/saId";
    move "parm/acctId" to"RXS-StartSA/acctId";
    move "RXS-StartSA" to "F1-SavePointDispatcher/scriptData";
    move 'RXS-StartSA' to "F1-SavePointDispatcher/scriptName";
    invokeBS 'F1-SavePointDispatcher' using "F1-SavePointDispatcher";
    if ("F1-SavePointDispatcher/hadError") 
      move "F1-SavePointDispatcher/messageCategory" to "parm/exception/messageCategory";
      move "F1-SavePointDispatcher/messageNumber" to "parm/exception/messageNumber";
    end-if;
    
    --Data Area
    Business Service : F1-SavePointDispatcher
    Service Script : RXS-StartSA
    
    -- Schema
    <schema> 
        <saId mdField="SA_ID"/>  
        <acctId mdField="ACCT_ID"/>  
        <exception type="group"> 
            <messageCategory/>  
            <messageNumber/> 
        </exception> 
    </schema>
    Expose RXS-StartSAO as a XAI Inbound Service, let's call it - RXS-SavePointTest; Refresh XAI Registry using XAI Command.

    Do a XAI Submission:
    --Request
    <RXS-SavePointTest>
       <saId></saId>
       <acctId>1234567890</acctId>
    </RXS-SavePointTest>
    
    --Response
    <RXS-SavePointTest>
      <saId/>
      <acctId>1234567890</acctId>
      <exception>
        <messageCategory>90000</messageCategory>
        <messageNumber>1</messageNumber>
      </exception>
    </RXS-SavePointTest>
    You can see above that there was no application error. You could take necessary programmatic actions depending on the hadError switch.
    Now if you ignore SavePoint handling and invoke the Script directly, Framework will terminate the execution and report an error like below:
    <ResponseStatus>F</ResponseStatus>
    <ResponseCode>1016</ResponseCode>
    <ResponseText>Unexpected error during request processing. (Server Message)
         Category: 90000
         Number: 1
         Call Sequence: 
         Program Name: LocalServiceSessionHelper$1
         Text: Report error/exception for SavePoint 
         Description:  
         Table: null
         Field: null</ResponseText>
    <ResponseData text="Unexpected error during request processing. (Server Message)
         Category: 90000
         Number: 1
         Call Sequence: 
         Program Name: LocalServiceSessionHelper$1
         Text: Report error/exception for SavePoint 
         Description:  
         Table: null
         Field: null"  category="11011"  numParm="1"  parm1="(Server Message)
         Category: 90000
         Number: 1
         Call Sequence: 
         Program Name: LocalServiceSessionHelper$1
         Text: Report error/exception for SavePoint 
         Description:  
         Table: null
         Field: null"  number="1016"  />
  • 4. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    935332 Newbie
    Currently Being Moderated
    Hi,

    If what you want to do is not functionnaly part of a business process and if your environment is under a VM, you can use a snapshot before doing your stuff.
    Then you will be able to come back easily and as may times as you want to your initial situation.
  • 5. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    OATSExplorer Newbie
    Currently Being Moderated
    Hi Mapa4,

    Could you explain me a little more about it.

    How to exactly follow the approach you mentioned?
  • 6. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    OATSExplorer Newbie
    Currently Being Moderated
    Hi Mapa4. Thanks for your reply. Could you please explain about it me somemore?
  • 7. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    Luckys Pro
    Currently Being Moderated
    In relation to your question, Mapa4's response is completely out of context.
    Which part of the example posted above you didn't understand?
  • 8. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    935332 Newbie
    Currently Being Moderated
    Hi OATS Explorer,
    Sorry, I didn't see your question asking me to explain the way to use a snapshot in a VM, I do not come so often on this forum.
    I did some suppositions in my answer, so if it is not related to your initial question, please ignore it.
    Otherwise because I believe, that in your QA/test environment, you do not care about production processes, I guess you would need to launch some series of scripts like the creation of Vs for example, then relaunch them after having made some configuration changes, correct ?
    If yes, do you use a virtualization system like Oracle VirtualBox or VMware ?
    If yes, the virtualization system provides the ability to save instantaneously the state of your machine before doing any operation of the operating system and any application inside.
    Once these operations are done, you can ask the virtualization system to come back to the previous state, it is the same principle of the save point/restore you was mentioning.
    As part of EMEA Presales team, our needes are similar to the one described here above for our demonstrations, we use VirtualBox and thanks to it we are very flexible even to exchange our environments accross people even by FTP.
    If you do not use such a system, maybe it is time to see with your organization if the use of virtualization system would bring other benefits.
    Again, please kindly ignore this hypothesis if it is not the right one.
    Best regards,
    Mapa4
  • 9. Re: How to create a Savepoint and Rollback to that savepoint usingXAI Services
    Luckys Pro
    Currently Being Moderated
    Okay...perhaps the question is a bit ambiguous?

    If your requirement is related to maintaining the state of the application/server then yes, what Mapa4 says is correct, use VM environment - Oracle VM/VMware/Microsoft VPC | Hyper-V/etc.; for e.g. in Microsoft VPC (or Hyper-V Snapshots) you could also enable an option of Undo Disks, to delete all the changes done at the end of the session OR commit them in the end.

    If your requirement is to handle business logic programmatically in order to enable Savepoint/Rollback then above example should suffice.

Legend

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