Temel WSDL Yapısı Anlama - (Web Hizmeti Açıklama Dili) Açıklaması
Yayınlanan: 2020-08-24SOAP vs. REST çağrısı konusundaki önceki yazımı görmüş olabilirsiniz. Artık bir gün şirketler REST servis çağrılarına geçiyor, ancak hala şirketlerin çoğu REST yerine SOAP kullanıyor. Bu öğretici, WSDL'nin (Web Hizmeti Açıklama Dili) temellerini açıklar.
Aşağıdaki sorulardan herhangi birine sahipseniz doğru yerdesiniz:
- Web Hizmetleri Açıklama Dili (WSDL) nedir?
- WSDL Eğitimi
- Web Hizmetleri Açıklama Dili (WSDL) Açıklaması
- WSDL Örnekleri – Web Hizmeti Açıklama Dili
Web Hizmetleri Açıklama Dili (WSDL)
Java Web Geliştirme Dünyasında, WSDL, ağ hizmetlerini belge yönelimli veya prosedür yönelimli bilgiler içeren mesajlar üzerinde çalışan bir dizi uç nokta olarak tanımlayan bir XML biçimidir.
İşlemler ve mesajlar soyut olarak tanımlanır ve ardından bir uç noktayı tanımlamak için somut bir ağ protokolüne ve mesaj formatına bağlanır. İlgili somut uç noktalar, soyut uç noktalara (hizmetler) birleştirilir.
WSDL, iletişim kurmak için hangi mesaj biçimlerinin veya ağ protokollerinin kullanıldığına bakılmaksızın uç noktaların ve mesajlarının açıklamasına izin verecek şekilde genişletilebilir, ancak bu belgede açıklanan yalnızca bağlamalar, WSDL
SOAP 1.1, HTTP GET/POST ve HTTP GET/POST ile birlikte nasıl kullanılacağını açıklar. MIME.

Bir diğeri okumalı:
- Eclipse'de Örnek WSDL Oluşturun ve İstemci Oluşturun
- JAX-RS ve Jersey kullanarak Java ile RESTful Service nasıl oluşturulur (Örnek)
Başka bir deyişle: Bir WSDL belgesi, hizmetleri ağ uç noktaları veya ports
noktaları koleksiyonları olarak tanımlar. WSDL'de, uç noktaların ve mesajların soyut tanımı, somut ağ dağıtımlarından veya veri formatı bağlamalarından ayrılır. Bu, soyut tanımların yeniden kullanılmasına izin verir: değiş tokuş edilen verilerin soyut açıklamaları olan messages
ve soyut işlem koleksiyonları olan bağlantı noktası türleri.
Belirli bir bağlantı noktası türü için somut protokol ve veri biçimi belirtimleri, yeniden kullanılabilir bir binding
oluşturur. Bir bağlantı noktası, bir ağ adresini yeniden kullanılabilir bir bağlamayla ilişkilendirerek tanımlanır ve bir bağlantı noktası koleksiyonu bir hizmeti tanımlar.
Bu nedenle, bir WSDL belgesi, ağ hizmetlerinin tanımında aşağıdaki öğeleri kullanır:
-
Types
– bazı tür sistemleri (XSD
gibi) kullanan veri türü tanımları için bir kapsayıcı. -
Message
– iletilen verilerin soyut, yazılı tanımı. -
Operation
- hizmet tarafından desteklenen bir eylemin soyut bir açıklaması. -
Port Type
– bir veya daha fazla uç nokta tarafından desteklenen soyut bir işlemler kümesi. -
Binding
– belirli bir bağlantı noktası türü için somut bir protokol ve veri biçimi belirtimi. -
Port
noktası – bir bağlama ve bir ağ adresinin birleşimi olarak tanımlanan tek bir uç nokta. -
Service
– ilgili uç noktaların bir koleksiyonu.
eleman | Tanım |
---|---|
<türler> | Web hizmeti tarafından kullanılan (XML Şeması) veri türlerini tanımlar |
<mesaj> | Her işlem için veri öğelerini tanımlar |
<portType> | Gerçekleştirilebilecek işlemleri ve ilgili mesajları açıklar. |
<bağlayıcı> | Her bağlantı noktası türü için protokolü ve veri biçimini tanımlar |
Örnek: HTTP üzerinden SOAP 1.1 İstek/Yanıt
Örnek XML WSDL Belgesi.
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 Örneği:
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 > |
Fabrika Tasarım Deseni Örnek ile açıklanmıştır.

Herhangi bir sorunuz varsa bana bildirin.