기본 WSDL 구조 이해 – (웹 서비스 설명 언어) 설명
게시 됨: 2020-08-24SOAP 대 REST 호출에 대한 이전 게시물을 보셨을 것입니다. 이제 회사는 REST 서비스 호출로 이동하고 있지만 여전히 대다수의 회사는 REST를 통해 SOAP를 사용합니다. 이 튜토리얼에서는 WSDL(Web Service Description Language)의 기본에 대해 설명합니다.
아래 질문 중 하나가 있으면 올바른 위치에 있습니다.
- WSDL(웹 서비스 기술 언어)이란 무엇입니까?
- WSDL 튜토리얼
- WSDL(웹 서비스 설명 언어) 설명
- WSDL의 예 – 웹 서비스 기술 언어
WSDL(웹 서비스 설명 언어)
Java Web Development World에서 WSDL은 문서 지향 또는 절차 지향 정보를 포함하는 메시지에서 작동하는 끝점 집합으로 네트워크 서비스를 설명하기 위한 XML 형식입니다.
작업과 메시지는 추상적으로 설명된 다음 구체적인 네트워크 프로토콜 및 메시지 형식에 바인딩되어 끝점을 정의합니다. 관련된 구체적인 끝점은 추상 끝점(서비스)으로 결합됩니다.
WSDL
은 통신에 사용되는 메시지 형식 또는 네트워크 프로토콜에 관계없이 끝점 및 해당 메시지에 대한 설명을 허용하도록 확장 가능하지만 이 문서에 설명된 유일한 바인딩은 SOAP 1.1, HTTP GET/POST 및 몸짓 광대극.

다른 사람은 다음을 읽어야 합니다.
- Eclipse에서 샘플 WSDL 생성 및 클라이언트 생성
- JAX-RS 및 Jersey를 사용하여 Java로 RESTful 서비스를 구축하는 방법(예시)
즉, WSDL 문서는 서비스 를 네트워크 끝점 또는 ports
모음으로 정의합니다. WSDL에서 엔드포인트 및 메시지의 추상 정의는 구체적인 네트워크 배포 또는 데이터 형식 바인딩과 분리됩니다. 이것은 추상적인 정의의 재사용을 허용합니다: 교환되는 데이터에 대한 추상적인 설명인 messages
와 작업의 추상적인 컬렉션인 포트 유형.
특정 포트 유형에 대한 구체적인 프로토콜 및 데이터 형식 사양은 재사용 가능한 binding
을 구성합니다. 포트는 네트워크 주소를 재사용 가능한 바인딩과 연결하여 정의되며 포트 모음은 서비스를 정의합니다.
따라서 WSDL 문서는 네트워크 서비스 정의에 다음 요소를 사용합니다.
-
Types
– 일부 유형 시스템(예:XSD
)을 사용하는 데이터 유형 정의를 위한 컨테이너입니다. -
Message
– 전달되는 데이터의 추상적이고 형식화된 정의입니다. -
Operation
– 서비스에서 지원하는 작업에 대한 추상적인 설명입니다. -
Port Type
- 하나 이상의 끝점에서 지원하는 추상 작업 집합입니다. -
Binding
– 특정 포트 유형에 대한 구체적인 프로토콜 및 데이터 형식 사양입니다. -
Port
– 바인딩과 네트워크 주소의 조합으로 정의된 단일 끝점입니다. -
Service
– 관련 엔드포인트의 모음입니다.
요소 | 설명 |
---|---|
<종류> | 웹 서비스에서 사용하는 (XML 스키마) 데이터 유형을 정의합니다. |
<메시지> | 각 작업에 대한 데이터 요소를 정의합니다. |
<포트 유형> | 수행할 수 있는 작업과 관련된 메시지를 설명합니다. |
<제본> | 각 포트 유형에 대한 프로토콜 및 데이터 형식을 정의합니다. |
예: HTTP를 통한 SOAP 1.1 요청/응답
샘플 XML WSDL 문서.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
<? xml version = "1.0" ?> < definitions name = "StockQuote" targetNamespace = "http://example.com/stockquote.wsdl" xmlns : tns = "http://example.com/stockquote.wsdl" xmlns : xsd1 = "http://example.com/stockquote.xsd" xmlns : soap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns = "http://schemas.xmlsoap.org/wsdl/" > < types > < schema targetNamespace = "http://example.com/stockquote.xsd" xmlns = "http://www.w3.org/2000/10/XMLSchema" > < element name = "TradePriceRequest" > < complexType > < all > < element name = "tickerSymbol" type = "string" / > < / all > < / complexType > < / element > < element name = "TradePrice" > < complexType > < all > < element name = "price" type = "float" / > < / all > < / complexType > < / element > < / schema > < / types > < message name = "GetLastTradePriceInput" > < part name = "body" element = "xsd1:TradePriceRequest" / > < / message > < message name = "GetLastTradePriceOutput" > < part name = "body" element = "xsd1:TradePrice" / > < / message > < portType name = "StockQuotePortType" > < operation name = "GetLastTradePrice" > < input message = "tns:GetLastTradePriceInput" / > < output message = "tns:GetLastTradePriceOutput" / > < / operation > < / portType > < binding name = "StockQuoteSoapBinding" type = "tns:StockQuotePortType" > < soap : binding style = "document" transport = "http://schemas.xmlsoap.org/soap/http" / > < operation name = "GetLastTradePrice" > < soap : operation soapAction = "http://example.com/GetLastTradePrice" / > < input > < soap : body use = "literal" / > < / input > < output > < soap : body use = "literal" / > < / output > < / operation > < / binding > < service name = "StockQuoteService" > < documentation > My first service < / documentation > < port name = "StockQuotePort" binding = "tns:StockQuoteBinding" > < soap : address location = "http://example.com/stockquote" / > < / port > < / service > < / definitions > |

