How to convert sample request and response xml text into postman request - postman

Now I have a text file(xml format) as a document for test some web applications but I don't know how to use it in Postman request also not able to import it .
request urls
sample request and response xml code

You can do so via pre-request setup.
You can check the documentation: https://www.postman.com/postman/workspace/postman-answers/documentation/9215231-c7c99fbb-b7f9-48a5-8ddc-192e0f8194e4

Related

Send POST json data to an url with POSTMAN not working

I have python code wrote here: https://repl.it/#AndreiCiobnic/MixedWealthyGnuassembler
I'm trying to (re)write in Postman to make a POST request to that url.
I put like:
But I got error response from that server.
How to send the data json in Postman ?

How to use the url that came in response

Help to understand and direct what needs to be done further. I use the robot framework version 3.1.1 and the Python 2.7 programming language to write the autotest script, and now there is a task to develop a test that will work with POST / GET requests. So, I make a POST request to the system to initiate a payment. The answer comes that the payment has been created, but for all actions it is necessary to follow the link inside the answer.
Request:
Create Session allias URL
&{params}= Create Dictionary params1=value1 params2=value2
${resp}= Post Request allias /init_payment.php params=${params}
Should Be Equal As Strings ${resp.status_code} 200
Reply post response:
<?xml version="1.0" encoding="utf-8"?>
<response><pg_status>ok</pg_status><pg_payment_id>3016695</pg_payment_id><pg_redirect_url>https://test.paybox.money/payment.html?customer=028c44bf25b6be251199221d04b570c2</pg_redirect_url><pg_redirect_url_type>need data</pg_redirect_url_type><pg_salt>8OYUsodtnaTWKbOD</pg_salt><pg_sig>a26e61d6eb710c430d67150498d1f555</pg_sig></response>
How to show the framework so that it can go through the redirect url? I would be very grateful for your help.
The RequestsKeywors from the Robot Framework use Requests HTTP Client. Reading the quickstart from this library you can find that the response's contents is available in the text field.
${body}= ${resp.text}
Then you'd most likely want to parse the XML. You can use the XML library for that.
It will be something like
${root} = Parse XML ${body}
${link} = Get Element Text ${root} response/pg_redirect_url

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 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.

Spring Security

I am trying to use spring security in my application developing restful web services and not getting the way how to send request to j_spring_security_check directly so that i can provide same url as a web service to Authorization of username and password.
Currently i am using following request pattern:
URL: "http://localhost:8080/CabFMS/j_spring_security_check"
Content-type: application/x-www-form-urlencoded
Body: {'j_username':'user','j_password':'123'}
Response: is Bad credentials
I am not sure about Content-type and body parameters. Please provide suggestion. To send request i am using REST Client
Tarun Gupta
As you correctly noticed j_spring_security_checks expects application/x-www-form-urlencoded content, therefore you need to encode it as such:
j_username=user&j_password=123
Your request pattern should be :
/j_spring_security_check?j_username=user&j_password=123
with method "POST" type.
other then this you can change request action & parameters text "j_spring_security_check" and "j_username" ,"j_password" by configuring alternate text in attributes :
login-processing-url,
username-parameter,
password-parameter
of spring "form-login" tag in security configuration xml file.
Create an AuthenticationSuccessHadler for this, in the authenticationSuccess method, return base64 encoded authorization header with the pattern username:password
Then, on each request, set the header as Basic yourtokenhere