Versions Compared

Key

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

...

こちらのセクションでは、Webサービスを介したユーザーの作成、操作、および削除方法について紹介します。こちらでは、サードパーティ製アプリケーションでユーザーの変更が行われるとすぐに、Webサービスが呼び出され、ユーザーの変更がミラーリングされることを想定しています。

主なユーザー管理関数

 

Expand
titleADDUSER

こちらの関数は、Yellowfinに新規ユーザーアカウントを作成します。

 

リクエストパラメーター

以下の要素は、こちらのリクエストとともに渡されます。

リクエスト要素データ型説明

LoginId

String

Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。

このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。

Password

String

上記アカウントのパスワードです。

OrgId

Integer

Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。

Function

String

Webサービス関数です。こちらは、「ADDUSER」に設定します。

Person

AdministrationPerson

ユーザー作成プロセスに関する新規ユーザーの詳細のすべてを含むオブジェクトです。以下の表を参照してください。

OrgRefString

クライアント組織内部参照IDです(こちらの設定はオプションです)。こちらは、参照されるクライアント組織に新規ユーザーを作成します。こちらを設定しない場合、新規ユーザーはデフォルト(プライマリー)組織内に作成されます。

以下は、新規ユーザーを作成するために、「AdministrationPerson」オブジェクトに設定しなくてはいけない必須のパラメーターです。

AdministrationPerson 要素データ型説明

UserId

String

新規ユーザーのユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。

Password

String

新規ユーザーのパスワードです。こちらは、Yellowfinのパスワードポリシーに準拠する必要があります。

FirstName

String

新規ユーザーの名です。

LastName

String

新規ユーザーの姓です。

RoleCode

String

新規ユーザーのロールを設定します。例:YFREPORTCONSUMER

注意:リポジトリデータベースから、Yellowfinのロールコードの一覧を取得することができます。例:SQLクエリーを使用する場合:SELECT * FROM OrgRole

EmailAddress

String

新規ユーザーの電子メールアドレスです。

 

リクエストの例

以下のSOAP XMLの例は、この呼び出しに渡すことのできるパラメーターを表示しています。

Code Block
languagexml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:remoteAdministrationCall>
         <arg0>
            <loginId>admin@yellowfin.com.au</loginId>
            <password>test</password>
            <orgId>1</orgId>
            <function>ADDUSER</function>       
            <person>
                <userId>binish.sheikh@yellowfin.com.au</userId>
                <emailAddress>binish.sheikh@yellowfin.com.au</emailAddress>
                <password>admin</password>
                <firstName>Binish</firstName>
                <lastName>Sheikh</lastName>
                <roleCode>YFREPORTCONSUMER</roleCode>
            </person>         
         </arg0>
      </web:remoteAdministrationCall>
   </soapenv:Body>
</soapenv:Envelope>

 

応答パラメーター

返される応答には、これらのパラメーターが含まれます。

応答要素データ型説明

StatusCode

String

Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。

  • SUCCESS
  • FAILURE

 

応答の例

サービスは、今回のSOAPの例に基づき、以下の応答を返します。

Code Block
themeEclipse
languagexml
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/">
         <return>
            <errorCode>0</errorCode>
            <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages>
            <messages>Creating New User via Webservices...</messages>
            <messages>Creating SessionBean for webservices user...</messages>
            <messages>Looking up user...</messages>
            <messages>Web Service Request Complete</messages>
            <sessionId>8090cb7879f7d5e72eab9625772c00b5</sessionId>
            <statusCode>SUCCESS</statusCode>
         </return>
      </ns2:remoteAdministrationCallResponse>
   </S:Body>
</S:Envelope>

 

手順

Javaの例を使用して、こちらの呼び出しを実行するための詳細な手順は、以下を参照してください。

