HTTP バインディングコンポーネントは、JBI 環境のサービスへの接続を提供するプロバイダプロキシとして、あるいはサービスを呼び出すコンシューマプロキシとして使用されます。バインディングコンポーネントは、WSDL 1.1 仕様で定義されている HTTP 1.1 GET バインディングを実装します。これにより、アプリケーションは Web ブラウザに似た HTTP GET 対話を使用して、JBI 環境からサービスを消費または提供することができます。
HTTP バインディングコンポーネントを HTTP Get 対話で機能するように設定するには、バインディングコンポーネントがプロキシとして機能しているサービスの WSDL ファイルで、WSDL 1.1 仕様で定義されている次の HTTP バインディング言語要素を使用する必要があります。
WSDL バインディングが HTTP GET を使用することを示す <http:binding> 要素。
ポートのアドレスを表す <http:address> 要素。
各オペレーションの相対アドレスを表す <http:operation> 要素。ポートで定義されている <http:address> を基準とします。
要求のすべてのメッセージパートをどのようにエンコードして HTTP 要求 URI に含めるかを示す <http:urlEncoded> および <http:urlReplacement> 要素。
HTTP バインディングコンポーネントをプロバイダプロキシまたはコンシューマプロキシとして設定する方法の例は、Using the HTTP Binding Component with the HTTP GET method および Using the HTTP Binding Component with the HTTP POST Method で参照できます。
以降の節では、HTTP バインディングコンポーネントが HTTP バインディング言語要素をどのようにサポートし、実装するかについて説明します。特に指示がないかぎり、ここで説明する WSDL 要素は名前空間 http://schemas.xmlsoap.org/wsdl/http/ で定義されています。
<http:binding> 要素:
バインディングが HTTP プロトコルを使用することを示します。
<wsdl:binding> の従属要素として指定する必要があります。
現在、HTTP バインディングコンポーネントでは GET と POST の値だけがサポートされています (HTTP メソッドでは大文字と小文字が区別されることに注意してください)。
例:
<http:binding verb="POST"/> |
<http:address> 要素:
ポートのアドレスを表します。
<wsdl:port> の従属要素として指定する必要があります。
ポートの基底 URI を指定する location 属性が必要です。
例:
<http::address location="http://localhost/MyService/MyPort"/> |
<http:operation> 要素:
オペレーションのアドレスを表します。
<wsdl:operation/> の従属要素として指定する必要があります。
オペレーションの基底 URI を指定する location 属性が必要です。
このポートおよびこの特定のオペレーションに対する要求の完全な URI。<http:address> 要素はポートのアドレスを指定し、ポートは複数のオペレーションを持つ可能性があるので、この要素は特定のオペレーションの相対アドレスを表します。この要素の location 属性の値は <http:address> の location 属性の値に付加されて、このポートおよびこの特定のオペレーションに対する要求の完全な URI を形成します。
HTTP バインディングコンポーネントでは、この要素の location 属性の値として空白がサポートされています。
例:
Given: <http:operation location="Submit"> <http:address location="http://localhost/MyService/MyPort"> The full HTTP request URI is: http://localhost/MyService/MyPort/Submit |
<http:urlEncoded> 要素:
入力メッセージを構成しているすべてのメッセージパートが、次のようにクエリー文字列エンコーディングを使用して、要求 URI 内にエンコードされることを示します。
名前=値という形式で表された名前と値のペア
アンパサンドで区切られた名前と値のペア: name1=value1&name2=value2&...
メッセージパートの名前が各ペアの名前になり、メッセージパートの値が各ペアの値になります。
<wsdl:input/> の従属要素として指定する必要があります。
オペレーションの基底 URI を指定する location 属性が必要です。
GET メソッドの HTTP バインディングコンポーネントでのみサポートされます。POST メソッドの場合、<http:urlEncoded> は無視されます。詳細については、POST URL Processing of the HTTP WSDL Binding Implementation を参照してください。
例:
Given this description: <wsd:message name="MyMessage"> <wsdl:part name="partA" type="xsd:string"/> <wsdl:part name="partB" type="xsd:string"/> </wsdl:message> ... <wsdl:portType name="MyPortType"> <wsdl:operation name="MyOperation"> <wsdl:input message="MyMessage"/> </wsdl:operation> </wsdl:portType> ... <wsdl:binding name="MyBinding" type="MyPortType"> <http:binding verb="GET"/> <wsdl:operation name="MyOperation"> <wsdl:input> <http:urlEncoded/> </wsdl:input> </wsdl:operation> </wsdl:binding> ... <wsdl:service name="MyService"> <wsdl:port name="Port1" binding="MyBinding"> <http:address location="http://localhost/MyService/MyPort"/> </wsdl:port> </wsdl:service> Given these values mapped to the input parts: "valueY" -> "partA" "valueZ" -> "partB" The full HTTP request URI is: http://localhost/MyService/MyPort/MyOperation/partA=valueY&partB=valueZ |
<http:urlReplacement/> 要素:
入力メッセージを構成しているすべてのメッセージパートが、WSDL 1.1 仕様で詳細に記述されている置換アルゴリズムを使用して、要求 URI 内にエンコードされることを示します。
<wsdl:input/> の従属要素として指定する必要があります。
オペレーションの基底 URI を指定する location 属性が必要です。
GET メソッドの HTTP バインディングコンポーネントでのみサポートされます。POST メソッドの場合、<http:urlEncoded> は無視されます。詳細については、POST URL Processing of the HTTP WSDL Binding Implementation を参照してください。
例:
Given this description: <wsd:message name="MyMessage"> <wsdl:part name="partA" type="xsd:string"/> <wsdl:part name="partB" type="xsd:string"/> </wsdl:message> ... <wsdl:portType name="MyPortType"> <wsdl:operation name="MyOperation"> <wsdl:input message="MyMessage"/> </wsdl:operation> </wsdl:portType> ... <wsdl:binding name="MyBinding" type="MyPortType"> <http:binding verb="GET"/> <wsdl:operation name="MyOperation/(partA)/subcategory/(partB)"> <wsdl:input> <http:urlReplacement/> </wsdl:input> </wsdl:operation> </wsdl:binding> ... <wsdl:service name="MyService"> <wsdl:port name="Port1" binding="MyBinding"> <http:address location="http://localhost/MyService/MyPort"/> </wsdl:port> </wsdl:service> Given these values mapped to the input parts: "valueY" -> "partA" "valueZ" -> "partB" The full HTTP request URI is: http://localhost/MyService/MyPort/MyOperation/valueY/subcategory/valueZ |