Qmetry - How to save soap api response to xml file - web-services

In Qmetry, I am calling below soap api request.
user requests 'post.sample.call'
Want to save the response in a xml file (sample.xml). Save response to "sample.xml"
Is there a step in qmetry to achieve this?

If purpose to save response for later reference, you will be able to find it under command log tab in qaf report. If you want to validate response you can utilize methods available with qaf we service support library. For any other purpose if you want to write response to file use get response from test base and write to file. Below code will give you response to write in file.
String responseBody = new RestTestBase().getResponse().getMessageBody();

Related

415 unsupported media type content-type application/pgp-encrypted while sending POST message

I'm working in REST API development project. The client have provided the OpenAPI specification for the API which they are expecting.
We have used the openAPI generator cli to generate the API from the OpenAPI specs given by the client.
Following are the two APIs
1. /requestFile:
This API is expected to accept JSON payload and produces payload of content type application/pgp-encrypted.
We have annotated the API as below.
#postmapping(value="/requestFile",consumes={"application/json"},produces={"application/pgp-encrypted"})
The expectation is to transfer a PGP encrypted JSON file as a response to the POST message.
I'm not sure how to transfer the PGP encrypted file as a response, I have searched for some references but most of them are using maultipart file to transfer binary files. Whereas the content type of multipartfiles is not same as "application/pgp-encrypted".
I need some help in transferring this pgp encrypted file as a response to the POST message via REST API.
2. /feedback
This API consumes payload of type application/pgp-encrypted and produces a simple http response code back to the client. We have annotated the API as below.
#postmapping(value="/feedback", consumes={"application/pgp-encrypted"})
When I try to send a POST message using POSTMAN with content type application/pgp-encrypted, we are getting a 415 unsupported mediatype error.
I need to understand how do we send pgp-encrypted file as a payload via POSTMAN and what is the content type I must use to achieve this.

Can ZOHO deluge script getUrl() function read HTTP response headers?

When trying to use getUrl() to grab a CSV file from a URL with basic .htaccess authorization, I am redirected to an Amazon S3 location. The getURL() function passes the original HTTP headers (for the auth) to Amazon S3 which Amazon thinks is an Amazon token; this causes the following error in the response:
Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified
I can't see these issues talked about anywhere other than an advisory from Thompson Reuters: https://community.developers.thomsonreuters.com/questions/29247/aws-download-x-direct-download-returns-invalid-arg.html
The fix is to receive the redirect back from the remote server, look at the response and pull out the new (redirected) URL and grab the CSV file from there without the auth details in the header.
Is there a way in deluge script ZOHO to do this? The getUrl() function seems really basic and the documentation is very thin.
The other way to do this is a 'middleware' application that can use CURL, save the CSV's on a remote server then use ZOHO getUrl() to pull these CSV files. This is not an optimal solution but unless ZOHO gives access to some HTTP client functions then I don't see another way.
To get the detail of the response headers include detailed:true in the invokeurl request.
Example:
// parameters is a Map
// header is a Map
response = invokeurl
[
url :url
type :POST
parameters:parameters
headers:header
detailed:true
];
// To see all headers and content
info response;
// To see the http response code
info response.get('responseCode');
// With detailed:true any html or json returned will be put in responseText
// info response.get('responseText');
// To see the all http response headers
info response.get('responseHeader');
// To see a specific http response header
// Note: case matters in the response headers name
// "Content-Type" won't find "content-type"
info response.get('responseHeader').get('content-type');
// was the url redirected to another url?
info response.get('responseHeader').get('location');
// get the redirect url
redirect_url = response.get('responseHeader').get('location')
from there you can process the redirect url and pass it to the next http request.
Recommendation:
After working for months both including detailed:true and not including it, I now lean toward always including it. detailed:true includes more useful information and has a helpful regular structure: {responseCode: <code>, responseHeaders: <headers>, responseText: <returned-data>}.
This is possible in Deluge using the invoke URL task - https://www.zoho.com/deluge/help/web-data/invokeurl-task.html#response.
invokeURL can hand over the response headers to you from which you can get the redirect URL and then proceed with the authentication.

How Qualtrics understands the response

I have implemented a web-service in qualtrics after a question block and the job is to do an operation and send a response back to my website after the survey.I don't know how qualtrics record these responses. Is there any logs section in qualtrics where we can see these responses? Can we deal with the responses in the qualtrics login?
If I'm understanding correctly, you're asking how responses are recorded in Qualtrics WebServices.
When a response comes in, Qualtrics parses the response as embedded data fields. Please note that the response has to be in json or xml encoding for Qualtrics to be able to properly parse it. When you test a webservice it gives you the option to set embedded data based on the response that comes back during testing.
Qualtrics automatically parses your response and assigns it to each parameter.
Either way work. (I didn't test in xml but, I assume it would work as well)
q1=answer1&q2=answer2&...
in JSON {"q1":"answer1", "q2":"answer2", ...)

Restful WS using spring to return Excel file in xml response

I have a requirement to make a Restful WebService End point which will return the generated excel file in xml response.
Basically generation of Excel is conditional, There can be some cases when the end point will not be able to generate the excel based on my logic, Hence I want to add a response header parameter which will first tell the RestClint whether the response has any excel or not. if present, then only the RestClient will further process the xml response and receive the Excel binary. If not, the RestClient will not process further.
But I am totally new to Restful WS and not sure if these requirement can be achieved. Hence need a pointer or reference.
Thanks.

How to Parse XML Response getting from WebService in Mirth Connect 3.0

I have one destination of type Web Service Sender. That web service sends XML Response.
I want to read values from that response & write in to the database.
How can I read XML Response & retrieve values from response XML.
I tried in 'Edit Response' option from channel Tasks by putting XML template & creating variables from xml tree.But it didn't work.
How could I read & parse xml response ?
Are you sure that you are getting response back from the Web Service Sender??
Response from the destination must be in Edit Response 'msg' variable, if the response is empty none of the steps in Edit Response gets executed.
To check if you are really getting response from destination put a logger statement in Edit Response, to check if the control is going in Edit Response.
The Response from Webservice Sender , can be got from the responseMap in Mirth. The following code can help.
var destination = responseMap.get("Destination Name");
var responseMessage = destination.getMessage();
You can get the responseMessage and add it to the Channel Map so that the rest of the destinations in the channels can also access it.
Let us know how it goes.