Highlighted
Super Contributor.
Super Contributor.
1110 views

How to submit request where request inside binary file

Jump to solution

Hi,

I need to send a request that uses a binrary file attachment.

In postman, I simply enter the URL, and to make it work, in the Body tab, I select 'Choose File' and 'Binary' radio and browse to the binary file.  All works a treat.  However, not sure how I can do this in LoadRUnner?  Am thinking along the lines of a web_custom_request but not sure where even to start.

Many thanks,

J

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: How to submit request where request inside binary file

Jump to solution

You need to use web_submit_data API, here's a sample:

 

web_submit_data("cgi_return.exe",

                        "Action=http://kalimanjaro/cgi-bin/cgi_return.exe",

                        "Method=POST",

                        "EncType=multipart/form-data",

                        "TargetFrame=",

                        "RecContentType=text/html",

                        "Referer=http://kalimanjaro/html/forms/file.html",

                        "Snapshot=t2.inf",

                        "Mode=HTML",

                        ITEMDATA,

                                    "Name=name_of_files",                                 // form field name

                                    "Value=c:/dummy/dummy.doc",                    // value in Content-Disposition parameter of multipart message

                                    "File=Yes",

                                    "ContentType=text/special",                           // value in Content-Type parameter of multipart message

                                    "FilePath=dummy.txt",                                    // source path of upoaded file

                                    "ContentTransferEncoding=free",                  // value in Content-Transfer-Encoding parameter of multipart message

                        ENDITEM,

                        LAST);

 

/*

Replay log quote:

 -----------------------------7d025e2b16b064e\r\n

Content-Disposition: form-data; name="name_of_files"; filename="c:/dummy/dummy.doc"\r\n

Content-Type: text/special\r\n

Content-Transfer-Encoding: free\r\n

\r\n

Multipart message test\r\n

-----------------------------7d025e2b16b064e--\r\n 

*/

View solution in original post

0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

Re: How to submit request where request inside binary file

Jump to solution

Have you tried recording your business process using VuGen?

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to submit request where request inside binary file

Jump to solution

Hi,


Thanks for your response.  I was trying that, but then got confused.  Because postman is a chrome addon, it runs an instance of the browser but you don't launch it as a URL.  The command to launch it is:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"  --profile-directory=Default --app-id=fhbjgbiflinjbdggehcddcbncdddomop

Recording as a windows app didn't even launch it.  I can't use an online service because the binary file contains our unique key for a sevice that I'm hitting.

Cheers,

J

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to submit request where request inside binary file

Jump to solution

You need to use web_submit_data API, here's a sample:

 

web_submit_data("cgi_return.exe",

                        "Action=http://kalimanjaro/cgi-bin/cgi_return.exe",

                        "Method=POST",

                        "EncType=multipart/form-data",

                        "TargetFrame=",

                        "RecContentType=text/html",

                        "Referer=http://kalimanjaro/html/forms/file.html",

                        "Snapshot=t2.inf",

                        "Mode=HTML",

                        ITEMDATA,

                                    "Name=name_of_files",                                 // form field name

                                    "Value=c:/dummy/dummy.doc",                    // value in Content-Disposition parameter of multipart message

                                    "File=Yes",

                                    "ContentType=text/special",                           // value in Content-Type parameter of multipart message

                                    "FilePath=dummy.txt",                                    // source path of upoaded file

                                    "ContentTransferEncoding=free",                  // value in Content-Transfer-Encoding parameter of multipart message

                        ENDITEM,

                        LAST);

 

/*

Replay log quote:

 -----------------------------7d025e2b16b064e\r\n

Content-Disposition: form-data; name="name_of_files"; filename="c:/dummy/dummy.doc"\r\n

Content-Type: text/special\r\n

Content-Transfer-Encoding: free\r\n

\r\n

Multipart message test\r\n

-----------------------------7d025e2b16b064e--\r\n 

*/

View solution in original post

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to submit request where request inside binary file

Jump to solution

Hi there,

Thank you so much!!  It has worked a treat 🙂

Apologies for the delay in getting back to you and testing your solution . Have been out of the office.

Many thanks!

John

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to submit request where request inside binary file

Jump to solution

Glad i could help. Could you mark the issue as solved?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.