TImeStamp for Request and Response Transaction in SOAP - java

Is there a way to get how such time it took to get a response from a webservice call. Its for logging purpose where I am just trying to see how much time its taking to make a request and response and put that time in java code.

Related

How to wait for xml response to load in rest assured

API responses currently we are working on are in xml format. We suspect our test cases in rest assured are failing because we are not really waiting for the response to receive completely.
Added a line to check status code but we get 200 everytime.
Any other possible solution to wait for the complete xml response to receive ?
Thanks in advance.

How can we perform 2 get request at same time Rest assured API Testing

JAVA RESTASSURED APITESTNG CUCUMBER
when I send get request using path variable and query param, I get a token in the response body and I will not get proper response until I add that token as a query param and send another get request.
So How can I perform that?
Given Cucumber Feature File
Given API has the following filed <"fieldName">
When API sends a "GET" request to "TranscationAPI"
Then API will receive the response code as 200
And the body will have following field
Should I change it to something like this?
Given API has the following filed <"fieldName">
When API sends a "GET" request to "TranscationAPI"
Then API will receive token as ""
When API sends again "GET" request to "TranscationAPI"
Then API will receive the response code as 200
And the body will have following field
Or I can use handle this through a different method.
Background is the great place to obtain token - see https://cucumber.io/docs/gherkin/reference/#background
It's possible by Java multithreading mechanism - https://www.tutorialspoint.com/java/java_multithreading.htm

How can i use get request using httpClient java without get content?

I want to get request a page to set parameters using url(example.com?x=ttt&y=zzz) to reserve those in target server and then should do post request after that final. how can i do these (get request and then post request) in 1 seconds or faster way.
is there any way to do get and post together? but i should get first then post...

Setting timeout on webservice

I am very new to webservices, I call a webservice through a wrapper provided by some party. I need to wait for certain amount of time after calling the webservice, if response is not received, i should shoot up time out response.
Remember i do not call the webservice directly. Below is the psuedo code.
String responseXML = pro.sendToCustomer("https://india.com/ClientGatewayV2/GatewayClientInterfaceV2", asaXML);
pro.senToCustomer is present in the jar provided by third party. How do i handle session time out on this?

Get response header OkHttp

I need to check response header of HTTP request using OkHTTP library. before loading data I need to check it's last update time. The problem in that that the response body is about 2 MB so I need to get only Last-Modified header. Is it possible to load only response header without response body to increase the speed of the program`s RESTful actions?
You can send a HTTP HEAD request which only retrieves the headers. You only need to check if your server application supports HEAD requests.
The HEAD method is identical to GET except that the server MUST NOT
return a message-body in the response. The metainformation contained
in the HTTP headers in response to a HEAD request SHOULD be identical
to the information sent in response to a GET request. This method can
be used for obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This method is
often used for testing hypertext links for validity, accessibility,
and recent modification. (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)
Example for OkHttp:
String url = ...
Request request = new Request.Builder().url(url).head().build();
The response body is streamed, so you can make the regular request, read the headers, and then decide whether or not to consume the body. If you don’t want the body, you can close() it without much waste.
There is a slight cost to the server to serve a response that might be abandoned. But the overall cost will be lower than making a HEAD and then a GET request unless you expect abandon a significant fraction (say > 90%) of requests.

Categories