SoapClient - SOAP Client Class and Functions

This section describes the SoapClient class and functions provided in the SOAP extension library for writing SOAP client application. __soapCall() allows you to make a RPC function call on the target SOAP node.

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

SoapClient->__construct() allows you to construct a new SoapClient 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:

   'location'     => "...", # the URL where to send the request
   'uri'          => "...", # the name space of the SOAP service
   'soap_version' => SOAP_1_1 | SOAP_1_2,
   'trace'        => 0 | 1,
   ... 

Note that SoapClient 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, 'location'
      # and 'uri' are required options. 

SoapClient->__getFunctions() allows you to get a list of functions supported by the target node. This function is only valid in WSDL mode:

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

SoapClient->__soapCall() allows you to make a RPC function call on the target SOAP node.

   $obj->__soapCall(string func_name[, array arguments [, ...]]);

Note that in WSDL mode, you can also make a RPC call as a local method on the SoapClient object:

   $obj->func_name(arg1, arg2, ...);

SoapClient->__getLastRequestHeaders() allows you to retrieve the HTTP request header lines of the last SOAP request executed. This function works only if the SoapClient object was created with the option of "trace=1".

   string $s = $obj->__getLastRequestHeaders();

SoapClient->__getLastRequest() allows you to retrieve SOAP request message of the last SOAP request executed. This function works only if the SoapClient object was created with the option of "trace=1".

   string $s = $obj->__getLastRequest();

SoapClient->__getLastResponseHeaders() allows you to retrieve the HTTP response header lines of the last SOAP request executed. This function works only if the SoapClient object was created with the option of "trace=1".

   string $s = $obj->__getLastRequestHeaders();

SoapClient->__getLastResponse() allows you to retrieve SOAP response message of the last SOAP request executed. This function works only if the SoapClient object was created with the option of "trace=1".

   string $s = $obj->__getLastResponse();

Last update: 2015.

Table of Contents

 About This Book

 Introduction and Installation of PHP 7.0

 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

 Configuring and Sending out Emails

 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

 PHP Implementations of SOAP

 Turning on the Default SOAP Extension

 Hello_There.php - First Example of SOAP

SoapClient - SOAP Client Class and Functions

 Hello_There_Dump.php - Debugging SOAP Messages

 What Is WSDL?

 Using SOAP Extension in non-WSDL Mode

 SOAP Server Functions and Examples

 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

 Introduction of Class and Object

 Integrating PHP with Apache Web Server

 Outdated Tutorials

 References

 PDF Printing Version