Is there any object in VSM/DevTest to capture client details ?
Example : If I want to capture the hostname/port/url of the client which just a made call to virtual service ?
Yes, this can be done in several ways through scripting/coding.
One way is to create a custom or scripted DPH. Another way is to add a Scripted step after the Listen step. In your code/script, for an HTTP VSM, you can access a property called "lisa.vse.http.current.transaction" (e.g. testExec.getStateValue("lisa.vse.http.current.transaction")). This will return a string with the information you're looking for. The string looks something like the following, and you'll just need to write some additional lines of code to parse the string for the information you want:
com.itko.lisa.vse.http.HTTPTransaction[method=POST, uri=/Services/Base/Path, httpVersion=1.1, headers=Content-Type=text/xml; charset=utf-8&SOAPAction=....]
You can find this property and the actual string value in the Inspection View and selecting a transaction followed by selecting the Listener step in the Request Event Details tab.
Thanks William.. Yeah I used the object lisa.vse.http.current.transaction earlier also but this gives more details about virtual service request side.. like host name here ll be host name of VS deployed .. but what I am looking is hostname of the client which sent request to VS..
After the listen step with the following code you can get the clientIP:ClientPort. The individual values will be stored in fl_ClientIP & fl_ClientPort respectively
Request request = (Request) testExec.getStateObject("lisa.vse.request");
String clientip = request.getMetaData().get("lisa.vse.request.client.id");
String ClientUrl = clientip.split(":");
testExec.setStateValue("fl_ClientIP", ClientUrl );
testExec.setStateValue("fl_ClientPort", ClientUrl );