SOAP Web Service Tutorials - Herong's Tutorial Examples - Version 5.02, by Dr. Herong Yang
Calling GetSpeech SOAP 1.2 Web Service
This section provides a tutorial example on how to run HttpURLConnectionGetSpeech12.java to call the GetSpeech SOAP 1.2 Web service provided by xmlme.com.
To use HttpURLConnectionGetSpeech12.java, I need a SOAP 1.1 request XML message. Here is one example, soap_1_1_GetSpeech_req.xml:
<?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>
Here is the execution result of HttpURLConnectionGetSpeech12.java:
\herong>java HttpURLConnectionGetSpeech12 http://www.xmlme.com/WSShakespeare.asmx soap_1_2_GetSpeech_req.xml res.xml Request length: 416 Response length: 725 \herong>type res.xml <?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 once. Of all the wonders that I yet have heard. It seems ...</SPEECH> </GetSpeechResult> </GetSpeechResponse> </soap:Body> </soap:Envelope>
Wonderful. My HttpURLConnectionGetSpeech12.java works perfectly too.
Last update: 2009.
Table of Contents
Introduction to SOAP (Simple Object Access Protocol)
SOAP Message Transmission and Processing
SOAP Message Exchange Patterns
Perl SOAP::Lite - SOAP Server-Client Communication Module
Perl Socket Test Program for HTTP and SOAP
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
PHP SOAP Extension Client Programs
PHP SOAP Extension Server Programs
►Java Socket and HttpURLConnection for SOAP
SocketRequestResponse.java - Socket Client Testing Program
SocketRequestResponseServer.java - Socket Server Testing Program
Capturing the HTTP Request from a Browser
"read(byteBuf) = -1" Not Working
Using java.net.HttpURLConnection to Send SOAP Messages
Using HttpURLConnection to Call GetSpeech SOAP 1.1
Capturing HTTP Request Generated by the HttpURLConnection Class
Calling GetSpeech SOAP 1.1 Web Service
Using HttpURLConnection to Call GetSpeech SOAP 1.2
►Calling GetSpeech SOAP 1.2 Web Service
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