XML WSDL
- WSDL은 웹 서비스 설명 언어를 의미합니다.
- WSDL은 웹 서비스를 설명하는 데 사용됩니다.
- WSDL은 XML로 작성되었습니다.
- WSDL은 2007년 6월 26일의 W3C 권장 사항입니다.
WSDL 문서
WSDL 문서는 웹 서비스를 설명합니다. 다음 주요 요소를 사용하여 서비스의 위치와 서비스 방법을 지정합니다.
Element | Description |
---|---|
<types> | Defines the (XML Schema) data types used by the web service |
<message> | Defines the data elements for each operation |
<portType> | Describes the operations that can be performed and the messages involved. |
<binding> | Defines the protocol and data format for each port type |
WSDL 문서의 주요 구조는 다음과 같습니다.
<definitions>
<types>
data type definitions........
</types>
<message>
definition of the data being communicated....
</message>
<portType>
set of operations......
</portType>
<binding>
protocol and data format specification....
</binding>
</definitions>
WSDL 예제
다음은 WSDL 문서의 단순화된 부분입니다.
<message name="getTermRequest">
<part name="term" type="xs:string"/>
</message>
<message name="getTermResponse">
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>
이 예에서 <portType> 요소는 "glossaryTerms"를 포트 이름으로 정의 하고 "getTerm"을 작업 이름으로 정의합니다 .
"getTerm " 작업에는 "getTermRequest"라는 입력 메시지 와 "getTermResponse"라는 출력 메시지 가 있습니다.
< message> 요소는 각 메시지의 부분 과 관련 데이터 유형을 정의합니다.
<portType> 요소
<portType> 요소는 웹 서비스 , 수행 할 수 있는 작업 및 관련된 메시지 를 정의합니다.
요청-응답 유형이 가장 일반적인 작업 유형이지만 WSDL은 네 가지 유형을 정의합니다.
Type | Definition |
---|---|
One-way | The operation can receive a message but will not return a response |
Request-response | The operation can receive a request and will return a response |
Solicit-response | The operation can send a request and will wait for a response |
Notification | The operation can send a message but will not wait for a response |
WSDL 단방향 작업
단방향 작업 예:
<message name="newTermValues">
<part name="term" type="xs:string"/>
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="setTerm">
<input name="newTerm" message="newTermValues"/>
</operation>
</portType >
위의 예에서 portType "glossaryTerms"는 "setTerm"이라는 단방향 작업을 정의합니다.
"setTerm" 작업은 "term" 및 "value" 입력 매개변수가 있는 "newTermValues" 메시지를 사용하여 새로운 용어집 메시지를 입력할 수 있도록 합니다. 그러나 작업에 대해 정의된 출력이 없습니다.
WSDL 요청-응답 작업
요청-응답 작업 예:
<message name="getTermRequest">
<part name="term" type="xs:string"/>
</message>
<message name="getTermResponse">
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>
위의 예에서 portType "glossaryTerms"는 "getTerm"이라는 요청-응답 작업을 정의합니다.
"getTerm" 작업에는 "term"이라는 매개변수가 있는 "getTermRequest"라는 입력 메시지가 필요하며 "value"라는 매개변수가 있는 "getTermResponse"라는 출력 메시지를 반환합니다.
SOAP에 대한 WSDL 바인딩
WSDL 바인딩은 웹 서비스에 대한 메시지 형식 및 프로토콜 세부 정보를 정의합니다.
요청-응답 작업 예:
<message name="getTermRequest">
<part name="term" type="xs:string"/>
</message>
<message name="getTermResponse">
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>
<binding type="glossaryTerms" name="b1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation>
<soap:operation
soapAction="http://example.com/getTerm"/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
</binding>
바인딩 요소에는 이름과 유형 의 두 가지 속성이 있습니다.
name 속성(원하는 이름을 사용할 수 있음)은 바인딩의 이름을 정의하고 type 속성은 바인딩의 포트(이 경우 "glossaryTerms" 포트)를 가리킵니다.
soap:binding 요소에는 스타일과 전송이라는 두 가지 속성이 있습니다 .
스타일 속성은 "rpc" 또는 "document"일 수 있습니다. 이 경우 문서를 사용합니다. Transport 속성은 사용할 SOAP 프로토콜을 정의합니다. 이 경우 HTTP를 사용합니다.
작업 요소는 portType이 노출하는 각 작업을 정의합니다 .
각 작업에 대해 해당 SOAP 작업을 정의해야 합니다. 또한 입력 및 출력이 인코딩되는 방식을 지정해야 합니다. 이 경우 "리터럴"을 사용합니다.