Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleGETUSERBYIP

This function will retrieve details of a user by their IP. It accepts the AdministrationPerson object as a parameter, which can be used to identify the user, by providing their IPID (which in the Yellowfin configuration database is the IpId field of the Person table).

The response will contain the AdministrationPerson object with the full details of the user.

 

  • Here is what a basic request for this call will look like:

    Code Block
    languagejava
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("GETUSERBYIP");
    
  • Then use the AdministrationPerson object to identify the user whose details are to be retrieved, by providing their IpId:

    Code Block
    languagejava
    AdministrationPerson ap = new AdministrationPerson();
    
    ap.setIpId(5);                  //IpId of admin@yellowfin.com.au account
    rsr.setPerson(ap);

     

     

  • Once the request is configured, perform the call:

    Code Block
    languagejava
    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

    Initialize the Administration web service. Click here to learn how to do this.

 

  • This call's response will contain these parameters:

    Response Element

    Data Type

    Description

    StatusCode

    String

    Status of the web service call. Possible values include:

    • SUCCESS
    • FAILURE

    Person

    AdministrationPerson

    Object with the user details

  • Use this example to display the result of this call:

    Code Block
    languagejava
    if ("SUCCESS".equals(rs.getStatusCode()) ) {
    	ap = rs.getPerson();
    	out.write("UserId: " + ap.getUserId() + "<br>");
    	out.write("Password: " + ap.getPassword() + "<br>");
    	out.write("FirstName: " + ap.getFirstName() + "<br>");
    	out.write("LastName: " + ap.getLastName() + "<br>");
    	out.write("Initial: " + ap.getInitial() + "<br>");
    	out.write("SalutationCode: " + ap.getSalutationCode() + "<br>");
    	out.write("RoleCode: " + ap.getRoleCode() + "<br>");
    	out.write("EmailAddress: " + ap.getEmailAddress() + "<br>");
    	out.write("LanguageCode: " + ap.getLanguageCode() + "<br>");
    	out.write("IpId: " + ap.getIpId() + "<br>");
    	out.write("TimeZoneCode: " + ap.getTimeZoneCode() + "<br>");
    	out.write("Status: " + ap.getStatus() + "<br>");
    } else {
    	out.write("Failure");
    	out.write(" Code: " + rs.getErrorCode());
    }
    
    
    

 

Complete Example

Below is a complete example of the GETUSERBYIP function. To use it for yourself, first carry out the following the steps:

  1. Copy the code and save it as ws_getuserbyip.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, admin user and user IpId according to your environment.
  4. Run http://<host>:<port>/ws_getuserbyip.jsp from your Internet browser.

 

Code Block
languagejava
<%            
/*              ws_getuserbyip.jsp                  */
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hof.util.*, java.util.*, java.text.*" %> 
<%@ page import="com.hof.web.form.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
<%
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false);        // adjust host and port number

AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();


AdministrationServiceRequest rsr = new AdministrationServiceRequest();

rsr.setLoginId("admin@yellowfin.com.au");          // provide your Yellowfin webservices admin account
rsr.setPassword("test");                           // change to be the password of the account above
rsr.setOrgId(1);
rsr.setFunction("GETUSERBYIP");

AdministrationPerson ap = new AdministrationPerson();

ap.setIpId(5);
rsr.setPerson(ap);
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

if ("SUCCESS".equals(rs.getStatusCode()) ) {
	ap = rs.getPerson();
	out.write("User Id: " + ap.getUserId() + "<br>");
	out.write("Password: " + ap.getPassword() + "<br>");
	out.write("First Name: " + ap.getFirstName() + "<br>");
	out.write("Last Name: " + ap.getLastName() + "<br>");
	out.write("Initial: " + ap.getInitial() + "<br>");
	out.write("Salutation Code: " + ap.getSalutationCode() + "<br>");
	out.write("Role Code: " + ap.getRoleCode() + "<br>");
	out.write("Email Address: " + ap.getEmailAddress() + "<br>");
	out.write("Language Code: " + ap.getLanguageCode() + "<br>");
	out.write("IpId: " + ap.getIpId() + "<br>");
	out.write("Time Zone Code: " + ap.getTimeZoneCode() + "<br>");
	out.write("Status: " + ap.getStatus() + "<br>");
} else {
	out.write("Failure");
	out.write(" Code: " + rs.getErrorCode() );
}
%>


 

 

...