cancel
Showing results for 
Search instead for 
Did you mean: 

Hostname and windows user

Former Member
0 Kudos

Hi

We are developing an application in sap portal NetWeaver 2004s SPS 11 and need the client windows logged user and the machine hostname.

We have found the way to obtain the IP, this way

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getClientHostAddress();

The method WDProtocolAdapter.getProtocolAdapter().getRequestObject().getClientHostName() returns the IP in the same way that the other method.

Somebody knows as I can obtain these parameters? Thanks beforehand

Accepted Solutions (0)

Answers (1)

Answers (1)

Stefan-EA
Contributor
0 Kudos

Hello,

Try the following to get the host


try {
		IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
		InetAddress n = InetAddress.getLocalHost();
		String a = n.getCanonicalHostName(); 
		String b = n.getHostAddress();
		String c =n.getHostName();
		String d = n.getLocalHost().toString();

		msgMgr.reportSuccess("OS: " + System.getProperty("os.name"));
		msgMgr.reportSuccess("CanonicalHostName: " + a);
		msgMgr.reportSuccess("getHostAddress: " + b);
		msgMgr.reportSuccess("getHostName: " + c);
		msgMgr.reportSuccess("getLocalHost: " + d);
		
	} catch (UnknownHostException e) {
		e.printStackTrace();
	}