Expand
title詳細手順
  • こちらは、Yellowfinの新規ユーザーを作成する基礎的なリクエストであり、管理ユーザーとしてのログインと、実行するWebサービスの呼び出しの指定を含みます。

    Code Block
    themeEclipse
    languagejava
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("ADDUSER");


  • 特定のクライアント組織に新規ユーザーを作成する場合は、こちらをコードに追加します。

    Code Block
    themeEclipse
    languagejava
    rsr.setOrgRef("org1");      // A new user will be added to the client org with "org1" as an organization reference ID


    orgRefパラメーターを定義しない場合は、新規ユーザーはデフォルト(プライマリー)組織内に作成されます。

 

  • ADDUSER関数は、新規Yellowfinユーザーの詳細を定義するために、AdministrationPersonオブジェクトを要求します。

    Code Block
    themeEclipse
    languagejava
    AdministrationPerson ap = new AdministrationPerson();
  • 新規ユーザーを作成するには、これら必須パラメーターの提供が必要です。:UserId、FirstName、LastName、RoleCode、Password、EmailAddress

    Code Block
    themeEclipse
    languagejava
    ap.setUserId("john.smith@yellowfin.com.au");      // if Yellowfin authentication option is set to "email address"
    ap.setFirstName("John");
    ap.setLastName("Smith");
    ap.setRoleCode("YFREPORTCONSUMER");                // Yellowfin role codes can be found performing this query against
                                                       // Yellowfin configuration database: SELECT * FROM OrgRole
    
    ap.setPassword("test");                              // Password must comply with your Yellowfin password policy
    ap.setEmailAddress("john.smith@yellowfin.com.au");

    AdministrationPersonオブジェクトのその他のパラメーターの設定はオプションです。

 

  • リクエストに「ap」オブジェクトを渡します。

    Code Block
    languagejava
    rsr.setPerson(ap);
  • リクエストを構成したら、呼び出しを実行します。

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

    管理サービスを初期化します。実行方法の詳細は、こちらを参照してください。

 

  • 返される応答には、StatusCodeパラメーターが含まれます。詳細については、上記の応答パラメーターの表を参照してください。

 

完成例

以下は、ADDUSER関数の完成例です。こちらを使用するには、以下の手順に従います。

  1. コードをコピーして、「ws_adduser.jsp」として保存します。
  2. root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
  3. 環境に応じた詳細を追加するために、ホスト、ポート番号、管理ユーザー、ユーザーを調整します。
  4. インターネットブラウザから、「http://<host>:<port>/ws_adduser.jsp」を実行します。

 