SOAP 2.0 WSDL 예:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
< ! -- Crunchify ' s example of WSDL 2.0 -- > <? xml version = "1.0" encoding = "UTF-8" ?> < definitions xmlns = "http://www.w3.org/ns/wsdl" xmlns : tns = "http://www.tmsws.com/wsdl20sample" xmlns : whttp = "http://schemas.xmlsoap.org/wsdl/http/" xmlns : wsoap = "http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace = "http://www.tmsws.com/wsdl20sample" > < ! -- Abstract type -- > < types > < xs : schema xmlns : xs = "http://www.w3.org/2001/XMLSchema" xmlns = "http://www.tmsws.com/wsdl20sample" targetNamespace = "http://crunchify.com/wsdl20" > < xs : element name = "request" > . . . add your code here . . . < / xs : element > < xs : element name = "response" > . . . add your code here . . . < / xs : element > < / xs : schema > < / types > < ! -- Abstract interfaces -- > < interface name = "CrunchifyItem" > < fault name = "ErrorDescription" element = "tns:response" / > < operation name = "Get" pattern = "http://www.w3.org/ns/wsdl/in-out" > < input messageLabel = "In" element = "tns:request" / > < output messageLabel = "Out" element = "tns:response" / > < / operation > < / interface > < ! -- Concrete Binding Over HTTP -- > < binding name = "HttpBinding" interface = "tns:CrunchifyItem" type = "http://www.w3.org/ns/wsdl/http" > < operation ref = "tns:Get" whttp : method = "GET" / > < / binding > < ! -- Concrete Binding with SOAP -- > < binding name = "SoapBinding" interface = "tns:CrunchifyItem" type = "http://www.w3.org/ns/wsdl/soap" wsoap : protocol = "http://www.w3.org/2003/05/soap/bindings/HTTP/" wsoap : mepDefault = "http://www.w3.org/2003/05/soap/mep/request-response" > < operation ref = "tns:Get" / > < / binding > < ! -- Web Service offering endpoints for both bindings -- > < service name = "ServiceOne" interface = "tns:CrunchifyItem" > < endpoint name = "HttpEndpoint" binding = "tns:HttpBinding" address = "http://www.example.com/rest/" / > < endpoint name = "SoapEndpoint" binding = "tns:SoapBinding" address = "http://crunchify.com/soap/" / > < / service > < / definitions > |
예제와 함께 설명된 팩토리 디자인 패턴.

질문이 있으면 알려주세요.