If have an element called "First Name" which should be equal to "jem", it should show some response. If I want to sent first name as blank value, I am not able to handle it.
If you are sending no value for a field then it should send response from meta because it matches only signature.
There are multiple ways to handle this:
1. Send response from meta response.
2. Mark comparison operator as "anything" for optional fields.
3. remove the optional field from the arguments tab.
4. Add one more transaction for same operation where optional field is not present in argument tab.
5. Change the match style to "Signature".
Please provide detail if you have any specific requirement for same.
Sorry to be rude but a couple of those ways are absolutely wrong. First of all you should never Change the match style!
Next, when working with optional elements you have to differ if this is an optional element that is only nullable or like in soap not in the request. That distinction makes a big difference.
If we are talking about an element that is always present but sometimes only blank, you want to handle those with behavioral scenarios. Example:
What you don't want to do is:
Since those suggestions would not result in the behavior you want as you need to match on that specific element.
If it is an element that can be present in the request or not (meaning it is either there or not there at all, like in soap), that would be a bit more complicated. If that is the case let me know and I will write you a solution to that too.
I do agree there are few ways which are not acceptable. I just listed how this thing can be achieved, and the selection of solution is purely on the basis of requirement.
It wasn't rude. Don't worry!!
I have a similar topic. how do deal with apis with large numbers of array elements containing structures with variable arrays (of structures), with optional fields
but have not found an acceptable method of dealing with this in the product.
I ended up writing our own handler and matcher service, for REST & JSON. It is 100% generic, and we have implemented about 15 services so far. 1 text file (vsi transaction like) and one spreadsheet (vsi message content like)
using the JSON Schema to validate the message for required/optionals/data types before doing any content matching really helps. then I implemented wildcarding to allow for any data at any level (field, structure, array).
we are stuck however on our first SOAP service which has all these same problems. (and I haven't learned the xml/xpath capabilities like I did for json)
Thank you very much Richter for the detailed explanation and this is the exact answer I was looking for. Thanks a lot !!
First of all thanks for the detailed explanation.
Am having requirement as per below scenario:
"If it is an element that can be present in the request or not (meaning it is either there or not there at all, like in soap), VS should send the response by ignoring the optional fields"
Request you to provide me the resolution how can i handle it in my VSI.
Thanks in advance
sadly you must make a new pattern for the message without the element, then setup the rest according to your needs.
the matching will ALWAYS use the actual elements in the message as present or not (signature match is the minimum).
Thank you Monika for the quick reply and it was helpful.
Retrieving data ...