Get local machine data
I have a Webynpro Java app. integrated into SAP Portal Netweaver 7.3.
I need to know, through the same app., details (IP address, MAC address, PC name, ...) of the machine who is launching the app. I know how to get the IP address:
String ipAddress = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getClientHostAddress();
But how can I get the other parameters?
This is because I need to restrict the app. running only to some specific machines, not all of them... any other ideas?
There are a few restrictions there. On the request, just some information will be available to the server, basically to protect the Client.
But there are ways to retrieve clientInformation - but the client needs to 'agree' with that - this should be true to every single technology that exposes this kind of information.
I will use a 'BIG' guess here:
- Both your users and in fact all your users * USE * Internet Explorer to browse your WDP Application.
var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
This variable properties will contain a list of all the NetworkAdapters of that computer. You may want to get more information around here:
There are some ways of using JS with WDJ. For instance, you can use NW Event API (EPCF) (http://help.sap.com/saphelp_nw73/helpdata/en/4a/337cde50161c62e10000000a42189c/content.htm) to communicate back and forth with WDJ. You can find some other articles here in the SDN about this topic - I'm just not used to the new SDN otherwise I would post a hyperlink here for you.
Of course, the solution above is dependent on browser settings: At least a popup (or the yellow bar on top) should display warning the user the webpage wants to execute an ActiveX; and I believe also this should be marked as Unsafe - no matter what, you let your internal user know what is going on and why there is such thing and you block the content if you don't get the MACAddress you want.
Hope it helps,