Translation-web Service profiling: platform-independent data exchange using XML, SOAP and WSDL

Source: Internet
Author: User
Tags soap wsdl

Most applications is developed to interact with users; The user enters or searches for data through a interface and the application then responds to the user ' s input. A Web Service does more or less the same thing except this a Web service application communicates only from machine to Mac Hine or application to application. There is often no direct user interaction. A Web service basically is a collection of open protocols which is used to exchange data between applications. The use of open protocols enables WEB services to be platform independent. Software that is written in different programming languages and so run on different platforms can use WEB services to E Xchange 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 circumst Ances would not being possible.

How does Web Services work?

Because different applications is written in different programming languages, they often cannot communicate with each oth Er. A Web Service enables this communication by using a combination of open protocols and standards, chiefly XML, SOAP and WSD L. 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 the 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 CO Nfronting Interoperability issues (interoperability meaning the platform that a WEB service was running on becomes Irreleva NT). Another protocol that have a similar function is HTTP. It is used to access Web pages or to surf the Net. HTTP ensures that you don't have to worry about what kind of the WEB server--whether Apache or IIS or any other--Serves Y OU the pages are viewing or whether the pages of your view were created in ASP. 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:envelopeXmlns:soap= "Http://www.w3.org/2001/12/soap-envelope"Soap:encodingstyle= "Http://www.w3.org/2001/12/soap-encoding">    <Soap:bodyxmlns: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:envelopeXmlns:soap= "Http://www.w3.org/2001/12/soap-envelope"Soap:encodingstyle= "Http://www.w3.org/2001/12/soap-encoding">    <Soap:bodyxmlns:m= "Http://www.bookshop.org/prices">        <M:getbookpriceresponse>            <m: Price="">10.95</m:>        </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 P Rice. The response is carried off getbookpriceResponse by the method, which was going to being the message that you as the "requestor" would see. You can also see that the messages is composed using XML.

Web Services Description Language or WSDL

How does you know what methods is available in a WEB service so stumble across on the Internet? Well, the WSDL takes care of. WSDL is a document, a describes a Web service and also tells you the access and use of its methods. Take a look at a sample WSDL file:

<?XML version= "1.0" encoding= "Utf-8"?><Definitionsname= "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/"><messagename= "Dayofweekinput">    < Partname= "Date"type= "Xsd:date" /></message><messagename= "Dayofweekresponse">    < Partname= "DayOfWeek"type= "Xsd:string" /></message><PortTypename= "Dayofweekporttype">    <Operationname= "GetDayOfWeek">        <inputmessage= "Tns:dayofweekinput" />        <Outputmessage= "Tns:dayofweekresponse" />    </Operation></PortType><bindingname= "Dayofweekbinding"type= "Tns:dayofweekporttype">    <soap:bindingstyle= "Document"Transport= "Http://schemas.xmlsoap.org/soap/http" />    <Operationname= "GetDayOfWeek">        <soap:operationSOAPAction= "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><Servicename= "Dayofweekservice"><Documentation>Returns the Day-of-week name for a given date 40</Documentation> A<Portname= "Dayofweekport"binding= "Tns:dayofweekbinding"> the<soap:address Location= "Http://localhost:8090/dayofweek/DayOfWeek" />43</Port>44</Service>45</Definitions>

The main things to remember about a WSDL file is that it provides you with:

    • A description of a WEB service
    • The methods a WEB service uses and the parameters that it takes
    • A-To locate Web services

In the original text see:

Anatomy of a Web service:xml, SOAP and WSDL for platform-independent Data Exchange

Translation-web Service profiling: platform-independent data exchange using XML, SOAP and WSDL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.