Service Virtualization

Expand all | Collapse all

Virtualizing JSON message using RR pairs

  • 1.  Virtualizing JSON message using RR pairs

    Posted 10-01-2015 03:38 AM

    Hello,

     

    I am new to CA LISA virtualization. I am trying to virtualize JSON message as part of my first assignment.

     

    I have request and response pair of JSON message. While creating VSM, I have added listening port in the second step after mentioning HTTP as Transport protocal.

     

    Do I need to mention the Target host and port number by selecting Gateway?............If Yes, Do I need live\Actual URL to complete this step?

     

    Is there anyway to build VSM with out having live URL?



  • 2.  Re: Virtualizing JSON message using RR pairs

    Posted 10-01-2015 04:29 AM

    Aldin,

     

    It is necessary to provide something in those to fields but it doesn't need to be live host and port.

     

    Target host and Target port values goes in "Virtual HTTPS Live Invocation" step within VSM, just in case if you want to invoke LIVE service instead of VS.

     

    If you do not have any appetite to invoke "Virtual HTTPS Live Invocation" step to access LIVE service, then you can mention "localhost" in "Target host" and same value as of listening port to "Target port" fields respectively or any other port no.

     

     

    Salman



  • 3.  Re: Virtualizing JSON message using RR pairs

    Posted 10-01-2015 05:41 AM

    Hi Salman,

     

    Thanks for your suggestion. I have done all the steps mentioned. After creating VSM, I see the operation Name as "<Unknown-op>" in transaction Tab. Any idea why its happening like this?



  • 4.  Re: Virtualizing JSON message using RR pairs

    Posted 10-01-2015 07:16 AM

    Aldin,

     

    Well that suggests your request JSON file doesn't contains header information which generally determines the operation name resource location and content types, content length, host etc...

     

    For Example:

    GET /jsonExample/jsonServices/retrieve HTTP/1.1

    Accept: application/json

    Content-Type: application/json

    User-Agent: Java/1.7.0_45

    Host: localhost:8080

    Connection: keep-alive

    Content-Length: 59

     

    {json body}

     

    For sake of your understanding try to paste any one line from below on top of your req json file and create VSI from Req/Res pairs again and see the difference.

    GET /jsonExample/jsonServices/retrieve HTTP/1.1

    or

    GET / HTTP/1.1

     

     

    Salman



  • 5.  Re: Virtualizing JSON message using RR pairs

    Posted 06-21-2018 06:22 AM

    Hi Salman,

    I am trying to create a VS using Json RR pair but facing nullpointerException error:

    i have added all required headers in request side as suggested in your post, still getting above error
    any suggestion.

    If i remove headers like GET, PUT POST, i am getting unknown_operation



  • 6.  Re: Virtualizing JSON message using RR pairs

    Posted 06-21-2018 10:33 AM

    Hi Sabir,

     

    Can you paste the file name and content of the file?



  • 7.  Re: Virtualizing JSON message using RR pairs

    Posted 06-25-2018 03:53 AM

    HI,

    PFB contents and file name of RR pair

     

    PaymentRequest-req:

    GET /json/paymentServices/retrieve HTTP/1.1

     

    {
       "make_intl_payment_request" : {
          "user_details" : {
             "session_id" : "lf0fbgAAAVqI3M2VuzOAj8egE/Pce1Fe+G/L/cI0",
             "message_id" : "be3ede10-bce2-4384-a8c3-f419c7f75a81",
             "user_id" : "116313922510"
          },
          "company_id" : "11120600",
          "intl_payment_details" : {
             "payment_type" : "SEPA",
             "action" : "VALIDATE",
             "payment_id" : null,
             "debit_details" : {
                "sort_code" : "230580",
                "account_id" : "21633216",
                "account_name" : "CORP01",
                "currency" : "GBP",
                "value_date" : "20170327",
                "amount" : "95"
             },
             "international_beneficiary_details" : {
                "details" : {
                   "name" : "Ben1",
                   "sort_code" : "MYMBGB2LXXX",
                   "account_id" : "GB66MYMB23058021833738",
                   "beneficiary_id" : "BEN1703140724"
                },
                "bank_code" : "MYMBGB2LXXX",
                "address_1" : null,
                "address_2" : null,
                "address_3" : null,
                "inter_bank_code" : null
             },
             "reference" : [
                "3097130091"
             ],
             "credit_details" : {
                "currency" : "EUR"
             },
             "charges" : {
                "metro_bank_charges" : "Paid by customer",
                "other_bank_charges" : "Paid by beneficiary"
             }
          }
       }
    }

     

     

    PaymentSuccess-rsp:
    {
       "make_intl_payment_response" : {
          "user_details" : "116313922510",
          "session_id" : "lf0fbgAAAVqI3M2VuzOAj8egE/Pce1Fe+G/L/cI0",
          "message_id" : "be3ede10-bce2-4384-a8c3-f419c7f75a81",
          "user_id" : "116313922510"
       },
       "responses" : [
          {
             "ref_id" : "FT19235LW5B1",
             "response_type" : "INFO",
             "response_code" : "VALIDATE_MAKE_SEPA_PAYMENT_SUCCESS",
             "response_description" : "International payment request validated successfully"
          },
          {
             "response_type" : "WARNING",
             "response_code" : "SEPA_MB_FX_HOLD_CUT_OFF_TIME_EXCEEDED_OVERRIDE",
             "response_description" : "MB.FX.HOLD}&{CUTOFF Time Exceeded/Future dated transaction. Transaction will be processed on value date*FXHL"
          }
       ],
       "intl_payment_details" : {
          "payment_id" : "FT19235LW5B1",
          "debit_details" : {
             "account_id" : "21633216",
             "currency" : "GBP",
             "amount" : "95",
             "value_date" : "20170327"
          },
          "reference" : [
             "[3097130091]"
          ],
          "charges" : {
             "charge_account" : "21633216",
             "total_charge_amount" : "GBP15.00",
             "other_bank_charges" : "Paid by beneficiary",
             "metro_bank_charges" : "Paid by customer"
          },
          "credit_details" : {
             "account_id" : "20431849",
             "amount" : "EUR116.62",
             "currency" : "EUR",
             "value_date" : "20170327"
          },
          "international_beneficiary_details" : {
             "details" : {
                "beneficiary_id" : "BEN1703140724",
                "account_id" : "GB66MYMB23058021833738",
                "name" : "Ben1"
             },
             "bank_code" : "MYMBGB2LXXX"
          },
          "fx_rate" : "1.0899"
       }
    }



  • 8.  Re: Virtualizing JSON message using RR pairs

    Posted 06-25-2018 09:56 AM

    Hi Sabir,

     

    I created the request file with below contents and response file with your content and able to create VS. Please try it.

     

    GET /json/paymentServices/retrieve HTTP/1.1
    Accept: application/json
    Content-Type: application/json

     

    {
    "make_intl_payment_request" : {
    "user_details" : {
    "session_id" : "lf0fbgAAAVqI3M2VuzOAj8egE/Pce1Fe+G/L/cI0",
    "message_id" : "be3ede10-bce2-4384-a8c3-f419c7f75a81",
    "user_id" : "116313922510"
    },
    "company_id" : "11120600",
    "intl_payment_details" : {
    "payment_type" : "SEPA",
    "action" : "VALIDATE",
    "payment_id" : null,
    "debit_details" : {
    "sort_code" : "230580",
    "account_id" : "21633216",
    "account_name" : "CORP01",
    "currency" : "GBP",
    "value_date" : "20170327",
    "amount" : "95"
    },
    "international_beneficiary_details" : {
    "details" : {
    "name" : "Ben1",
    "sort_code" : "MYMBGB2LXXX",
    "account_id" : "GB66MYMB23058021833738",
    "beneficiary_id" : "BEN1703140724"
    },
    "bank_code" : "MYMBGB2LXXX",
    "address_1" : null,
    "address_2" : null,
    "address_3" : null,
    "inter_bank_code" : null
    },
    "reference" : [
    "3097130091"
    ],
    "credit_details" : {
    "currency" : "EUR"
    },
    "charges" : {
    "metro_bank_charges" : "Paid by customer",
    "other_bank_charges" : "Paid by beneficiary"
    }
    }
    }
    }



  • 9.  Re: Virtualizing JSON message using RR pairs

    Posted 06-25-2018 10:48 AM

    Thank you Prema,

    It works for me
    i am wondering how it works, because i too add required headers earlier and then kept GET resource base path itself.



  • 10.  Re: Virtualizing JSON message using RR pairs

    Posted 06-25-2018 10:50 AM

    Might be my file got corrupt.
    Thanks for your quick response