Call WSDL Operation with SoapClient::__doRequest()

This section provides a tutorial example on how to call an operation defined in a WSDL document using the __doRequest(request,...) function.

Instead of using the RPC style, we can also call a Web service in XML style by using the SoapClient::__doRequest() function:

Here a good example of a client program, NumberConversionDoRequest.php, on how to call a Web service with the SoapClient::__doRequest() function. The NumberConversion Web service and its WSDL document are provided by

# NumberConversionDoRequest.php
# Copyright (c) 2007 All Rights Reserved.
   $client = new SoapClient(null, array('uri'=>'', 'location'=>''));
   $request = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
   $url = 
   $response = $client->__doRequest($request,$url,"",SOAP_1_1);


When running it, I am getting:

herong> php NumberConversionDoRequest.php

string(318) "<?xml version="1.0" encoding="UTF-8"?>

string(356) "<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="">
   <m:NumberToWordsResult>three hundred and three </m:NumberToWordsResult>

Good. Now I know how to call a Web service with SOAP request XML message directly without using the WSDL document.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP MEP (Message Exchange Patterns)

 SOAP HTTP Binding

 SOAP PHP Implementations

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 Web Service Example - getTemp

 SOAP Perl Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service

 Perl SOAP::Lite for SOAP 1.2 Web Services

 Perl SOAP::Lite for WSDL

 Python SOAP Client: Zeep

 SOAP Java Implementations

 Java Socket and HttpURLConnection for SOAP

 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

 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

 Web Services and SOAP Terminology

 Archived Tutorials


 Full Version in PDF/EPUB