WebSphere Message Service Clients: Web Services Client for C++, Version 1.1 作業系統: Linux, Windows

使用 SetSecure 方法所定義的安全資訊

如果您要使用 SetSecure 方法來定義安全資訊, 就必須新增一行程式碼至 Web 服務用戶端應用程式, 來配置安全服務的 GSKit 設定。在應用程式對 Web 服務呼叫任何方法之前,必須先起始設定 GSKit 安全資訊。

下列範例顯示範例用戶端應用程式的 Windows 版本, 它可以在呼叫 Web 服務之前配置 GSKit 安全資訊。如果要在您自己的應用程式內配置安全設定, 請新增這個範例中以粗體字顯示的程式碼。

int main()
{
// 建立一般和安全通訊的 URL。本端主機可能需要
// 埠號,亦即,localhost:80
  char * pszNormalURL = "http://localhost/Test/services/TestPort";
  char * pszSecureURL = "https://localhost/Test/services/TestPort";

// 使用一般和安全 URL 設定來載入服務的實例。
  ITestService * serviceNormal = new ITestService( pszNormalURL);
  ITestService * serviceSecure = new ITestService( pszSecureURL);

// 起始設定安全服務的安全設定。
  serviceSecure->SetSecure( "<GSKit_InstDir><KeyRing.kbd>",
                            "<password or stash>",
                            "<label>", "NONE", "05", "NONE", false);
// 其餘的應用程式
: 
// 應用程式結束

    delete serviceSecure;
    delete serviceNormal;

    		return 0;
} 
註: <password or stash> 參數可以使用 內含加密密碼的隱藏檔來取代,使「原始」密碼不會出現在程式碼或配置檔中。隱藏檔的格式與 金鑰環資料庫定義的格式相同,但副檔名必須是‘.sth’(例如,<GSKit_InstDir><KeyRing.sth>)。

如需進一步資訊,請參閱GSKit


Concept topic

使用條款 | 此頁的評等

「時間戳記」圖示前次更新: 28 Apr 2006
(C) Copyright IBM Corporation 2005. All Rights Reserved.
本資訊中心採用 Eclipse 技術。(http://www.eclipse.org)