Hi,
I am virtulizing web service which will listen request on JMS queue and will reply on a temporary tyopic .
It includes three different operations say A,B & C.
Request for all three operation are different but key value(username) that i need to filter will be same.
Hence xpath need to filter will be different for three operations.
I will decide which operation is coming in the request by soap Action but i am stuck with xpath for username.
Xpath will be different for 3 operations (Requests) but only one vsm i have to fetch request .
I am fetching request in consume step and also filtering out username in the same.
How can i tackle this.
Regards
Rahul V
Hi Rahul,
I am not sure why you wouldn't let magic strings do this for you. Are you using a VSI to select the response, or are you hand rolling the VSM to it all? If you are using one of the XML parsers as a filter on the Listen Step and a VSI, you should be able to use Magic Strings to marshal the username element from the incoming request to the response within the VSI. The notation in the VSIs response would be something like: {{_request_parentElement_childElement_username;/*unknownUserName*/}}
Assuming you need to access the username for some other reason, you might consider:
If the payload is SOAP XML, can you use the SOAP DPH as a filter to let DevTest parse the XML elements into an argument list?
If the payload is just XML, can you use the XML Data Protocol Handler as a filter to let DevTest parse your XML into an argument list?
If you let DevTest parse the XML, you can add a Scriptable DPH filter beneath the one that parses the XML to reference the "user name". For example,
import com.itko.util.ParameterList;
ParameterList args = lisa_vse_request.getArguments();
testExec.setStateValue("fl_myUserName", args.get("parentElement_childElement_username");
where "parentElement" and "childElement" represent the path to the username element as though it were in a DOM tree. If the XML is parsed correctly, the argument as shown in the VSI's arg list will give you the construct.
Now the property "fl_myUserName" has been extracted from the incoming argument list and is easily referenceable by other steps.