I have a service need to validate parameters. For example,my request is:
<purchasePackage xmlns="http://bss.internal.service.boss.sysway.com/">
<entitlementId xmlns="">20100812151324</entitlementId>
<subscriberId xmlns="" />
<packageId xmlns="">SZ_VOD</packageId>
<deviceId xmlns="">801830456396</deviceId>
<effectionTime xmlns="">2010-08-25 00:00:00</effectionTime>
<expirationTime xmlns="">2009-08-25 00:00:00</expirationTime>
</purchasePackage>
EffectionTime is later than expirationTime, so I need response a error message out instead of send it to real service. How to do this?Someone can give me some advises?Best regards.
Use WSO2 ESB server and define custom proxy. When proxy receives the above request, pick both date values using xpath (use filter mediator) and compare which is greater value. You can use XPATh function for that(date comparison)
if greater allow to send to the service ..else execute fault sequence..
http://wso2.org/project/esb/java/4.0.3/docs/mediators/filter.html
Related
I am using HTTP request sampler for API performance testing. My APIs might return a response containing the skiptoken
If response contains the skiptoken, I need to call the API again using the skip token and capture the performance metrics. I required calling the API until there are no skiptoken available in the response.
Please let me know how I can implement this in JMeter
You can add a Post-Processor, for example JSON Extractor, which will extract the skpitoken into a JMeter Variable from the API response.
If the variable is defined you can add If Controller and send another request to the API with the variable from the previous step.
Something like this:
You have to use any of the Post processor according to your API response content. e.g, Json extractor, Regex extractor, Boundary based extractor, whichever suits well.
Then you need to use While Controller instead of If controller. The While controller it will keep executing the API inside it, until the last skiptoken gets retrieved/ not found - refer the screenshot
If you use If controller - It will execute only once and proceed with other APIs
Since, I don't know the exact response body structure - you can use Regex to fetch the value, something like the below
"#odata.nextLink":"([^ ]+)"
So I'm quite new to IIB and Extended SQL but what I want to do should be straight forward. I have a REST application which has a resource that is attached to a subflow. What I want to do is to get the input value passed to the service and use it to call a remote web service using the HTTP request node as shown below
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.Method = 'POST';
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://localhost:8002/MyService';
SET OutputLocalEnvironment.Destination.HTTP.QueryString.RemoteParam= InputLocalEnvironment.REST.Input.Parameters.myValue;
What is happening is, when I call the REST method and pass the value as a GET, I'm able to access the value. However, when I pass the parameter value using POST, I'm unable to access the value. My current flow is as follows:
Input > Compute > HTTPRequest > Compute > Output
I have searched on Google and applied all recommendations (e.g. setting compute node to LocalEnvironment) but nothing seems to work.
Well, we need more information in order to solve your problem but I guess you have problem in your HTTP request node
Go to HTTP request then in properties go to HTTP setting and change HTTP method to the method that you are using ( get or post )
and if you want to see if you are fetching data from right property just lunch debugger and put breakepoint in before and after of your nodes, then you can see what data you are receiving in each level and you can call the proper property.
ps. don't forget to deploy your project again in order to see new
changes
I hope that works for you
After further research, I found that IIB does not automatically parse content submitted as application/x-www-form-urlencoded. I inserted a trace node and realised that the parameters are instead submitted as a BLOB. All I had to do was read the blob, cast it to a string then use a Split function or a message model to get the individual parameters. Thanks for the pointers
I am working on a Jmeter LDAP test plan and the test plan has to populate an attribute on the LDAP that is multi-valued.
When I do an LDAP search sampler, I noted that the value I get back is a string, with the values separated by ", ".
But, if I take the same comma-separated string and try to do an LDAP modify or add, using either an LDAP Request or LDAP Extended Request, I get an error.
So I am wondering if there is a way that the Jmeter LDAP Request or LDAP Extended Request can do that?
Thanks,
Jim
EDIT: When I try to use an Extended LDAP Request modification test/add with the attribute of "", I get this error in the Jmeter GUI response:
When attempting to modify entry cn=xxx... to replace the set of values for attribute lastlogindate, value "20181023085627-04, 20181024063205-04" was found to be invalid according to the associated syntax: The provided value "20181023085627-04, 20181024063205-04" is not a valid generalized time value because it contains an invalid character '-' at position 14
The strange part is that even though I have Jmeter to log at debug level, I don't see any detail on the error in the Jmeter.log, but/so I am guessing that that error message is coming from the Jmeter client itself. I noticed that the message says:
to replace the set of values
so it seems like it recognizes that I am trying to modify/replace a multi-value, but it doesn't seem to like the syntax of the replacement values string(s).
Does anyone know what the correct format SHOULD be?
I found the answer to my own question, or at least "A" answer: It appears that I can use an Extended LDAP request, and add the same attribute in that request, multiple times. So for example, if I am populating an attribute named "foo" the Extended LDAP request would have the following:
attribute value opcode
foo 12345 add
foo 12346 add
etc.
I think I also need to do a replace with no value, to empty the attribute, before all the adds.
As am new to jmeter please help me in passing the value from a webservice response as the input to the next webservice request
I guess that your web service returns XML (more likely) or JSON.
All you need is to use XPath Extractor Post Processor, get interesting response part, store it to variable and use in next request.
You can address variables next ways:
${YOUR_VARIABLE_NAME}
${__V(YOUR_VARIABLE_NAME)}
I prefer the second option as it allows combining several variables, evaluating functions, etc.
When I use HTTPService.send(paramter) as a POST request, the web server does not appear to see variable "parameter" if it is a string. The server sees the parameter if it's an Object, but I'm looking to use something like httpservice.send(JSON.encode(object)); Is this possible?
Why not use the actual request objects.
in your service define request objects and post them or send them as get if you please.
Sample code here: http://pastebin.com/ft7QW2vg
Then just call .send on the service.
on the server you can simlpy process if with request.form (Asp)
Failing which why not append it to the url with a binding expression. (you would need to encode it since you would be more or less faking a url or a get behaviour).