I'm calling an async fire-and-forget SOAP webservice using jmeter and showing the results in a table.
If i use an WebService(SOAP) Request sampler, it will log the call result as an warning, even if the status code is 200, cause the ws respond with an empty message.
With a SOAP/XML-RPC Request, the log table show te request as concluded.
It's possible to tell to an WebService(SOAP) Request to understand a empty response as a valid response ?
Thanks.
In code of WebService Soap sampler it is said that:
// It is not possible to access the actual HTTP response code, so we assume no data means failure
Code excerpt:
// It is not possible to access the actual HTTP response code, so we assume no data means failure
if (length > 0){
result.setSuccessful(true);
result.setResponseCodeOK();
result.setResponseMessageOK();
} else {
result.setSuccessful(false);
result.setResponseCode("999");
result.setResponseMessage("Empty response");
}
So you don't have a solution with this sampler.
Another solution is to use HTTP Sampler with Raw Post Body and test only response code with assertion.
I opened a Bugzilla Enhancement request:
https://issues.apache.org/bugzilla/show_bug.cgi?id=53978
Related
I am trying to write automated tests with Postman. I am new to postman automation world so sorry if the question will seem dumb.
In the api that I need to test when I send a request I immediately receive a response with a transactionID, no matter transaction succeeded or not. Along with my request I send a CallbackURL to the server where I expect the actual transaction result to be called back. The server will do a PUT request back to the CallbackURL that I have provided with the transactionID and the actual response or error.
So the question is, can I have such kind of scenarios in my postman tests?
I guess I should run a web server and expose an endpoint which will expect a PUT request and I should get the body of this PUT request in my tests to check it, and respond back to it with success.
In other words, within my script I need to perform the following actions:
Do a request to the server passing a callback URL
check the immediate response from the server and keep the returned transactionID
Have a webserver run with an endpoint that I passed as a callback URL
Expect a request to that endpoint with transactionID and actual response
Check that the response is what I actually expected
Respond to the request with success
I was thinking about Postman Mock server, but seems it is not designed for such usage.
I also think may be I can run some JS Webserver (may be nodeJS) inside the postman Sandbox...
Actually I am very new to postman testing and I am really confused about this kind of issue. Is it even possible to do this with postman or I need something else?
There are some features provided by POSTMAN which can help you to resolve your problem
When you do request to server passing callback URL it gives you transactionID in response. Save that transactionID in environment variable or global variable. Same you can do it for callbackURL.
Eg. pm.environment.set("transactionID", transactionID);
Then you can do the second request where you passed callback URL and transactionID which you have already.
In short in POSTMAN there are features like
Set global and environment variable which helps to pass some values fetched from response to another request.
call other request on success of first request
eg. postman.setnextRequest({{requestname}});
If you can mentioned your problem statement little bit in details it will be easy to answer in better way.
Hope This Will Help You
Using Postman, when I make a PUT request to an endpoint which returns a 204 with content, Postman is unable to parse the response, and my collection runner stops that iteration, indicating that an error has occurred.
When run outside of the runner, Postman displays the following:
Other people have also had this problem
Unfortunately I cannot fix the non-standard endpoint. Is there a workaround that will let Postman continue without throwing an error, especially when using the collection runner?
The 204 (204 NO CONTENT) response from the server means that the server processed your request successfully and a response is not needed.
More here: https://httpstatuses.com/204
Actually as much as I know, if the server is sending a 204 with a payload response, the endpoint is not developed as it should.
This would be the main reason Postman is not showing a response payload. You will only be able to read response headers.
So if you send a PUT request, and only receive headers, it means everything is ok. If you spect data the server should be responding with a 200 code.
Now, said this, if postman is telling you that “it could not get any response” it means basically the server is not responding any thing. Now try to increase the timeout in the postman settings. It’s very probable that the server is taking to much time. Check outside the runner how much time it’s taking to response.
I hope this helps you.
We have an API endpoint we are building through API Gateway that can have two possible successful responses: 200 OK if all of the requested data is returned, and a 206 Partial Content if the data is paginated and additional requests are required to fetch all the data.
I found at https://aws.amazon.com/blogs/compute/amazon-api-gateway-mapping-improvements/ that Amazon now allows multiple 2XX responses to be defined, but I cannot attribute both responses to a success in the Integration Response configuration. Right now we have 200 set as the default, but it appears as if we have to specify a Lambda Error Regex for the 206 mapping.
Does this basically mean that I have to fail the 206 with an error message and then use the regex to determine if that message is being sent, and then basically just treat it like a success? Or how can I properly return either a 200 or a 206 as a successful response?
The endpoint that AWS will hit on our server will properly return a 200 or a 206, but when AWS responds to the client it is currently only sending a 200.
Does this basically mean that I have to fail the 206 with an error
message and then use the regex to determine if that message is being
sent, and then basically just treat it like a success?
Yes, that is correct. Quirky, wrong, but it works.
The API gateway doesnt provide sending multiple success 2xx response. Below are some options
Make your lambda or backend application fail and return some json response. Create a regex in integration response and map the response to a particular error code. The matching of regex is done on errorMessage field which can be only get once you throw error from lambda.
Utilise reponse overriding. You can create a default mapping which matches all or some responses and then in the mapping template you can override the status code to whatever you want to send back.
Eg:-
Lambda returns
def handler(event, context):
x = {
"message": "partial"
}
return x
API gateway integration response
Lambda error regex: -
Method response status: 200
Default mapping: Yes
Mapping template:
#set($inputRoot = $input.path('$'))
$input.json("$")
#if($inputRoot.toString().contains("partial"))
#set($context.responseOverride.status = 206)
#end
I have to mediate a multipart message in a API resource, so that, at first I have to call virus scan service and depending on the response:
If the response is 200 OK continue.
Else, the response is 401 Unauthorized drop message and return 401 response.
I have tired drop message (due to limitations in measuring multipart messages) if I get 401 in mediation, but the original message always go on.
Is there any solutions for that? Is possible mediate message with Java class mediator?
Is there any way to drop parent message by messageID?
If you use a simple <drop/> in your sequence, the message shouldn't be processed further. How does your API/Proxy look like?
You can also process your message inside your custom Java class. See the following link for an example.
https://docs.wso2.com/display/ESB481/Sample+380%3A+Writing+your+own+Custom+Mediation+in+Java
What HTTP status code should I return when a POST request is made to my RESTful API but the content in the POST field (let's say an XML) is invalid?
I would like to build a proper RESTful web service so I want to know.
I am now returning 405 when a HTTP method not supported by specific API is used, 200 when everything goes ok and 500 for all other errors (XML validation error etc).
Thank you.
I would respond with 400
400 Bad Request
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
That's what status code 422 is for.