Forum Discussion

Apoorva6's avatar
Apoorva6
Frequent Contributor
8 years ago

Is there a way to read Rest service body from external source ?

Hi all,

 

Is there a way to read rest service body from an external source, preferably Excel ? My sample rest body (POST) is as below. I want to provide data from Excel sheet and I am using open source SoapUI. I am also not sure how below type looks in CSV/XLS format.

 

{
"CreateInvoiceNodeRequest": {
"transactionDetails": {
"transactionId": "mx_123334",
"statusCode": "0",
"sourceSystem": "EUAM",
"startRow": "1",
"endRow": "400"
},
"userDetails": {
"userId": "cw264f",
"accountToNumber": "",
"customerName": "ATOS",
"activity": "Is it getting update in audit table, BGWKhalid"
},
"createInvoiceDetails": {
"parentHierarchyPointId": "529283",
"nodeStartDate": "20161203 00:00:00",
"nodeLabel": "khalid1",
"billPeriod": "",
"billingType": "1",
"invoiceCurrency": "USD",
"ratingCurrency": "USD",
"language": "ENG",
"billingAddressDetails": {
"addressType": "Reporting address",
"addressName": "me",
"attentionName": "",
"addressLine1": "your street",
"addressLine2": "",
"addressLine3": "",
"addressLine4": "",
"streetAddress": "",
"city": "Plano",
"state": "TX",
"province": "",
"zipCode": "75093",
"zipCodeSuffix": "",
"foreignPostalCode": "",
"countryCode": "US",
"countryName": "US",
"countyName": "",
"geoCode": "",
"siteId": ""
},
"frpdetails": {
"contactLastName": "Khalid",
"contactFirstName": "Pmode",
"jobTitle": "",
"contactTitle": "",
"contactEmailId": "pmode@nat.com",
"contactInfoTypeCode": "T",
"contactNPA": "734",
"contactNXX": "674",
"contactLineNumber": "1111",
"contactExtentionNumber": "",
"contactForeignTelephoneNumber": "",
"contactForeignTelephoneCountryCode": "",
"contactForeignTelephoneCityCode": "",
"contactForeignFAXExtention": "",
"contactForeignFAXCountryCode": "",
"contactForeignFAXTelephoneCode": "",
"contactForeignFAXTelephoneNumber": "",
"contactForeignFAXTelephoneExtention": "",
"contactAddressDetails": {
"addressType": "Contact address",
"addressName": "",
"attentionName": "",
"addressLine1": "me str",
"addressLine2": "",
"addressLine3": "",
"addressLine4": "",
"streetAddress": "",
"city": "plano",
"state": "CO",
"province": "",
"zipCode": "23432",
"zipCodeSuffix": "",
"foreignPostalCode": "",
"countryCode": "US",
"countryName": "US",
"countyName": "",
"geoCode": "",
"siteId": ""
}
},
"documentComponentlist": [{
"phpc": "00000963000640320006403300065421",
"documentType": "format",
"documentTypeValue": "1060"
}, {
"phpc": "00000963000231740002319500033447",
"documentType": "delivery",
"documentTypeValue": "C002"
}, {
"phpc": "00000963000640320006403300065425",
"documentType": "media",
"documentTypeValue": "0006"
}]
}
}
}

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Why excel? not json file itself?
    Because your json looks complex and excel is preferable when data is flat / simple and (or) for data driven tests.

    If the above understanding is not correct, then you need to clarify more about the question.
  • Apoorva6's avatar
    Apoorva6
    Frequent Contributor
    Hi Rao. Thanks for reply. I need this for data driven test only. So that i can do the permutation and combination of data and feed to body.
    • nmrao's avatar
      nmrao
      Champion Level 3
      In that case, below would be more clean approach.

      Instead of putting json request in the table, put the json request into a file and use that file name in the data driven table file.
      • Apoorva6's avatar
        Apoorva6
        Frequent Contributor

        Hi Rao,

         

        Thanks again for reply. I agree with you. However is there a way to pick each attribute from CSV / XLSX, and convert it to above jason format and trigger the request ? Why i need is, I want to try permutation and combination of all attributes.

         

        One example is if I have 5 jason name value pairs, then some field may be mandatory, some are optional and all attributes length will be defined. So I want to make all available combinations and inject it to request one after another. So is there a way to achieve it in open source ?