SOAP Web Service Tutorials - Herong's Tutorial Examples
By Herong Yang
()
About this ebook
For latest updates and free sample chapters, visit https://www.herongyang.com/Web-Services.
Read more from Herong Yang
WSDL Tutorials - Herong's Tutorial Examples Rating: 0 out of 5 stars0 ratingsJava Tools Tutorials - Herong's Tutorial Examples Rating: 0 out of 5 stars0 ratings
Related to SOAP Web Service Tutorials - Herong's Tutorial Examples
Internet & Web For You
No Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsTor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsSix Figure Blogging Blueprint Rating: 5 out of 5 stars5/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Coding For Dummies Rating: 5 out of 5 stars5/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5How To Make Money Blogging: How I Replaced My Day-Job With My Blog and How You Can Start A Blog Today Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Introduction to Internet Scams and Fraud: Credit Card Theft, Work-At-Home Scams and Lottery Scams Rating: 4 out of 5 stars4/5The Mega Box: The Ultimate Guide to the Best Free Resources on the Internet Rating: 4 out of 5 stars4/5Wireless Hacking 101 Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5The Anatomy of the Swipe: Making Money Move Rating: 5 out of 5 stars5/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5
Reviews for SOAP Web Service Tutorials - Herong's Tutorial Examples
0 ratings0 reviews
Book preview
SOAP Web Service Tutorials - Herong's Tutorial Examples - Herong Yang
SOAP Web Service Tutorials
- Herong's Tutorial Examples
Iconv5.13, 2024
Herong Yang
Copyright © 2002-2024 Herong Yang. All rights reserved.
ISBN: 978-0-359-10766-7
This book is a collection of notes and sample codes written by the author while he was learning SOAP Web service. Topics include introduction of SOAP specifications; SOAP modules, features, and message structure; SOAP Message Exchange Patterns; Python, Perl, PHP, and Java support of SOAP Web services; WS-Security, Username Token and X.509 Token; Signing and Encrypting SOAP messages; Using SoapUI for Web service testing. Updated in 2024 (Version v5.13) with Python tutorials.
Table of Contents
About This Book
Introduction to Web Service
What Is a Web Service
Web Service Related Technologies
Introduction to SOAP (Simple Object Access Protocol)
What Is SOAP
SOAP Communication Example
SOAP Message Structure
SOAP Generic Message Structure
SOAP Fault Message Structure
SOAP Message Transmission and Processing
SOAP Protocol Binding
SOAP Distributed Processing Model
SOAP Features and Modules
SOAP Data Model
SOAP Encoding
What Is SOAP Encoding
Multiple References and Circular References
Node Types - simple, struct, array
SOAP Encoding Attributes and Namespace
Using SOAP Encoding in SOAP Messages
SOAP RPC Presentation
What Is SOAP RPC Presentation
Using Web Methods to Invoke RPC
Using SOAP Messages to Invoke RPC
RPC Response Messages
SOAP Properties Model
SOAP MEP (Message Exchange Patterns)
What Are SOAP Message Exchange Patterns
Request-Response Message Exchange Pattern
Response Message Exchange Pattern
Web Method Feature
SOAP Action Feature
SOAP HTTP Binding
SOAP PHP Implementations
SOAP PHP Implementations: PEAR::Package::SOAP and NuSOAP
PHP 7.0.2 by The PHP Group
What Is PHP SOAP Extension
Installing SOAP Extension on Windows
PHP SOAP Extension Client Programs
PHP SOAP Extension Functions for Client Programs
Calling WSDL Operation Directly
Call WSDL Operation with SoapClient::__soapCall()
Dumping SOAP Request and Response
Call WSDL Operation with SoapClient::__doRequest()
PHP SOAP Extension Server Programs
PHP SOAP Extension Functions for Server Programs
HelloServer.php - First SOAP Server Application
HelloServer12.php - SOAP 1.2 Server Application
HelloServerWsdl.php - SOAP 1.2 Server in WSDL Mode
HelloServerWsdl2.php - SOAP 1.1/1.2 Server in WSDL Mode
PHP SOAP Web Service Example - getTemp
TemperatureService.wsdl - getTemp WSDL Document
TemperatureService.php - getTemp Server Programs
GetTemp.php - getTemp Client Program
GetTempDump.php - Dumping Debugging Information
GetTempNonWsdl.php - Using non-WDSL Mode
GetTemp12.php - SOAP 1.2 Client Example
GetTempDoRequest12.php - SOAP 1.2 Client Example
SOAP Perl Implementations
SOAP Perl Implementation - SOAP::Lite
Installing ActivePerl Latest Version on Windows
Installing SOAP::Lite Package
Perl SOAP::Lite - SOAP Server-Client Communication Module
SOAP Communication Model
What Is SOAP::Lite
SOAP::Transport::TCP::Server - SOAP Server with TCP Protocol
SoapTcpClient.pl - SOAP Client Example with TCP Protocol
SOAP::Lite Tracing Functions
SOAP::Transport::HTTP - SOAP Server with HTTP Protocol
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
NumberToWords Failed - Unexpected Parameter c-gensym3
NumberToWords Failed - Invalid namespace
NumberToWords Worked - Setting Namespace and Parameter
Perl SOAP::Lite for SOAP 1.2 Web Services
Message Styles Supported in SOAP::Lite
Methods on SOAP::Lite Client Object
Testing SOAP::Lite Client Objects
Differences between SOAP 1.1 and SOAP 1.2
NumberToWords_localhost.pl - Testing on Local Host
soapversion('1.2') and envprefix('soap12') Must Used Together
default_ns() - Setting Namespace for Body Elements
SOAP::Data - Utility Class to Generate XML Elements
SOAPAction - Not Needed, But No Way to Remove It
NumberToWords_SOAP_1_2.pl - SOAP::Lite for SOAP 1.2 Web Service
Perl SOAP::Lite for WSDL
First WSDL Test Worked with SOAP::Lite
Using SOAP 1.2 with SOAP::Lite in WSDL Mode
Python SOAP Client: Zeep
What Is Zeep Python Library
Installing Python Engine on macOS
Installing Zeep Library
Parsing WSDL Documents with Zeep Library
Invoking WSDL Services with Zeep Library
Invoking WSDL Default Service
Dump SOAP Request and Response Messages
WSDL 2.0 Not Supported by Zeep Library
SOAP Java Implementations
What Is SAAJ (SOAP with Attachments API for Java)
SOAP Java Implementations: Axis and Apache WebService
Axis Installation Requirements on Windows
Installing Axis 1.2.1 on Windows
Installing JAF 1.0.2
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 SOAP 1.1
Capturing HTTP Request Generated by the HttpURLConnection Class
Calling NumberToWords SOAP 1.1 Web Service
Using HttpURLConnection to Call SOAP 1.2
Calling NumberToWords SOAP 1.2 Web Service
SAAJ - SOAP with Attachments API for Java
SAAJ API Classes and Interfaces Overview
SAAJ API and Default Implementation in JDK
Check SAAJ API Version in JDK
SAAJ API Reference Implementation
First SOAPConnection Test Program
Creating SOAPConnection and SOAPMessage Objects
SAAJ SOAPMessage Structure and Classes/Interfaces
Populating the SOAP Body with Request XML Elements
Don't Use xml* as namespace Prefix
addHeader() - Setting SOAPAction Header Line
Calling NumberToWords SOAP 1.1 with SAAJ
SOAPConstants.SOAP_1_2_PROTOCOL
Calling NumberToWords SOAP 1.2 with SAAJ
SoapUI - SOAP Web Service Testing Tool
What Is SoapUI
Downloading and Installing SoapUI
Validating and Inspecting WSDL Documents
Using Interface Viewer on Bindings
Generating SOAP Test Request
Submitting SOAP Test Requests to Server
WS-Security - SOAP Message Security Extension
What Is WS-Security (WSS)
Using XML Signature and Encryption with WSS
SOAP Header Element Security
What Is WS-Security Username Token Profile
SoapUI Configuration for Username Token
Generating Username Token with SoapUI
Validating wsse:Password Digest String
Password Digest Validation Program
WS-Security X.509 Certificate Token
What Is WS-Security X.509 Certificate Token Profile
What Is XML Signature Syntax and Processing
Generating a Self-Signed Certificate with keytool
SoapUI Configuration for Messaging Signing
Generating Digital Signature with SoapUI
Validating ds:Signature with X.509 Certificate
Digital Signature Options Supported in SoapUI
What Is XML Encryption Syntax and Processing
SoapUI Configuration for Messaging Encryption
not an RSA key
- Encryption Failed in SoapUI
Encryption using RSA Public Key with SoapUI
2-Step Message Encryption - Symmetric and RSA
Decrypting Encrypted SOAP Message
Message Encryption Options Supported in SoapUI
Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service
GetSpeech Failed - Incorrect SOAPAction Header Line
GetSpeech Failed - Incorrect Parameter Name c-gensym
Using Socket Program to Request Parameter Name
GetSpeech Worked - Using SOAP::Data Class and on_action() Function
GetSpeech_SOAP_1_1.pl - SOAP::Lite for SOAP 1.1 Web Service
Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services
Installing SOAP::Lite 0.710 to Support SOAP 1.2
GetSpeech Request Differences between SOAP 1.1 and 1.2
Unsupported Media Type: application/soap
DEFAULT_HTTP_CONTENT_TYPE='application/soap+xml'
content_type() method in the HTTP::Headers Class
Perl SOAP::Lite 0.710 for WSDL
First WSDL Test Failed with SOAP::Lite
Downloading and Editing WSDL Document
Testing service() Function Locally
soapversion('1.2') Sets Correct Envelope namespace
Error: Object reference not set to an instance of an object
Web Services and SOAP Terminology
Archived Tutorials
Archived SOAP::Lite 0.55 in ActivePerl 5.8.7
Archived: SOAP 1.1 Request - Content-Length Too Small
Archived: SOAP 1.1 Request - Content-Length Too Large
Archived: SOAP 1.1 Request and Response of GetSpeech
Archived: SOAP 1.2 Request and Response of GetSpeech
Archived: Calling GetSpeech SOAP 1.1 with SAAJ
Archived: Calling GetSpeech SOAP 1.2 with SAAJ
References
Keywords: SOAP, UDDI, WSDL, Web service
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ About This Book
This section provides some detailed information about this book - SOAP Web Service Tutorials - Herong's Tutorial Examples.
Title: SOAP Web Service Tutorials - Herong's Tutorial Examples
Author: Herong Yang - Contact by email via herong_yang@yahoo.com.
Category: COMPUTERS / Web / Web Services & API
Version/Edition: v5.13, 2024
Number of pages in PDF format: 374
Description: This book is a collection of notes and sample codes written by the author while he was learning SOAP Web service. Topics include introduction of SOAP specifications; SOAP modules, features, and message structure; SOAP Message Exchange Patterns; Python, Perl, PHP, and Java support of SOAP Web services; WS-Security, Username Token and X.509 Token; Signing and Encrypting SOAP messages; Using SoapUI for Web service testing. Updated in 2024 (Version v5.13) with Python tutorials.
Keywords: SOAP, Web Service, WSDL, Java, Perl, PHP, Python, WS-Security
Copyright:
This book is under Copyright Copyright © 2002-2024 Herong Yang. All rights reserved.
Material in this book may not be published, broadcasted, rewritten or redistributed in any form.
Code examples are provided as-is, with no warranty of any kind.
Revision history:
Version v5.13, 2024. Added Python tutorials
Version 5.00, 2014. Added WS security tutorials
Version 4.00, 2009. Added SOAP 1.2 tutorials
Version 3.00, 2007. Added PHP tutorials
Version 2.00, 2005. Added Java tutorials
Version 1.00, 2002. First edition
Web version: https://www.herongyang.com/Web-Services - Provides free sample chapters, latest updates and readers' comments. The Web version of this book has been viewed a total of:
1,794,296 times as of December 2023.
1,806,290 times as of December 2022.
1,727,805 times as of December 2021.
1,616,128 times as of December 2020.
1,505,315 times as of December 2019.
1,383,916 times as of December 2018.
1,284,009 times as of December 2017.
1,156,628 times as of December 2016.
1,006,080 times as of December 2015.
822,411 times as of December 2014.
641,658 times as of December 2013.
516,742 times as of December 2012.
374,134 times as of December 2011.
247,146 times as of December 2010.
142,958 times as of December 2009.
109,856 times as of July 2008.
PDF/EPUB version: https://www.herongyang.com/Web-Services/PDF-Full-Version.html - Provides information on how to obtain the full version of this book in PDF, EPUB, or other format.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to Web Service
This chapter provides a quick introduction on Web services and related technologies: SOAP, UDDI, WSDL, HTTP, and XML.
What Is a Web Service
Web Service Related Technologies
Takeaways:
A Web Service is an application programming service that can be accessed remotely via standard Internet protocols using XML as the data format.
There are several technologies related to Web Service: SOAP, UDDI, WSDL, HTTP, and XML.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to Web Service
∟ What Is a Web Service
This section describes what is a Web service.
What Is Web Service? A Web Service is an application programming service that can be accessed remotely via standard Internet protocols using XML as the data format.
Key elements in this definition:
A Web service is a programming service, not an end user service
A Web service is designed to be used remotely.
A Web service is accessible via standard Internet protocols, ex. HTTP.
A Web service communicates data in XML format.
Benefits of using Web services:
Easier to integrate applications together.
Services re-usable.
Making application flexible to meeting constantly changing business needs.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to Web Service
∟ Web Service Related Technologies
This section describes a list of technologies that related to Web services.
There are several technologies that are related to Web services:
UDDI (Universal Description, Discovery and Integration) - A server acting like a Web service directory. Web services can be registered and discovered on a UDDI server.
WSDL (Web Services Description Language) - An XML based language to describe a Web service.
SOAP (Simple Object Access Protocol) - An XML based protocol used to define requests and responses for a Web service.
HTTP (Hyper-Text Transport Protocol) - An Internet communication protocol used by the World Wild Web system. HTTP are used to deliver Web service requests and responses.
XML (eXtensible Markup Language) - A markup language used to organize information in clear text format.
The following diagram is an illustration of how these technologies are used to deliver a Web service from a provider to a consumer:
Query for a service
Web service <-----------------------------------------> UDDI server
consumer Return provider location |
|
|
Query for the service description v
Web service <-----------------------------------------> WSDL document
consumer Return service description server
|
|
Send service request (SOAP + HTTP) v
Web service <-----------------------------------------> Web Service
consumer Return service response (SOAP + HTTP) provider
As you can see from this diagram, UDDI and WSDL are really optional. If you know the location and the description of a Web service, you don't need to query the UDDI server and fetch the WSDL document. All you need to do is to build a request in SOAP format, and sent it via HTTP to the provider.
Since HTTP is a very old protocol, I will not discuss it in this book.
Most of the notes in this book will be on SOAP, because it is the key technology of Web services.
Of course, some of the notes will be on UDDI and WSDL.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to SOAP (Simple Object Access Protocol)
This chapter provides a quick introduction to SOAP (Simple Object Access Protocol).
What Is SOAP
SOAP Communication Example
Takeaways:
SOAP is an XML based protocol intended for exchanging structured information in a distributed application environment.
A SOAP message can be delivered with HTTP or SMTP protocol.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to SOAP (Simple Object Access Protocol)
∟ What Is SOAP
This section provides a quick summary of SOAP protocol.
What Is SOAP (Simple Object Access Protocol)? SOAP is an XML based protocol intended for exchanging structured information in a distributed application environment. Visit https://www.w3.org/TR/soap/ for more information.
There are 2 versions of SOAP specifications as of today:
Version Release Date Namespace
SOAP 1.2 April 27, 2007 http://www.w3.org/2003/05/soap-envelope
SOAP 1.1 May 8, 2000 http://schemas.xmlsoap.org/soap/envelope/
SOAP 1.2 specification is divided into two parts.
SOAP part 1 defines the SOAP messaging framework, which contains the following key concepts:
SOAP Message Construct - How a SOAP message should be constructed.
SOAP Protocol Binding Framework - How a SOAP message should be bound a communication protocol to carry it from the sender to the receiver.
SOAP Processing Model - How a SOAP message should be processed by SOAP receivers.
SOAP Extensibility Model - How SOAP can be extended to add SOAP features and SOAP modules.
SOAP part 2 defines a set of adjuncts that can be used to extend the SOAP messaging framework:
SOAP Data Model - How data structures and values should be represented as a graph of nodes.
SOAP Encoding - How data presented in SOAP Data Model should be encoded as XML data.
SOAP RPC Presentation - How Remote Procedure Call (RPC) should be modeled with SOAP.
SOAP Convention for Describing Features and Bindings - How SOAP Features and Bindings should be described.
SOAP Supplied Features - Commonly used SOAP extensions.
SOAP HTTP Binding - How a SOAP message is bound to HTTP.
SOAP is actually a communication protocol that defines how a message should be constructed, transmitted from one node to another, and processed by each node as shown in the following diagram:
SOAP node
|
| Construct an initial SOAP message
| Bind the initial message for transmission
| Transmit the initial message
v
----------> SOAP node
|
| Receive the initial message
| Process some part of the initial message
| Reconstruct an intermediate SOAP message
| Bind the intermediate message for transmission
| Transmit the intermediate message
v
----------> SOAP node
|
| ...
v
----------> SOAP node
|
| Receive the final message
| Process the final message
v
Done
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ Introduction to SOAP (Simple Object Access Protocol)
∟ SOAP Communication Example
This section describes an simple example of SOAP communication.
Before going into details of the SOAP specification, let's try a very simple SOAP example. There are 3 basic steps involved in a SOAP communication:
1. Creating a SOAP message. This is easy. Just use any text editor to enter the following SOAP message, hello.msg:
2. Transmitting the message from a SOAP node, my machine, to another SOAP node, your machine. A simple way to do this is for me to send hello.msg to you as an email, so you will get something like this:
From: herong@my.com
To: you@your.com
Subject: Greeting
3. Processing the message. Once you got my SOAP message, you should be able to read it, and do whatever you want to do with it.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ SOAP Message Structure
This chapter provides descriptions of SOAP message structures and sample messages.
SOAP Generic Message Structure
SOAP Fault Message Structure
Takeaways:
A SOAP message is an XML document with an Envelope
root element, and two child elements: Header
and Body
.
A SOAP fault message is a SOAP message designed to deliver error messages.
SOAP Web Service Tutorials - Herong's Tutorial Examples
∟ SOAP Message Structure
∟ SOAP Generic Message Structure
This section provides a description of the SOAP generic message structure and a sample