SOAP Web Service Tutorials - Herong's Tutorial Examples - Version 5.02, by Dr. Herong Yang
SOAP 1.2 Request and Response of GetSpeech
This section provides a tutorial example on how to use SocketRequestResponse.pl to send a SOAP 1.1 request for the GetSpeech Web service provided by www.xmlme.com. The response of GetSpeech received looks very nice.
After finishing SOAP 1.1 test, I continued to use SocketRequestResponseBinary.pl to send a SOAP 1.2 request for the GetSpeech Web service.
According to the instructions given at http://www.xmlme.com/WSShakespeare.asmx?op=GetSpeech, I prepared by first request sample, soap_1_2_GetSpeech.req:
POST /WSShakespeare.asmx HTTP/1.1 Host: www.xmlme.com Content-Type: application/soap+xml; charset=utf-8 Content-Length: 416 <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetSpeech xmlns="http://xmlme.com/WebServices"> <Request>Cowards die many times before their deaths</Request> </GetSpeech> </soap12:Body> </soap12: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>SocketRequestResponseBinary.pl www.xmlme.com 80 soap_1_2_GetSpeech.req soap_1_2.res \herong>type soap_1_2.res HTTP/1.1 200 OK Connection: close Date: ... 2009 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: application/soap+xml; charset=utf-8 Content-Length: 725 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetSpeechResponse xmlns="http://xmlme.com/WebServices"> <GetSpeechResult> <SPEECH><PLAY>JULIUS CAESAR</PLAY> <SPEAKER>CAESAR</SPEAKER>Cowards die many times before their deaths; The valiant never taste of death but ...</SPEECH> </GetSpeechResult> </GetSpeechResponse> </soap:Body> </soap: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 inludeding it here.
Last update: 2009.
Table of Contents