SOAP Transport
The SOAP protocol is not tied to any transport protocol, the most popular transport protocol for sending SOAP messages back and forth is the HyperText Transfer Protocol or HTTP, but SOAP can be transported in any type of protocol, for instance: Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP), User Datagram Protocol (UDP), etc.
As mentioned before, the most commonly used transport protocol for sending SOAP messages is HTTP. So a SOAP request is sent using an HTTP request (either GET or POST) and a SOAP response is received via an HTTP response.
The following is an example of a SOAP request over an HTTP POST request:
POST http://localhost:8080/SOAPDemo/services/Demo.DemoHttpSoap11Endpoint/ HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "urn:returnMessage" Content-Length: 305 Host: localhost:8080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) <?xml version = '1.0' encoding = 'UTF-8'?> <soapenv:Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:goj = "http://goj.demo.com"> <soapenv:Header/> <soapenv:Body> <goj:returnMessage> <!-- Optional: --> <goj:name>John</goj:name> </goj:returnMessage> </soapenv:Body> </soapenv:Envelope>
The following is an example of a SOAP response over an HTTP response:
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Date: Sat, 16 Aug 2014 05:43:29 GMT <?xml version = '1.0' encoding = 'UTF-8'?> <soapenv:Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:returnMessageResponse xmlns:ns = "http://goj.demo.com"> <ns:return>Hello John</ns:return> </ns:returnMessageResponse> </soapenv:Body> </soapenv:Envelope>