SOAP Web Service Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
SOAP 1.2 Request and Response of GetTemp
This section provides a tutorial example on how to use SocketRequestResponseBinary.pl to send a SOAP 1.2 request for the GetTemp Web service provided by www.herongyang.com.
After finishing SOAP 1.1 test, I continued to use SocketRequestResponseBinary.pl to send a SOAP 1.2 request for the GetTemp Web service.
According to the WSDL document given at https://www.herongyang.com/Service/TemperatureService.wsdl, I prepared my first request sample, soap_1_2_GetTemp.req:
POST /Service/TemperatureService.php HTTP/1.1 Host: www.herongyang.com Connection: Keep-Alive Content-Type: text/xml; charset=utf-8 Content-Length: 240 <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns="https://www.herongyang.com/Service"> <env:Body> <getTemp> <p>12345</p> </getTemp> </env:Body> </env:Envelope>
I carefully counted the number of bytes of the request content including the last \r\n and entered 416 in the Content-Length header line.
Here is the test result of my sample SOAP 1.2 request:
herong> perl SocketRequestResponseBinary.pl www.herongyang.com 80 \ soap_1_2_GetTemp.req soap_1_2.res herong> more soap_1_2.res HTTP/1.1 200 OK X-Powered-By: PHP/7.0.2 Content-Length: 558 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/soap+xml; charset=utf-8 <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:xmethods-Temperature-Demo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"> <ns1:getTempResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <rpc:result>return</rpc:result> <return xsi:type="xsd:float">57.5</return> </ns1:getTempResponse> </env:Body> </env:Envelope>
Very nice again. My first SOAP 1.2 test with SocketRequestResponseBinary.pl worked correctly.
The SOAP response message received as a single line without any line breaks. I reformatted it before including it here.
Table of Contents
Introduction to SOAP (Simple Object Access Protocol)
SOAP Message Transmission and Processing
SOAP MEP (Message Exchange Patterns)
PHP SOAP Extension Client Programs
PHP SOAP Extension Server Programs
PHP SOAP Web Service Example - getTemp
Perl SOAP::Lite - SOAP Server-Client Communication Module
►Perl Socket Test Program for HTTP and SOAP
SocketRequestResponse.pl - Socket Level Testing Program
Examples of HTTP 1.0 Requests and Responses
Examples of HTTP 1.1 Requests and Responses
SOAP 1.1 Request - Content-Length Too Small
SOAP 1.1 Request - Content-Length Too Large
SOAP 1.1 Request and Response of GetTemp
►SOAP 1.2 Request and Response of GetTemp
Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service
Perl SOAP::Lite for SOAP 1.2 Web Services
Java Socket and HttpURLConnection for SOAP
SAAJ - SOAP with Attachments API for Java
SoapUI - SOAP Web Service Testing Tool
WS-Security - SOAP Message Security Extension
WS-Security X.509 Certificate Token
Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service
Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services
Perl SOAP::Lite 0.710 for WSDL