definitions types message port Type binding service definitions
全体的な構造 <definitions> <types> <message> <port. Type> <binding> <service> </definitions> …… …… …… </types> </message> </port. Type> </binding> </service>
WSDLの読みかた service 要素から types 要素に向かって、下から 順に読むとわかりやすい。 <definitions> <types> …… </types> <message> …… </message> <port. Type> …… </port. Type> <binding> …… </binding> <service> …… </service> </definitions> n
service 要素 (1) <service name="Google. Search. Service"> <port name="Google. Search. Port" binding="typens: Google. Search. Binding"> <soap: address location= "http: //api. google. com/search/beta 2"/> </port> </service>
service 要素 (3) <soap: address location= "http: //api. google. com/search/beta 2"/> n この Web サービスは、 http: //api. google. com/search/beta 2 とい うURLにアクセスする。
service 要素 (4) <port name="Google. Search. Port" binding="typens: Google. Search. Binding"> …… </port> n binding 要素の name 属性である Google. Search. Binding が登場している。
binding 要素 (1) <binding name="Google. Search. Binding" type="typens: Google. Search. Port"> …… </binding> n n Google. Search. Binding という名前を持つ port. Type 要素の name 属性である “Google. Search. Port” が登場
binding 要素 (2) <binding name="Google. Search. Binding" type="typens: Google. Search. Port"> <soap: binding style="rpc“ transport= "http: //schemas. xmlsoap. org/soap/http"/> <operation> …… </operation> </binding>
binding 要素 (3) <soap: binding style="rpc“ transport= "http: //schemas. xmlsoap. org/soap/http"/> n n rpc = 通信の手法を指定する。rpc かdocument となる。 http: //schemas. xmlsoap. org/soap/http = トラ ンスポート層のプロトコルとして HTTP を利用す る。
binding 要素 (5) <operation name="do. Google. Search"> <input> <soap: body use="encoded" namespace="urn: Google. Search“ encoding. Style= "http: //schemas. xmlsoap. org/soap/encoding/"/> </input> <output>. . . </output> </operation>
port. Type 要素 (1) <port. Type name="Google. Search. Port">. . . <operation name="do. Google. Search"> <input message= "typens: do. Google. Search"/> <output message= "typens: do. Google. Search. Response"/> </operation> </port. Type>
port. Type 要素 (2) n n Google. Search. Port という名前を持つ。 (binding要素で出てきた) operation 要素 がある。
port. Type 要素 (3) n operation 要素の input, output 要素では、 引数や返値の型を指定する。 n ここでは抽象的な名前だけで、型の具体的な 内容は message 要素で指定する。 <operation name="do. Google. Search"> <input message= "typens: do. Google. Search"/> <output message= "typens: do. Google. Search. Response"/> </operation>
message 要素 (1) <message name="do. Google. Search"> <part name="key“ type="xsd: string"/> <part name="q“ type="xsd: string"/> <part name="start“ type="xsd: int"/>. . . </message> <message name="do. Google. Search. Response"> <part name=“return” type="typens: Google. Search. Result"/> </message>
message 要素 (2) n n port. Type 要素の input・output 要素で使 われる型を指定する。 “do. Google. Search” という message には n n n string 型の key string 型の q int 型の start などが含まれる
message 要素 (4) n Part要素での型の指定は、XML Schema の型を使う。 n xsd: string など <message name="do. Google. Search"> <part name="key“type="xsd: string"/> <part name="q“ type="xsd: string"/> <part name="start“ type="xsd: int"/>. . . </message>
message 要素 (5) n 組み込みのデータ型で対応できないときは、 後述する types 要素で新しい型を作成す る。 <message name="do. Google. Search. Response"> <part name="return" type="typens: Google. Search. Result"/> </message>
types 要素 (1) <types> <xsd: schema xmlns= "http: //www. w 3. org/2001/XMLSchema" target. Namespace="urn: Google. Search"> <xsd: complex. Type name="Google. Search. Result"> …… </xsd: complex. Type>. . . </types>
types 要素 (2) <xsd: complex. Type name="Google. Search. Result"> <xsd: all> <xsd: element name="document. Filtering" type="xsd: boolean"/> <xsd: element name="result. Elements" type="typens: Result. Element. Array"/>. . . </xsd: all> </xsd: complex. Type>
- Slides: 34