Printing the Request and Reponse in the HTML Report File - citrus-framework

I have a customized reporting integrated with the framework. Where I have implemented TestReport extends AbstractTestListener implements TestReporter class.
This is the steps which is responsible to Print the Report in Html File
ET=ETTe.startTest(test.getName());
ET.log(LogStatus.PASS, test.toString());
ET.log(LogStatus.PASS, "Pass");
Any way by using test.toString() I can get the data which has been sent to the server. For printing the response do we have any method or way around for it?
Regards
BJ

You should also implement com.consol.citrus.report.MessageListener interface with onInboundMessage(...) and onOutboundMessage(...) in order to get access to the exchanged message data in your reporter.

Related

load and performance test of the AWS API in jmeter using two post methods

I need to test the load and performance test of the API which is hosted in the AWS API gate way. Im using two post methods to get the final result. first post method will pass the below parameters in json format in the API.
{
propno:"xxxxx",
apikey:"xxxx-xxxx",
user:"xxx"
}
by executing this i will get a reference number and status of the execution
{
reference:"ABxxxxxxxxxna",
status:"ok"
}
Then will pass this reference no in another post method to get the desired result.
{
refno:"ABxxxxxxxxxna",
apikey:"xxxx-xxxx",
user:"xxx"
}
Now i want to perform the load test in Jmeter. Any help would be appreciated.
What is your question exactly?
In JMeter you can send a POST request using HTTP Request sampler, the relevant configuration would be something like:
the refno value can be fetched using JSON Extractor configured like:
next in the second HTTP Request use ${refno} reference to the JMeter Variable
You might also need to add a HTTP Header Manager and configure it to send the Content-Type header with the value of application/json
once done you can
Add more users in the Thread Group according to your NFR/SLA/common sense/whatever
Run your test in command-line non-GUI mode
Generate HTML Reporting Dashboard and analyze the results

how to upload file in Advanced Rest Client

I am trying to use post method in this add Attachment to SAP ODATA service (URL), then I am getting the error
"Key 'file_name' not given".
I used Multippart/form-data and given file_name (with single cotes and with out it) still the error is same.
Any idea where to give file_name?
Thanks.

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.

How to produce both xml and json for a rest based service?

I am trying to produce both xml and json from my rest service.
#Produces({"application/xml", "application/json"})
However, when I try to use the service using curl/SOAPUI, I get back either xml or json depending on which is mentioned first. In simple words, only the first method is considered. Is there a workaround?
You should check this link out - oracle docs for #Produces
The spec says that it does indeed default to the first one if that is acceptable as specified by the media type on the request. You should check your soapUI tool and see what headers you are sending. If they are both being sent you will get a response with the first one listed in your #Produces annotation.

BizTalk 2006 SOAP Adapter - Messaging only Web Service Call

In BizTalk 2006, I am trying to set up a messaging-only scenario whereby the recieved message (a string) is passed to a web service method that takes a single string parameter. In other words, the whole body of the BizTalk message should be passed as the parameter to the web service call.
The service method looks like this:
[WebMethod]
public void LogAuditEvent(string auditEventMessage)
I have set up the assembly with the proxy class in the SOAP adapter configuration as required, but I can't figure out how to get the message body to be passed as the parameter. Without doing anything special, I get the following error message:
Failed to serialize the message part
"auditEventMessage" into the type
"String" using namespace "".
I think this means that the adapter cannot find a message part named after the parameter. So, my question is what do I need to do to get my message set up correctly? I was thinking that maybe I needed to add an outbound map, but was not sure what to use as the source schema and how to generate a proper schema for the web service request message.
Does anyone have any pointers on this seemingly simple task?
Thanks.
TDL,
I would take a look at the links below for some tips on how to do this. SOAP adapter can be problematic I would recommend WCF if your using R2. And if not look at the WSE adapters as well.
http://blogs.digitaldeposit.net/saravana/post/2007/01/31/Calling-Web-Service-from-BizTalk-2006-in-a-Messaging-only-Scenario-(aka-Content-based-Routing).aspx
-and-
http://www.pluralsight.com/community/blogs/aaron/archive/2005/10/07/15386.aspx
-and-
http://social.technet.microsoft.com/Forums/en-US/biztalkgeneral/thread/92f2cad3-39b9-47d0-9e6f-011ccd2f9e10/
-Bryan