SOAP 메시지와 WSDL의 차이점은 무엇입니까?
SOAP 메시지와 WSDL이 어떻게 조화를 이루는 지 혼란 스럽습니까? 다음과 같은 SOAP 메시지를 조사하기 시작했습니다.
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
모든 SOAP 메시지는 WSDL입니까? SOAP는 자체 'SOAP 메시지'또는 'WSDL'을 허용하는 프로토콜입니까? 서로 다르면 언제 SOAP 메시지를 사용해야하며 언제 WSDL을 사용해야합니까?
이것에 대한 약간의 설명은 굉장 할 것입니다.
요청마다 SOAP 문서가 전송됩니다. 우리가 서점이고 특정 책의 현재 가격을 알아보기 위해 쿼리 한 원격 서버가 있다고 가정 해 보겠습니다. 책 제목, 페이지 수 및 ISBN 번호를 서버에 전달해야한다고 가정 해 보겠습니다.
가격을 알고 싶을 때마다 고유 한 SOAP 메시지를 보냅니다. 다음과 같이 보일 것입니다.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetBookPrice xmlns:m="http://namespaces.my-example-book-info.com">
<ISBN>978-0451524935</ISBN>
<Title>1984</Title>
<NumPages>328</NumPages>
</m:GetBookPrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
그리고 우리는 다음과 같은 SOAP 응답 메시지를 기대합니다.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetBookPriceResponse xmlns:m="http://namespaces.my-example-book-info.com">
<CurrentPrice>8.99</CurrentPrice>
<Currency>USD</Currency>
</m:GetBookPriceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
WSDL은 서버가이 메시지를 수신 할 때이 메시지를 처리 / 처리하는 방법을 설명합니다. 우리의 경우에는 제목, NumPages 및 ISBN의 유형, GetBookPrice 메시지에서 응답을 예상해야하는지 여부 및 해당 응답의 모양을 설명합니다.
유형은 다음과 같습니다.
<wsdl:types>
<!-- all type declarations are in a chunk of xsd -->
<xsd:schema targetNamespace="http://namespaces.my-example-book-info.com"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsd:element name="GetBookPrice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ISBN" type="string"/>
<xsd:element name="Title" type="string"/>
<xsd:element name="NumPages" type="integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetBookPriceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CurrentPrice" type="decimal" />
<xsd:element name="Currency" type="string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
그러나 WSDL에는 작업을 수행하기 위해 함께 연결되는 기능, 서비스에서 사용할 수있는 작업 및 서비스 / 작업에 액세스 할 수있는 네트워크의 위치에 대한 자세한 정보도 포함되어 있습니다.
W3 주석이 달린 WSDL 예제 도 참조하십시오.
SOAP 메시지는 데이터를 전송하는 데 사용되는 XML 문서입니다. WSDL은 웹 서비스에 연결하고 요청하는 방법을 설명하는 XML 문서입니다.
기본적으로 SOAP 메시지는 사용자가 전송하는 데이터이며 WSDL은 사용자가 수행 할 수있는 작업과 호출 방법을 알려줍니다.
A quick search in Google will yield many sources for additional reading (previous book link now dead, to combat this will put any new recommendations in comments)
Just noting your specific questions:
Are all SOAP messages WSDL's? No, they are not the same thing at all.
Is SOAP a protocol that accepts its own 'SOAP messages' or 'WSDL's? No - reading required as this is far off.
If they are different, then when should I use SOAP messages and when should I use WSDL's? Soap is structure you apply to your message/data for transfer. WSDLs are used only to determine how to make calls to the service in the first place. Often this is a one time thing when you first add code to make a call to a particular webservice.
A WSDL (Web Service Definition Language) is a meta-data file that describes the web service.
Things like operation name, parameters etc.
The soap messages are the actual payloads
We need to define what is a web service before telling what are the difference between the SOAP and WSDL where the two (SOAP and WSDL) are components of a web service
Most applications are developed to interact with users, the user enters or searches for data through an interface and the application then responds to the user's input.
A Web service does more or less the same thing except that a Web service application communicates only from machine to machine or application to application. There is often no direct user interaction.
A Web service basically is a collection of open protocols that is used to exchange data between applications. The use of open protocols enables Web services to be platform independent. Software that are written in different programming languages and that run on different platforms can use Web services to exchange data over computer networks such as the Internet. In other words, Windows applications can talk to PHP, Java and Perl applications and many others, which in normal circumstances would not be possible.
How Do Web Services Work?
Because different applications are written in different programming languages, they often cannot communicate with each other. A Web service enables this communication by using a combination of open protocols and standards, chiefly XML, SOAP and WSDL. A Web service uses XML to tag data, SOAP to transfer a message and finally WSDL to describe the availability of services. Let's take a look at these three main components of a Web service application.
Simple Object Access Protocol (SOAP)
The Simple Object Access Protocol or SOAP is a protocol for sending and receiving messages between applications without confronting interoperability issues (interoperability meaning the platform that a Web service is running on becomes irrelevant). Another protocol that has a similar function is HTTP. It is used to access Web pages or to surf the Net. HTTP ensures that you do not have to worry about what kind of Web server -- whether Apache or IIS or any other -- serves you the pages you are viewing or whether the pages you view were created in ASP.NET or HTML.
Because SOAP is used both for requesting and responding, its contents vary slightly depending on its purpose.
Below is an example of a SOAP request and response message
SOAP Request:
POST /InStock HTTP/1.1
Host: www.bookshop.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.bookshop.org/prices">
<m:GetBookPrice>
<m:BookName>The Fleamarket</m:BookName>
</m:GetBookPrice>
</soap:Body>
</soap:Envelope>
SOAP Response:
POST /InStock HTTP/1.1
Host: www.bookshop.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.bookshop.org/prices">
<m:GetBookPriceResponse>
<m: Price>10.95</m: Price>
</m:GetBookPriceResponse>
</soap:Body>
</soap:Envelope>
Although both messages look the same, they carry out different methods. For instance looking at the above examples you can see that the requesting message uses the GetBookPrice
method to get the book price. The response is carried out by the GetBookPriceResponse
method, which is going to be the message that you as the "requestor" will see. You can also see that the messages are composed using XML.
Web Services Description Language or WSDL
WSDL is a document that describes a Web service and also tells you how to access and use its methods.
WSDL takes care of how do you know what methods are available in a Web service that you stumble across on the Internet.
Take a look at a sample WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name ="DayOfWeek"
targetNamespace="http://www.roguewave.com/soapworx/examples/DayOfWeek.wsdl"
xmlns:tns="http://www.roguewave.com/soapworx/examples/DayOfWeek.wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="DayOfWeekInput">
<part name="date" type="xsd:date"/>
</message>
<message name="DayOfWeekResponse">
<part name="dayOfWeek" type="xsd:string"/>
</message>
<portType name="DayOfWeekPortType">
<operation name="GetDayOfWeek">
<input message="tns:DayOfWeekInput"/>
<output message="tns:DayOfWeekResponse"/>
</operation>
</portType>
<binding name="DayOfWeekBinding" type="tns:DayOfWeekPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetDayOfWeek">
<soap:operation soapAction="getdayofweek"/>
<input>
<soap:body use="encoded"
namespace="http://www.roguewave.com/soapworx/examples"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="http://www.roguewave.com/soapworx/examples"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="DayOfWeekService" >
<documentation>
Returns the day-of-week name for a given date
</documentation>
<port name="DayOfWeekPort" binding="tns:DayOfWeekBinding">
<soap:address location="http://localhost:8090/dayofweek/DayOfWeek"/>
</port>
</service>
</definitions>
The main things to remember about a WSDL file are that it provides you with:
Better analogy than the telephone call: Ordering products via postal mail from a mail-order service. The WSDL document is like the instructions that explain how to create the kind of order forms that the service provider will accept. A SOAP message is like an envelope with a standard design (size, shape, construction) that every post office around the world knows how to handle. You put your order form into such an envelope. The network (e.g. the internet) is the postal service. You put your envelope into the mail. The employees of the postal service do not look inside the envelope. The payload XML is the order form that you have enclosed in the envelope. After the post office delivers the envelope, the web service provider opens the envelope and processes the order form. If you have created and filled out the form correctly, they will mail the product that you ordered back to you.
In a simple terms if you have a web service of calculator. WSDL tells about the functions that you can implement or exposed to the client. For example: add, delete, subtract and so on. Where as using SOAP you actually perform actions like doDelete(), doSubtract(), doAdd(). So SOAP and WSDL are apples and oranges. We should not compare them. They both have their own different functionality.
SOAP : It's an open standard XML based Communication protocol which is used to exchange information from the user to web service or vice versa. The soap is just the document in which the data are organized in some Manner. For every request and response separate soap may be present.
WSDL: In soap the data are organized in some manner and this organization is specified in WSDL, The data type which has to be used are also specified here. For request and response single WSDL will be present
The WSDL is a kind of contract between API provider and the client it's describe the web service : the public function , optional/required field ...
But The soap message is a data transferred between client and provider (payload)
WSDL act as an interface between sender and receiver.
SOAP message is request and response in xml format.
comparing with java RMI
WSDL is the interface class
SOAP message is marshaled request and response message.
We can consider a telephone call In that Number is wsdl and exchange of information is soap.
WSDL is description how to connect with communication server.SOAP is have communication messages.
참고URL : https://stackoverflow.com/questions/14541066/difference-between-a-soap-message-and-a-wsdl
'Programming' 카테고리의 다른 글
* 문자 *로 너비 지정 (0) | 2020.08.17 |
---|---|
Spring RestTemplate 시간 초과 (0) | 2020.08.15 |
프로덕션에서 Rails 콘솔 실행 (0) | 2020.08.15 |
문자열에서 숫자를 추출하고 정수 배열을 얻는 방법은 무엇입니까? (0) | 2020.08.15 |
표준 C ++에서 모든 파일 / 디렉토리를 재귀 적으로 어떻게 반복합니까? (0) | 2020.08.15 |