Code Block
themeEclipse
languagejava
<%           
/*              ws_adduser.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 web service admin account
rsr.setPassword("test");                           // change this to the password of the above account
rsr.setOrgId(1);
rsr.setFunction("ADDUSER");
 
 
AdministrationPerson ap = new AdministrationPerson();
 
 
ap.setUserId("john.smith@yellowfin.com.au");      // If Yellowfin authentication option is set to "email address"
ap.setFirstName("John");
ap.setLastName("Smith");
ap.setRoleCode("YFREPORTCONSUMER");                // Yellowfin role codes can be found performing this query against
                                                   // Yellowfin configuration database: SELECT * FROM OrgRole
 
ap.setPassword("test");                          // Password must comply with your Yellowfin password policy
ap.setEmailAddress("john.smith@yellowfin.com.au");
rsr.setPerson(ap);
 
 
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
 
if
("SUCCESS".equals(rs.getStatusCode()) ) {
    out.write("Success");
} else {
    out.write("Failure");
    out.write(" Code: " + rs.getErrorCode());
}
%>

...

ユーザー作成後は、Webサービスの呼び出しを使用してユーザーの詳細を取得することができます。「AdministrationPerson」オブジェクトのUser IDフィールドは、ユーザーを識別するために使用されます。結果として、投入された「AdministrationPerson」オブジェクトが返されます。セキュリティ上の理由からパスワードは返されず、「NULL」になります。ユーザー情報は、こちらの項目内のアプリケーションに照らし合わせて検証することもできます。

 

Expand
titleGETUSER

こちらの関数は、既存のYellowfinユーザーの詳細を取得します。これは、AdministrationPersonオブジェクトを、ユーザーの識別に使用できるパラメーターとして受け付けます。応答には、ユーザー詳細のすべてが含まれたAdministrationPersonオブジェクトが含まれます。

 

リクエスト要素

以下の要素は、こちらのリクエストとともに渡されます。

リクエスト要素データ型説明

LoginId

String

ログインをして、この関数を実行する、Webサービス管理者ユーザーのIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。

このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。

Password

String

上記アカウントのパスワードです。

OrgId

Integer

Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。

Function

String

Webサービス関数です。こちらは、GETUSER」に設定します。

Person

AdministrationPerson

情報が取得されるユーザーの詳細を含むオブジェクトです。注意:以下の表を参照してください。

OrgRefString クライアント組織内部参照IDです(こちらの設定はオプションです)。指定したクライアント組織にユーザーをログインさせます。こちらを設定しない場合、ユーザーはログイン先を指定するために、クライアント組織選択ページへ移動します。

以下は、こちらの関数のために「AdministrationPerson」オブジェクトに設定しなくてはいけない主要なパラメーターです。

AdministrationPerson要素データ型説明

UserId

String

情報が取得されるユーザーのユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスにすることができます。

 

リクエストの例

以下のSOAPの例は、こちらの呼び出しに渡すことのできるパラメーターを表示しています。

Code Block
themeEclipse
languagexml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:remoteAdministrationCall>
         <arg0>
            <loginId>admin@yellowfin.com.au</loginId>
            <password>test</password>
            <orgId>1</orgId>
            <function>GETUSER</function>       
            <person>
                <userId>admin@yellowfin.com.au</userId>
            </person>         
         </arg0>
      </web:remoteAdministrationCall>
   </soapenv:Body>
</soapenv:Envelope>

 

応答の要素

返される応答には、これらのパラメーターが含まれます。

応答要素データ型説明

StatusCode

String

Webサービスの呼び出しのステータスです。値の選択肢は、以下の通りです。

  • SUCCESS
  • FAILURE

Person

AdministrationPerson

ユーザー詳細を含むオブジェクトです。

 

応答の例

サービスは、今回のSOAPの例に基づき、以下の応答を返します。

Code Block
themeEclipse
languagexml
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/">
         <return>
            <errorCode>0</errorCode>
            <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages>
            <messages>Getting user information...</messages>
            <messages>Getting user information...</messages>
            <messages>Web Service Request Complete</messages>
            <person>
               <emailAddress>admin@yellowfin.com.au</emailAddress>
               <firstName>System</firstName>
               <initial/>
               <ipId>5</ipId>
               <languageCode>EN</languageCode>
               <lastName>Administrator</lastName>
               <roleCode>YFADMIN</roleCode>
               <salutationCode/>
               <status>ACTIVE</status>
               <timeZoneCode>AUSTRALIA/SYDNEY</timeZoneCode>
               <userId>admin@yellowfin.com.au</userId>
            </person>
            <sessionId>70dc3c7158a340e19b590f0ed6ea6a8b</sessionId>
            <statusCode>SUCCESS</statusCode>
         </return>
      </ns2:remoteAdministrationCallResponse>
   </S:Body>
</S:Envelope>

 

手順

Javaの例を使用して、こちらの呼び出しを実行するための詳細な手順は、以下を参照してください。

Expand
title詳細手順
  • こちらは、この呼び出しの基礎的なリクエストであり、管理ユーザーとしてのログインと、実行するWebサービスの呼び出しの指定を含みます。

    Code Block
    themeEclipse
    languagejava
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
     
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
     
    rsr.setFunction("GETUSER");
  • AdministrationPersonオブジェクトを介して、ユーザーIDを提供します。

     

    Code Block
    themeEclipse
    languagejava
    AdministrationPerson ap = new AdministrationPerson();
    ap.setUserId("john.smith@yellowfin.com.au");
    rsr.setPerson(ap);
  • リクエストの構成が完了したら、呼び出しを実行します。

     

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

    管理Webサービスを初期化します。実行方法の詳細は、こちらを参照してください。

 

  • 応答には、StatusCodeとPersonパラメーターが含まれます。より詳細な情報は、応答パラメーターの表を参照してください。

 

  • 取得したユーザーの詳細を表示するには、以下の例を使用します。

    Code Block
    themeEclipse
    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());
    }

      

完成例

以下は、GETUSER関数の完成例です。こちらを使用するには、以下の手順に従います。

  1. コードをコピーして、「ws_getuser.jsp」として保存します。
  2. root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
  3. 環境に応じた詳細を追加するために、ホスト、ポート番号、管理ユーザー、ユーザーを調整します。
  4. インターネットブラウザから、「http://<host>:<port>/ws_getuser.jsp」を実行します。

 

Code Block
themeEclipse
languagejava
<%           
/*              ws_getuser.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 web services admin account
rsr.setPassword("test");                           // change to the password of the above account
rsr.setOrgId(1);
rsr.setFunction("GETUSER");
 
AdministrationPerson ap = new AdministrationPerson();
ap.setUserId("john.smith@yellowfin.com.au");
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() );
}
%>

...

これらのサービスは、Yellowfinユーザーのセッションを終了することができます。

 

Expand
titleLOGOUTUSER

こちらのサービスは、Yellowfinのセッションを終了しますが、ユーザーをログアウトさせるために「LoginSessionId」を要求します。これはユーザーを識別するに十分であるため、ユーザーIDは要求されません。LOGINUSER、またはLOGINUSERNOPASSWORD関数とともにシングルサインオンが実行されている場合、以下を介してLoginSessionIdを取得することができます。

Code Block
languagejava
String token = response.getLoginSessionId();

 

 こちらの値を保存することで、後ほどLOGOUTUSERリクエストに渡すことができます。

Code Block
languagejava
request.setLoginSessionId(token);

 

リクエストの要素

以下の要素は、こちらのリクエストとともに渡されます。

リクエスト要素データ型説明

LoginId

String

Yellowfin Webサービス管理者ユーザーのIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。

このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。

Password

String

上記アカウントのパスワードです。

OrgId

Integer

Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。

Function

String

Webサービス関数です。こちらは、「LOGOUTUSER」に設定します。

PersonAdninistrationPerson

プロフィール画像を変更するユーザーの詳細を含むオブジェクトです。注意:以下の表を参照してください。

LoginSessionIdString終了しなくてはいけないYellowfinインスタンスのセッショントークンです。これは、ユーザーを識別するに十分です。

こちらの関数のために「AdministrationPerson」オブジェクトに設定しなくてはいけない主要なパラメーターです。

AdministrationPerson要素データ型説明

UserId

String

詳細を変更するユーザーを識別するためのユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。

PasswordString上記アカウントのパスワードです。

 

リクエストの例

以下は、上記のパラメーターを使用して、こちらの関数のリクエストを示すSOAP XMLの例です。

Code Block
themeEclipse
languagexml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:remoteAdministrationCall>
         <arg0>
            <loginId>admin@yellowfin.com.au</loginId>
            <password>test</password>
            <orgId>1</orgId>
            <function>LOGOUTUSER</function>
            <person>           
               <userId>admin@yellowfin.com.au</userId>
               <password>test</password>
            </person>
            <loginSessionId>39fb11047affb98c9d081fb48bed0093</loginSessionId>
         </arg0>
      </web:remoteAdministrationCall>
   </soapenv:Body>
</soapenv:Envelope>

 

応答の要素

返される応答には、これらのパラメーターが含まれます。

応答要素データ型説明

StatusCode

String

Webサービスの呼び出しのステータスです。値の選択肢は、以下の通りです。

  • SUCCESS
  • FAILURE

 

応答の例

以下は、上記のSOAP XMLの呼び出しの応答です。

Code Block
themeEclipse
languagexml
 <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/">
         <return>
            <errorCode>0</errorCode>
            <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages>
            <messages>Web Service Request Complete</messages>
            <sessionId>9cad6c76734e329c298e7b15c57a19db</sessionId>
            <statusCode>SUCCESS</statusCode>
         </return>
      </ns2:remoteAdministrationCallResponse>
   </S:Body>
</S:Envelope>

 

手順

Javaの例を使用して、こちらの呼び出しを実行するための詳細な手順は、以下を参照してください。

Expand
title詳細手順
  • 以下は、こちらの呼び出しの基礎的なリクエストであり、管理ユーザーとしてのログインと、実行するWebサービスの呼び出しの指定を含みます。

    Code Block
    themeEclipse
    languagejava
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
     
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
     
    rsr.setFunction("LOGOUTUSER");
  • ログインセッションIDを渡します。

     

    Code Block
    themeEclipse
    languagejava
    rsr.setLoginSessionId(token);
  • ユーザーが複数のTomcatセッションに同時にログインしている場合は、パラメーターを設定することで、どのセッションを終了するのかを指定することができます。例:

     

    Code Block
    themeEclipse
    languagejava
    String[] _sessionId = new String[]{sessionId}; // log out by Tomcat session Id (cookies JSESSIONID)
    rsr.setParameters(_sessionId);

    終了のリクエストごとに、ひとつのセッションを提供します。TomcatセッションIDはオプションです。こちらを省略する場合、Yellowfinはすべてのユーザーのセッションを終了します。

     

  • リクエストの構成が完了したら、呼び出しを実行します。

     

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

    管理Webサービスを初期化します。実行方法の詳細は、こちらを参照してください。

 

  • この呼び出しの応答には、StatusCodeパラメーターが含まれます。より詳細な情報は、上記の応答パラメーターの表を参照してください。

 

 

完成例

以下は、LOGOUTUSER関数の完成例です。スクリプトは、以下の手順を実行するために設計されています。

    • LoginSessionIdを取得するLOGINUSERサービスの呼び出し。
    • ログインリンクの構成。指定したユーザーのYellowfinセッションを初期化するために、まずはこちらのリンクをクリックしなくてはいけません。(今回の例では、john.smith@yellowfin.com.auをログインユーザーに使用します。指定するユーザーは、既にYellowfinインスタンスに存在していなくてはいけません。または、userIdを変更することもできます。)
    • ログアウトするためのリンクを構成。セッションを開始したら、こちらをクリックしなくてはいけません。

 

こちらのスクリプトを使用するには、以下の手順に従います。

  1. コードをコピーして、「logoutuser.jsp」として保存します。
  2. root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
  3. 環境に応じて、ホスト、ポート番号、管理ユーザー、ログイン/ログアウトするユーザーを調整します。
  4. インターネットブラウザから、「http://<host>:<port>/logoutuser.jsp」を実行します。

 

Code Block
themeEclipse
languagejava
<%           
/*              logoutuser.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();
 
String token = request.getParameter("token");
 
if (token == null) {
     
    //login the admin user:
 
    rsr.setLoginId("admin@yellowfin.com.au");          // provide your Yellowfin web services admin account
    rsr.setPassword("test");                           // change to the password of the above account
    rsr.setOrgId(1);
    rsr.setFunction("LOGINUSER");
 
    AdministrationPerson ap = new AdministrationPerson();
 
    String userId = "john.smith@yellowfin.com.au";
 
    ap.setUserId(userId);
    ap.setPassword("test");
 
    rsr.setPerson(ap);
 
    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
 
    if ("SUCCESS".equals(rs.getStatusCode()) ) {
        String token_ = rs.getLoginSessionId();
        out.write("Login by opening the link in a new subtab prior to Logout. The tomcat session must be initialized...");
        out.write("<BR>Login: <A href='http://localhost:8080/logon.i4?LoginWebserviceId=" + token_ + "'>");
        out.write("http://localhost:8080/logon.i4?LoginWebserviceId=" + token_ + "</a><br>");
        out.write("<BR>Logout: <A href='http://localhost:8080/test.jsp?token=" + token_ + "&userId=" + userId + "'>");
        out.write("http://localhost:8080/test.jsp?token=" + token_ + "&userId=" + userId + "</a><br>");
    } else {
        out.write("Failure");
        out.write(" Code: " + rs.getErrorCode() );
        return;
    }
} else {
 
    //logout the user:
 
    out.write("Trying to logout " + token + " session...<br>");
 
    rsr = new AdministrationServiceRequest();
 
    rsr.setLoginId("admin@yellowfin.com.au");          // provide your Yellowfin web services admin account
    rsr.setPassword("test");                           // set the password of the above account
    rsr.setOrgId(1);
 
    rsr.setFunction("LOGOUTUSER");
 
    rsr.setLoginSessionId(token);
 
    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
 
    if ("SUCCESS".equals(rs.getStatusCode()) ) {
        out.write("Logout: Success");
    } else {
        out.write("Failure");
        out.write("Code: " + rs.getErrorCode() );
    }
}
%>

...