Cosminexus V9 BPM/ESB基盤 サービスプラットフォーム 開発ガイド 基本開発編
サービスアダプタのHTTPヘッダ引き継ぎ機能を使用して,ビジネスプロセスでHTTPヘッダおよびCookie情報を引き継ぐ方法について説明します。
なお,HTTPヘッダ引き継ぎ機能の概要については,マニュアル「サービスプラットフォーム 解説」の「2.2.5 Webサービス(SOAP通信)の場合のHTTPヘッダ引き継ぎ」を参照してください。
ここでは,次のビジネスプロセスでHTTPヘッダおよびCookie情報を引き継ぐ場合を例に,ビジネスプロセスの定義方法について説明します。
図F-1 Cookie情報の引き継ぎに使用するビジネスプロセス
ビジネスプロセスの定義の流れを次に示します。
ビジネスプロセス定義画面でアクティビティを配置します。アクティビティの配置および連結方法については,「5.4 アクティビティの配置と連結」を参照してください。
HTTPリクエスト用ヘッダ変数およびHTTPレスポンス用ヘッダ変数のスキーマを作成します。作成するスキーマは,次に示す目的に応じて,サービスプラットフォームが提供するテンプレートファイルを使い分けます。
また,SOAP1.1モードを利用して「JSESSIONID」のCookieを送受信する場合,クライアント定義ファイルのc4web.application.app_maintainsessionをtrueに変更してください。クライアント定義ファイルの詳細については,マニュアル「アプリケーションサーバ SOAPアプリケーション開発の手引」の「10.3 クライアント定義ファイルの設定」を参照してください。
HTTPリクエスト用ヘッダ変数のスキーマを作成します。斜体部分が変更個所です。
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="soap_cookie_request1.xsd※1"/> <xsd:element name="HTTPHeader_request"> <xsd:complexType> <xsd:sequence> <xsd:element name="Cookies" type="hrc:Cookie_types※2" minOccurs="0" maxOccurs="1"/> <xsd:element name="HTTPHeader" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:any namespace="##any" processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="Cookie_types※"> <xsd:sequence> <xsd:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="soap_cookie_request2.xsd※1"/> <xsd:element name="HTTPHeader_request"> <xsd:complexType> <xsd:sequence> <xsd:element name="Cookies" type="hrc:Cookie_types※2" minOccurs="0" maxOccurs="1"/> <xsd:element name="HTTPHeader" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:any namespace="##any" processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="Cookie_types※1"> <xsd:sequence> <xsd:element name="Cookie" type="hrc:Cookie_type" minOccurs="0" maxOccurs="unbounded"※2 /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Cookie_type"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="name" type="xsd:string" use="optional"/> <xsd:attribute name="path" type="xsd:string" use="optional"/> <xsd:attribute name="host" type="xsd:string" use="optional"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:schema> |
HTTPリクエストヘッダ設定用のスキーマの内容を次に示します。
表F-1 HTTPリクエストヘッダ設定用のスキーマの内容
# | タグ名 | 型 | 出現回数 | 説明 |
---|---|---|---|---|
1 | HTTPHeader_request | − | 1回 | − |
2 | ├<Cookies> | | |
− | 0または1回 | HTTPリクエストヘッダ内に格納されたCookie情報を取得して格納します。 |
3 | └<HTTPHeader> | − | 0または1回 | HTTPリクエストヘッダ内に格納された拡張ヘッダを取得して格納します。HTTPリクエストヘッダにある拡張ヘッダは無視します。 |
HTTPレスポンス用ヘッダ変数のスキーマを作成します。斜体部分が変更個所です。
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="soap_cookie_response1.xsd※1"/> <xsd:element name="HTTPHeader_response"> <xsd:complexType> <xsd:sequence> <xsd:element name="Cookies" type="hrc:Cookie_types※2" minOccurs="0" maxOccurs="1"/> <xsd:element name="HTTPHeader" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:any namespace="##any" processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="Cookie_types※"> <xsd:sequence> <xsd:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="soap_cookie_response2.xsd※1"/> <xsd:element name="HTTPHeader_response"> <xsd:complexType> <xsd:sequence> <xsd:element name="Cookies" type="hrc:Cookie_types※2" minOccurs="0" maxOccurs="1"/> <xsd:element name="HTTPHeader" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:any namespace="##any" processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
<?xml version="1.0" encoding="UTF-8"?> <!-- All Rights Reserved. Copyright (C) 2012, Hitachi, Ltd. --> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:hrc="http://www.hitachi.co.jp/soft/xml/cosminexus/csc/soap/http/header_response" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="Cookie_types※1"> <xsd:sequence> <xsd:element name="Cookie" type="hrc:Cookie_type" minOccurs="0" maxOccurs="unbounded"※2 /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Cookie_type"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="name" type="xsd:string" use="optional"/> <xsd:attribute name="path" type="xsd:string" use="optional"/> <xsd:attribute name="host" type="xsd:string" use="optional"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:schema> |
HTTPレスポンスヘッダ設定用のスキーマの内容を次に示します。
表F-2 HTTPレスポンスヘッダ設定用のスキーマの内容
# | タグ名 | 型 | 出現回数 | 説明 |
---|---|---|---|---|
1 | HTTPHeader_response | − | 1回 | − |
2 | ├<Cookies> | | | |
− | 0または1回 | HTTPレスポンスヘッダ内に格納されたCookie情報を取得して格納します。HTTPレスポンスヘッダにあるSet-Cookie属性は削除されます。 |
3 | └<HTTPHeader> | − | 0または1回 | HTTPレスポンスヘッダ内に格納された拡張ヘッダを取得して格納します。HTTPレスポンスヘッダにある拡張ヘッダは削除されます。 |
HTTPリクエスト用ヘッダ変数およびHTTPレスポンス用ヘッダ変数を作成します。作成手順を次に示します。
サービス呼出アクティビティのヘッダ割当変数に,作成した要求電文用および応答電文用の変数を設定します。
データ変換定義画面で変換元スキーマと変換先スキーマをマッピングします。
サービス呼出1とサービス呼出2の間でCookie情報を引き継ぐには,サービス呼出1の応答電文に設定した割当変数と,サービス呼出2の要求電文に設定した割当変数をマッピングします。
同様に,サービス呼出2とサービス呼出3の間でCookie情報を引き継ぐには,サービス呼出2の応答電文に設定した割当変数と,サービス呼出3の要求電文に設定した割当変数をマッピングします。
また,サービス呼出3と応答1の間でCookie情報を引き継ぐには,サービス呼出3の応答電文に設定した割当変数と,応答1に設定した割当変数をマッピングします。
手順を次に示します。
All Rights Reserved. Copyright (C) 2012, 2019, Hitachi, Ltd.