9 Replies Latest reply on May 18, 2018 3:38 AM by Devendra Dehadaraya

    How to Resume CLM Provisioning Process after Asynchronous Callout Finish?

    Yudi Maryanto

      Hi,

       

      In these document ( Nitin's CLM Blog: Demystifying Callouts and Working with callouts - Documentation for BMC Cloud Lifecycle Management 4.6 - BMC Documentation  ), it is said that HTTP Callout can be used for complex flow that involves human interaction can can take hours or days before the Callout finishes.

       

      In my case, paying for CLM service offering involving payment process that takes minutes or hours. I am able to create Callout to handle this payment process and suspend CLM provisioning process until payment completes. I do this by making the Callout returns Task object with status "QUEUED".

       

      Now, after payment process completed, I don't know, how to tell CLM to continute the suspended provisioning process?

       

      Thanks

        • 1. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
          Devendra Dehadaraya

          If you look at the following link, it explains the JSON body that you need to send back to CLM during HTTP callout

           

          https://docs.bmc.com/docs/cloudlifecyclemanagement/46/working-with-callouts-669201901.html

           

          You need to send the JSON body while invoking following API

           

          http://<Platform manager machine>:<port>/csm/task/result

          • 3. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
            Yudi Maryanto

            Devendra Dehadaraya wrote:

             

            If you look at the following link, it explains the JSON body that you need to send back to CLM during HTTP callout

             

            https://docs.bmc.com/docs/cloudlifecyclemanagement/46/working-with-callouts-669201901.html

             

            You need to send the JSON body while invoking following API

             

            http://<Platform manager machine>:<port>/csm/task/result

             

            Hi Devendra Dehadaraya

             

            Do you mean these two sample that I highlight in yellow?

            highlight.PNG

             

            If yes, then may be I need to rephrase my question. Let me make it more clear.

             

            My scenario is, when user purchasing a server on CLM, when he press "Submit Request" button (see image below), I want to pass the the payment information to our payment gateway system. The main goal is, I don't wont CLM to provision the server until the payment process completed.

            deven01.PNG

             

            To achieve this, I create a Callout for "ServiceOfferingInstance" class and operation "BULKCREATE" as seen in the image below

            callout.PNG

             

            In my case, this Callout is successfully called when user press "Submit Request". In this callout, I pass the payment information to the payment gateway. After that, the responsibility for completing payment is handed to the payment gateway. This Callout doesn't know when the payment is completed. Maybe it can complete within minutes or even days. Therefore, my Callout return Task object to CLM with status "QUEUED" like this

            task.PNG

            Upon receiving this Task, the provisioning process in CLM is suspended (see image below). At this point, the Callout is already ended.

            riau.PNG

             

            Then a few hours later, the payment gateway completes the payment process and want to notify CLM to resume the suspended provisioning above. How to do this? What ReST API should be called to resume the suspended provisioning?

             

            I hope this will make my question more clear.

             

            Thanks.

            • 5. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
              Devendra Dehadaraya

              Yes, I am talking about the JSONs which are marked in yellow.

               

              When a task goes in a suspended state/hibernated state, you can resume the task by sending back the status of the child task. In your case the child task is the HTTP callout to your purchase App.

               

              You can resume the task by invoking the following REST API POST call - http://<Platform manager machine>:<port>/csm/task/result

               

              The input to this REST API is a JSON body which is mentioned in the document.

               

              There are 2 types of status which are valid in the JSON body. Success and Failure.

               

              • If you send a SUCCESS status then after resuming the parent task, it will proceed further for the next operations.
              • If you send FAILURE status then after resuming it will actually mark the parent task as failed and the SOI request will be marked as failed. It will not continue with the next operations.

               

              In HTTP callout, there are 2 types - PRE Callout and POST callout. When you send the SUCCESS message, it should state the type.

               

               

              RESPONSE BODY :

              [{

                "cloudClass" : "com.bmc.cloud.model.beans.Task",

                "description" : "Callout Task Success",

                "guid" : "3c68d4c9-a2ac-437c-b76a-f279e5705d16",

                "isCallout" : true,

                "isError" : false,

                "isSuccess" : true,

                "isWarning" : false,

                "name" : "CALLOUT",

                "parentTaskInternalUUID" : "adaa3123-488e-4384-a60c-be50548d18f6",

                "taskState" : "COMPLETED_PRECALLOUT"

              }]

               

              RESPONSE BODY :

              [{

                "cloudClass" : "com.bmc.cloud.model.beans.Task",

                "description" : "Callout Task Success",

                "guid" : "3c68d4c9-a2ac-437c-b76a-f279e5705d16",

                "isCallout" : true,

                "isError" : false,

                "isSuccess" : true,

                "isWarning" : false,

                "name" : "CALLOUT",

                "parentTaskInternalUUID" : "adaa3123-488e-4384-a60c-be50548d18f6",

                "taskState" : "COMPLETED_POSTCALLOUT"

              }]

               

              RESPONSE BODY :

              [{

                "cloudClass" : "com.bmc.cloud.model.beans.Task",

                "description" : "Callout Task Failure",

                "guid" : "3c68d4c9-a2ac-437c-b76a-f279e5705d16",

                "isCallout" : true,

                "isError" : true,

                "isSuccess" : false,

                "isWarning" : false,

                "name" : "CALLOUT",

                "parentTaskInternalUUID" : "adaa3123-488e-4384-a60c-be50548d18f6",

                "taskState" : "CALLOUT_FAILED"

              }]

               

              • 6. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
                Yudi Maryanto

                Thanks Johannes Richter and Devendra Dehadaraya

                 

                Before I try your recommendations, please confirm if what I was doing so far is current.

                 

                From this document, I got an idea that a Callout can suspend CLM provisioning process (see the quotation below).

                exceprt.PNG

                But, so far, I cannot find any sample JSON request to do this on CLM API documentation (please give the the link if there is any). Therefore, I try to invoke arbitrary CLM API asynchronously to get "Task" response from CLM. Then I use this "Task" response as a template for my JSON to be returned to the Callout.

                 

                Here is the json sample that I returned to the Callout

                guid.PNG

                So, my questions are:

                1. Could you verify that this JSON has correct structure and values?
                2. The values of  "guid", "taskInternalUUID", and "transactionID"  fields are all generated by my payment application. So these three field values actually has no correlation whatsoever with any values I received from the Callout. Is this correct that I generated these values in my system?

                 

                I ask this because yesterday when I want to try your recommendations, an error occured. So I want to make sure that everything I did so far is correct.

                 

                Thanks

                • 7. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
                  Devendra Dehadaraya

                  As per my knowledge. When the HTTP server receives the CLM request, the server need not return any JSON immediately.

                   

                  If there is no status returned, CLM will automatically put the parent task in hibernation/suspended. After your payment/purchase is completed, based on the event you need to trigger some automation which will invoke the CLM REST API mentioned above to update the task result (SUCCESS or FAILURE). CLM will automatically resume the parent task.

                   

                  Having said this, the CLM request which you receive as an input to your HTTP server, it will have a parent task UUID. You will need to use that parent task while invoking the CLM REST API to tell CLM that this is the parent task for which you are sending the result.

                   

                  "parentTaskInternalUUID" : "81acf520-7177-4332-99e1-9a93d8c83153",

                   

                  Hope this helps.

                   

                  Thanks,

                  Devendra

                  • 8. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
                    Yudi Maryanto

                    Hi Devendra Dehadaraya

                     

                    Devendra Dehadaraya wrote:

                     

                    As per my knowledge. When the HTTP server receives the CLM request, the server need not return any JSON immediately.

                     

                    If there is no status returned, CLM will automatically put the parent task in hibernation/suspended. After your payment/purchase is completed, based on the event you need to trigger some automation which will invoke the CLM REST API mentioned above to update the task result (SUCCESS or FAILURE). CLM will automatically resume the parent task.

                     

                    Having said this, the CLM request which you receive as an input to your HTTP server, it will have a parent task UUID. You will need to use that parent task while invoking the CLM REST API to tell CLM that this is the parent task for which you are sending the result.

                     

                    "parentTaskInternalUUID" : "81acf520-7177-4332-99e1-9a93d8c83153",

                     

                    Hope this helps.

                     

                    Thanks,

                    Devendra

                    My web application receive data from Callout like this

                    callout.PNG

                     

                    as you can see, no "Parent-Task-UUID" in it. It only contain "Task-UUID". So I use "Task-UUID" in my JSON that I send back to CLM to resume CLM Provisioning process. Here is my JSON (Note: the "guid" value is generated by payment system. No correlation with any values from CLM)

                     

                    YYY.PNG

                    But I got error when sending the JSON above. Here is the error response I got from CLM

                    provider.PNG

                    What is missing/wrong from my JSON that leads to the error returned by CLM?

                    • 9. Re: How to Resume CLM Provisioning Process after Asynchronous Callout Finish?
                      Devendra Dehadaraya

                      can you try with "task/result" instead of "Task/result" ?