SEARCH
Newsletter
Subscribe to get design tips, latest trends, free stuff and more.
It doesn't look like an e-mail address

hosting

  Web Programming PHP What is SOAP?

What is SOAP?

X2 Studios PHP Sep 27, 2006

What is SOAP: Simple Object Access Protocol Introduction As stated in the W3C Document which can be found at http://www.w3.org/TR/2001/WD-soap12-20010709/: SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment.

It is an XML based protocol that consists of four parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined data types, a convention for representing remote procedure calls and responses and a binding convention for exchanging messages using an underlying protocol. SOAP can potentially be used in combination with a variety of other protocols; however, the only bindings defined in this document describe how to use SOAP in combination with HTTP and the experimental HTTP Extension Framework. XML SOAP uses XML for transmitting data. A typical SOAP 'session' looks something like this:

Accept: text/ xml Accept: multipart/* Content-Length: 509 Content-Type: text/ xml; charset= utf-8 SOAPAction: "World# GoodByeWorld" <? xml version=" 1.0" encoding=" UTF-8"?>< SOAP-ENV: Envelope xmlns: SOAP-ENC=" http:// schemas. xmlsoap. org/ soap/ encoding/" SOAP-ENV: encodingStyle=" http:// schemas. xmlsoap. org/ soap/ encoding/ " xmlns: SOAP-ENV=" http:// schemas. xmlsoap. org/ soap/ envelope/" xmlns: xsi=" http:// www. w3. org/ 1999/ XMLSchema-instance" xmlns: xsd=" http:// www. w3. org/ 1999/ XMLSchema">< SOAP-ENV: Body>< namesp1: GoodByeWorld xmlns: namesp1=" World">< c-gensym3 xsi: type=" xsd: string"> sweet</ c-gensym3></ namesp1: GoodByeWorld></ SOAP-ENV: Body></ SOAP-ENV: Envelope> SOAP:: Transport:: HTTP:: Client:: send_ receive: HTTP:: Response= HASH( 0x84cd88c)

SOAP:: Transport:: HTTP:: Client:: send_ receive: HTTP/ 1.1 200 OK Connection: close Date: Mon, 25 Feb 2002 20: 35: 37 GMT Server: Apache/ 1.3.22 (Unix) (Red-Hat/ Linux) mod_ python/ 2.7.6 Python/ 1.5.2 mod_ ssl/ 2.8.5 OpenSSL/ 0.9.6b DAV/ 1.0.2 PHP/ 4.0.6 mod_ perl/ 1.24_ 01 Content-Length: 539 Content-Type: text/ xml; charset= utf-8 Client-Date: Mon, 25 Feb 2002 20: 35: 37 GMT Client-Response-Num: 1 SOAPServer: SOAP:: Lite/ Perl/ 0.5 <? xml version=" 1.0" encoding=" UTF-8"?>< SOAP-ENV: Envelope xmlns: SOAP-ENC=" http:// schemas. xmlsoap. org/ soap/ encoding/" SOAP-ENV: encodingStyle=" http:// schemas. xmlsoap. org/ soap/ encoding/ " xmlns: SOAP-ENV=" http:// schemas. xmlsoap. org/ soap/ envelope/" xmlns: xsi=" http:// www. w3. org/ 1999/ XMLSchema-instance" xmlns: xsd=" http:// www. w3. org/ 1999/ XMLSchema">< SOAP-ENV: Body>< namesp1: GoodByeWorldResponse xmlns: namesp1=" World">< s-gensym9 xsi: type=" xsd: string"> Goodbye sweet World</ s-gensym9></ namesp1: GoodByeWorldResponse></ SOAP-ENV: Body></ SOAP-ENV: Envelope>

Why use soap? I think that is a very easy question to answer. SOAP is a SIMPLE way to allow programs written is different languages running on different computers to communicate and share data. After all communication is what the internet is all about. XML-RPC can do what you showed above.

So again why SOAP? Well XML-RPC is a great way to transmit simple data as shown in the above sample. However, SOAP allows Objects to be used. These days most people are working in object oriented languages and know the power of using Objects. SOAP allows you to harness that power in your web applications.

subscribe to newsletter