SoapServer - SOAP Server Class and Functions

This section describes the SoapServer class and functions provided in the SOAP extension library for writing SOAP server application.

If you read the SOAP Extension reference page, you will see that SOAP Extension support SOAP server applications with a class called SoapServer, which offers the following functions:

SoapServer->__construct() allows you to construct a new SoapServer object with the following syntax:

   __construct ( mixed wsdl [, array options] );

where "wsdl" specifies the URL of the WSDL document, and "options" specifies a list of options:

   'uri'          => "...", # the name space of the SOAP service
   'soap_version' => SOAP_1_1 |SOAP_1_2,
   'actor'        => "...", # the actor
   'encoding'     => "...", # the encoding name
   'classmap'     => "...", # a map of WSDL types to PHP classes
   ... 

Note that SoapServer object can be constructed in two modes, WSDL mode and non-WSDL mode:

   __construct( "..."[, array options] ); # WSDL mode, many options
      # are provided by the WSDL document
   __construct( null, array options ); # non-WSDL mode, 
      # 'uri' is a required option.

SoapServer->addFunction() allows you to add one or more functions to handle SOAP requests. The functions to be added are functions defined in the current PHP program file.

   $obj->addFunction("func"); # adds one function
   $obj->addFunction(array("func1",...)); # adds many functions
   $obj->addFunction(SOAP_FUNCTIONS_ALL); # adds all functions

SoapServer->setClass() allows you to call methods in the specified class to handle SOAP requests.

   $obj->setClass("cls");

SoapServer->handle() allows you to return the execution back the SOAP Extension to handle the incoming SOAP request.

   $obj->handle();

SoapServer->getFunctions() allows you to get a list of all functions that have been assigned to handle SOAP requests.

   array $a = $obj->getFunctions();

Last update: 2019.

Table of Contents

 About This Book

 Introduction and Installation of PHP 7.3

 PHP Script File Syntax

 PHP Data Types and Data Literals

 Variables, References, and Constants

 Expressions, Operations and Type Conversions

 Conditional Statements - "if" and "switch"

 Loop Statements - "while", "for", and "do ... while"

 Function Declaration, Arguments, and Return Values

 Arrays - Ordered Maps

 Introduction of Class and Object

 Integrating PHP with Apache Web Server

 Retrieving Information from HTTP Requests

 Creating and Managing Sessions in PHP Scripts

 Sending and Receiving Cookies in PHP Scripts

 Controlling HTTP Response Header Lines in PHP Scripts

 MySQL Server Connection and Access Functions

 Functions to Manage Directories, Files and Images

 SOAP Extension Function and Calling Web Services

SOAP Server Functions and Examples

SoapServer - SOAP Server Class and Functions

 HelloServer.php - First SOAP Server Application

 HelloServer12.php - First SOAP 1.2 Server Application

 HelloServerWsdl.php - SOAP 1.2 Server Application in WSDL Mode

 Localization Overview of Web Applications

 Using Non-ASCII Characters in HTML Documents

 Using Non-ASCII Characters as PHP Script String Literals

 Receiving Non-ASCII Characters from Input Forms

 "mbstring" Extension and Non-ASCII Encoding Management

 Managing Non-ASCII Character Strings with MySQL Servers

 Configuring and Sending out Emails

 Outdated Tutorials

 References

 Full Version in PDF/EPUB