0

i'm facing issue while running rest api service in loadrunner(VUGEN),in soap ui it is working fine.

My Data contains around 10 fields but while request it is breaking one parameter into two then i'm facing internal server error.

Please help and unable to continue in new line in case i want to write it in another line

Code is :

Action()
{

    web_custom_request("Calculate",
       "URL=http://sdfsdfsdfgsdfgsdfgsdfgsdfgsd/sdfgsdf/sdfgsd",
       "Method=POST",
       "Resource=0",
       "EncType=application/json",
       "Mode=HTTP", 
       "Body={\"program\":\"L002\",\"Number\":null,\"serviceNumber\":\"09000\",\"customerStateName\":\"{state}\",\"storeCode\":\"{store}\",\"Amount\":\"{amount}\",\"paymentDetails\":[{\"type\":\"{types}\",\"amount\":{amount}\"}]}",LAST);


    return 0;
}

Unable to write it in two lines of code ,in case i'm trying to write then it is giving syntax error like , is missing or " is missing.Unable to write please any one help.

Response coming as:

{"program":"L002","Number":null,"serviceNumber":"09000","customer
  StateName":"MAHARASHTRA","storeCode":"1111","invoiceAmount":"50","paymentDetails":[{"type"
 :"CASH","amount":50"}]}

Line is breaking i.e customerStateName into customer,StateName because of this i'm getting Bad Request in Response,Please help.

Rajesh Om
  • 483
  • 2
  • 15
  • 39
  • I don't understand what is your question – Buzzy Jul 11 '17 at 11:11
  • In response giving bad request because of one parameter is spliting into two i.e Customer State Name into Customer and in new line as statename – Rajesh Om Jul 11 '17 at 11:25
  • Are you sure it is not just printed that way in the console? Is there an actual "\n" there? – Buzzy Jul 11 '17 at 14:01
  • Second Buzzy's comment on line break for readability versus an embedded character. If you have any doubts just move it all to one really long line – James Pulley Jul 11 '17 at 19:37

1 Answers1

1

Since LoadRunner 12.53, you have a new and easier way for making REST API calls, using the web_rest() API. See blog post about it.

sf_
  • 1,138
  • 2
  • 13
  • 28