본문 바로가기
Study/Software Engineering

WSDL (Web Service Description Language)

by SeulKom 2010. 1. 24.

WSDL 이란?

 - 네트워크로 연결된 XML 기반 서비스를 기술하는 새로운 스펙
 - 서비스 공급자가 기반 프로토콜(SOAP, XML)이나 Encoding(Multipurpose Internet Messaging Extensions)과는 무관하게 기본 요청 포맷을 시스템에 제공할 수 있는 간단한 방식
  

 관련 XML 프로토콜 표준들
   - WDDX (Web Distributed Data eXchange) : Allaire Corp
   - XML-RPC (XML Remote Procedure Call) : UserLand Inc.
   - SOAP (Simple Object Access Protocol) : David Winer, IBM, Microsoft

 컨텐츠의 디스크립션과 구조를 정의하기 위한 제안
   - ICE (Information Content Exchange) : Vignette Corp
   - RSS (Resource Description Framework Site Summary) : Netscape etc.

  
WSDL 지원 방법

-  WSDL 인스턴스 : WSDL 네임스페이스 (http://schemas.xmlsoap.org/wsdl)를 명시하고 웹 서비스 집합을 네트워크 끝점 또는 포트의 모음으로 정의하는 루트 <definitions> 요소가 포함된 XML 문서

<wsdl: definitions>
    <wsdl:types>...</wsdl:types>
    <wsdl:message>...<wsdl:message/>
    <wsdl:portType>...</wsdl:portType>
    <wsdl:binding>...</wsdl:binding>
    <wsdl:service>...<wsdl:service>
<wsdl:definitions>

  
wsdl:types         교환될 메시지를 설명. 사용될 데이터 형식 정의를 제공.

wsdl:message   각 개별 전송의 데이터 포맷을 정의. 전송을 메시지 부분들로 나누는 것은 데이터에 논리적 뷰에
                           의존한다.
                           예를 들어, 원격 프로시터 호출이면 메시지는 다중 부분들로 나뉘어지고, 이중 하나는 프로시저
                           이름과 메타 데이터이고, 나머지는 프로시저 매개변수들.

wsdl:portType   하나의 논리적 연산을 형성하는 메시지들을 그룹핑. 예를 들어 한 리소스에 대해 input, output, fault
                          를 처리하는 각 메시지를 하나의 연산으로 그룹핑 할 수 있다.

wsdl:binding     논리적 모델과 물리적 모델 사이에 연결을 제공. 추상적 포트 유형을 통해 정의했던 연산을 사용하여
                          이것을 구체적 디스크립션으로 연결한다.

wsdl:service     통신 end point 의 물리적 위치를 지정. 포트 유형과 바인딩을 사용하고 특정 공급자용 웹 주소 또는
                          URI를 부여.


예제:
<?xml version="1.0"?>
<definitions name="EndorsementSearch"
  targetNamespace="http://namespaces.snowboard-info.com"
  xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl"
  xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns="http://schemas.xmlsoap.org/wsdl/">

  <types>
    <schema targetNamespace="http://namespaces.snowboard-info.com"
            xmlns="http://www.w3.org/1999/XMLSchema">

      <element name="GetEndorsingBoarder">
        <complexType>
          <sequence>
             <element name="manufacturer" type="string"/>
             <element name="model" type="string"/>
          </sequence>
        </complexType>
      </element>

      <element name="GetEndorsingBoarderResponse">
        <complexType>
           <all>
             <element name="endorsingBoarder" type="string"/>
           </all>
        </complexType>
      </element>

      <element name="GetEndorsingBoarderFault">
        <complexType>
           <all>
             <element name="errorMessage" type="string"/>
           </all>
        </complexType>
      </element>
  
    </schema>
  </types>
 
  <message name="GetEndorsingBoarderRequest">

    <part name="body" element="esxsd:GetEndorsingBoarder"/>
  </message>
  <message name="GetEndorsingBoarderResponse">
    <part name="body" element="esxsd:GetEndorsingBoarderResponse"/>
  </message>

  <portType name="GetEndorsingBoarderPortType">
    <operation name="GetEndorsingBoarder">
      <input message="es:GetEndorsingBoarderRequest"/>
      <output message="es:GetEndorsingBoarderResponse"/>
      <fault message="es:GetEndorsingBoarderFault"/>
    </operation>
  </portType>

  <binding name="EndorsementSearchSoapBinding"
           type="es:GetEndorsingBoarderPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetEndorsingBoarder">
      <soap:operation soapAction="http://www.snowboard-info.com/EndorsementSearch"/>
      <input>
        <soap:body use="literal"
                   namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </input>
      <output>
        <soap:body use="literal"
             namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </output>
  
      <fault>
        <soap:body use="literal"
                   namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </fault>
    </operation>
  </binding>

  <service name="EndorsementSearchService">
    <documentation>snowboarding-info.com Endorsement Service</documentation>
    <port name="GetEndorsingBoarderPort" binding="es:EndorsementSearchSoapBinding">
      <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/>
    </port>
  </service>

</definitions>