Highlighted
Trusted Contributor.
Trusted Contributor.
1659 views

Simulating huge Json data in web_custom_request

I need to check the performance of excel file upload in .Net application with Mongodb. But i am  facing issue with how to fix this.
Here when the excel file is uploaded it is recorded in json format in web_custom_request.
The file content is converted into Json format at UI level and it is parsed to server.
I have tried by adding multipart/form data and file path but no success. I also captured the requests using Fiddler but the same requests are recorded.

Below  script is recorded with 2 records of data in body.

web_custom_request("Import",
        "URL=http://www.sample.com",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=application/json",
        "Referer=http://www.sample.com",
        "Snapshot=t16.inf",
        "Mode=HTML",
        "EncType=application/json;charset=UTF-8",
        "Body=[["Test1\":\"AP\",\"Test1\":\"Hyderabad\",\"Test2\":\"Hyderabad\",\"]",
        EXTRARES,
        "Url=Sample", "Referer=http://www.sammple.com", ENDITEM,
        LAST);


Logic implemented in the application:

var file = $scope.selectedFile;
                if (file) {

                    var reader = new FileReader();

                    reader.onload = function (e) {
                        var data = e.target.result;
                        var dataObjects = [];
                        var workbook = XLSX.read(data, { type: 'binary' });
                        for (var i = 0; i < workbook.SheetNames.length; i++) {
                            var first_sheet_name = workbook.SheetNames[i];

                            dataObjects.push(XLSX.utils.sheet_to_json(workbook.Sheets[first_sheet_name]));
                        }
                        debugger;
                        dataObjects.push($scope.selectedFile.name);
                        if (dataObjects.length > 0) {

                            var currentDate = $filter('date')(new Date(), "MM/dd/yyyy / HH:mm:ss");
                            var uplaodedFile = {
                                "fileName": $scope.selectedFile.name,
                                "dateTime": currentDate,
                                "failedCount" : 0,
                                "uploadStatus": "InProgress"
                            };

 

I have to check with huge no of records in the excel file and check the performance.

Can any one advice me how to solve this.

Tags (2)
0 Likes
4 Replies
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Simulating huge Json data in web_custom_request

Does any one faced similar situation. Please  advice me.

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Simulating huge Json data in web_custom_request

Does any face similar issue. Please advice me..

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: Simulating huge Json data in web_custom_request

Are you trying to upload raw excel file instead of json encoded using web_custom_request API? Could you show your part of using multipart/form-data and file path code?

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Simulating huge Json data in web_custom_request

As mentioned earlier, raw excel file is uploaded and it is converted into json at UI level and parsed. So the request is captured in body part in Json format.  There is no multipart/form-data and file path code in the body of web_custom_request.

I have to simulate this with huge no of records in excel file. Please suggest me.

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.