Convert ELMAH raw files to Fiddler SAZ traces - fiddler

Is there a way to convert Raw/Source data in XML or in JSON generated by ELMAH to a Fiddler SAZ trace file?

https://github.com/mausch/ElmahFiddler adds a fiddle attachment when an error occurs ( when the errors are mailed). It extracts the *.saz file from the HttpRequest

Related

Invalid entity passed while trying below method [duplicate]

I am using Karate 0.9.0 version and I want to upload data using csv file. As per new update, it is converting data into JSON. But my API supports csv file format for upload function. How can I upload csv file in post request without converting data into json?
Example
Given path 'xxx/upload'
And header Authorization = xxx
And header Content-Type = 'text/csv'
And request read('classpath:xxx.csv')
When method POST
Then status 202
P.S. This example was working in Karate version: 0.9.0.RC5
Thanks, that is indeed an edge case we hadn't thought of, but you have 2 options that will work nicely:
1) rename your CSV file to *.txt
And request read('classpath:xxx.txt')
2) use the karate.readAsString() API
And request karate.readAsString('classpath:xxx.csv')

Loss of data when read xlsx as multipart/form-data

I am sending an xlsx file via post request as multipart/form-data to a HTTP listener when I check the size of the payload by using
%dw 2.0
output application/json
---
payload.^
The content length is shown as 35Kb. Please find below:
but when I copy the payload to a temporary variable and I check the size of the temporary variable the content length is shown as 19KB. Please find below:
and I can see that there is loss of data in the variable.
I have used this script to copy data from payload to temp payload (vars.tempPayload):
%dw 2.0
output multipart/form-data
---
payload
Why is this happening, Can anyone please help me with this. How to retain the entire content of the multipart/form-data payload ?
I suspect that you are looking at the content-length for the entire request, not for the specific attachment that you are interested at.
When I used the payload.parts.file.content.^raw and copied it to another variable, there was no data loss.

How to read actual file contents by name in CSV Data Set config - Jmeter

I was writing JMeter tests for REST API.
Its a post request and we need to send a big xml content in request body.
So I was using CSV Data Set config to parameterize the xml content in body part.
I have created a CSV Data Set config for HTTP Request sampler.
In csv file, I am writing the whole xml content. 1 row for 1 request. It is working fine.
But I found this is bit complex as we have to maintain large lines of xml in csv file.
Is there any way we can write only xml file names or full paths in csv file and CSV DataSet config checks the name and then read the contents of that file and append in request body.
file-abc.xml
file-def.xml
I think this would be easy to maintain as we can have dedicated files for XML content.
Any way to do it using CSV DataSet config?
Or any other way to achieve the same in JMeter tests.
I found this question How to hold Xml file names in CSV Data set Config (Jmeter)
I followed its answer but I am not able to pass the xml content in request body.
Its only passing xmlfile names written in csv file in the request body.
But as per answer it reads the file from xml path/name and pass it in the parameter.
You can keep the file names or paths to the files in the CSV file and read the file content using __FileToString() function directly in the HTTP Request sampler body
If you're keeping XML files in a separate folder you might find Directory Listing Config plugin easier to use in case you want to add/remove/rename files without having to maintain the CSV mapping.
Directory Listing Config plugin can be installed using JMeter Plugins Manager

NetSuite RESTlet output pdf

NetSuite Restlet PDF file encoding issue
The above thread seems to be giving a solution to outputing a pdf with a NetSuite RESTlet. As far as I know, you cannot output a pdf from a restlet, so I'm very confused. I am using a restlet to generate a report and the information ultimately needs to output to a pdf so I was trying to see if there was a work around. I tried the answer code from the above thread and I got the expected error:"error code: INVALID_RETURN_DATA_FORMAT error message:Invalid data format. You should return TEXT."
Am I missing something? Is there a way to export xml to a pdf with a NetSuite RESTlet?
The thread you reference discusses how to generate a PDF file in Netsuite. If you want to return a PDF from a RESTLet you will have to return it as a member of a JSON object. e.g.:
var pdfFile = genPDF(); // base this on the sample
return{
fileName: pdfFile.getName(),
fileContent: nlapiEncrypt(pdfFile.getValue(), 'base64')
};
And then your receiver will have to create the actual file.
Recall that RESTLets are for application-to-system communications. If you are trying to return a PDF to a browser you should probably be using a Suitelet.
If this is part of a larger app and you need the RESTLet then review this post: Save base64 string as PDF at client side with JavaScript for options to display the RESTLet response.
Reading through that answer, it appears you'll need to encode/convert the PDF to string format before returning, so you'll need to use base64 encoding.
The NS method nlapiEncrypt(content, 'base64') seems like it might be a good place to start.
Another avenue to investigate, which I haven't tried, is to first save the PDF in the file cabinet, then to return a public link to that file. You'll need to make sure the file has the correct permissions.

Verifying/testing the output of mime4j parsed content

I am creating a tool that is required to parse incoming MIME streams and return the email body and email attachments as separate file streams.
I am using mime4j for this purpose.
Following are the problems that I am stuck on:
How can I test whether the email body file or email attachment file that I parsed out via mime4j from MIME stream is correct?
I have a large corpus of emails available in raw mime form that I want to run my tests on and need some automated way to determine which ones might be breaking the mime parsing by mime4j and tweak the code for that.
You could decode the attachments and then re-encode them. If the re-encoded stream matches (byte-for-byte) the original, then that's a good sign that mime4j is properly handling them.
I initially parsed out a sample corpus *.eml files using mime4j. I had to manually check them for parsing errors as I had no other good choice.
Now I am using the earlier parsed out emails as testbed over which I check my parsed out results iteratively.