PHP Tutorials - Herong's Tutorial Examples - Version 3.10, by Dr. Herong Yang

Using SOAP Extension in non-WSDL Mode

This section provides a tutorial example on how to use SOAP client functions to make Web service call without using the WSDL standard on the target SOAP node and print detailed debug information.

I think we had enough fun with the WSDL mode. Let's try the non-WSDL mode now. Here is the third version of my Get_Temperature.php SOAP client program, Get_Temperature_Non_Wsdl.php:

<?php # Get_Temperature_Non_Wsdl.php
# Copyright (c) 2005 by Dr. Herong Yang
   $zip = "123456";
   $client = new SoapClient(null, array(
      'location' => 
      'uri'      => "urn:xmethods-Temperature-Demo", 
      'trace'    => 1 ));

   echo("\nDumping client object:\n");

   $return = $client->__soapCall("getTemp",array($zip));
   echo("\nReturning value of __soapCall() call: ".$return);

   echo("\nDumping request headers:\n" 

   echo("\nDumping request:\n".$client->__getLastRequest());

   echo("\nDumping response headers:\n"

   echo("\nDumping response:\n".$client->__getLastResponse());

If you run this sample script, you will get:

Dumping client object:
object(SoapClient)#1 (4) {
  string(29) "urn:xmethods-Temperature-Demo"
  string(54) ""

Returning value of __soapCall() call: 52

Dumping request headers:
POST /soap/servlet/rpcrouter HTTP/1.1
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:xmethods-Temperature-Demo#getTemp"
Content-Length: 508

Dumping request:
<?xml version="1.0" encoding="UTF-8"?>
  <param0 xsi:type="xsd:string">123456</param0>

Dumping response headers:
HTTP/1.1 200 OK
Date: Wed, 05 Oct 2005 02:02:46 GMT
Server: Enhydra-MultiServer/3.1.1b1
Status: 200
Content-Type: text/xml; charset=utf-8
Servlet-Engine: Enhydra Application Server/3.1.1b1 (JSP 1.1;
   Servlet 2.2; Java 1.4.2_03; Linux 2.4.7-10smp i386;
   java.vendor=Sun Microsystems Inc.)
Content-Length: 470
Set-Cookie: JSESSIONID=RTiE9NZhFiqCdnPB36zgsXMi;Path=/soap
X-Cache: MISS from
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive

Dumping response:
<?xml version='1.0' encoding='UTF-8'?>
<return xsi:type="xsd:float">52.0</return>

The output shows that:

  • My Get_Temperature_Non_Wsdl.php works the same as the WSDL mode version.
  • If you compare this output with the WSDL output, SOAP Extension generates the request headers with one difference: SOAPAction is not blank any more. It has the value of "urn:xmethods-Temperature-Demo#getTemp".
  • SOAP Extension also generates the request message differently in non-WSDL mode. The input parameter is provided with an element named as "param0". In the WSDL version, that element is named as "zipcode".

Last update: 2005.

Table of Contents

 About This PHP Tutorial Book

 Introduction and Installation of PHP 5.4.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

 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

 Get_Temperature.php - First Example of SOAP

 SoapClient - SOAP Client Class and Functions

 Get_Temperature_Dump.php - Dumping Debugging Information

 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

 Outdated Tutorials


 PDF Printing Version

Using SOAP Extension in non-WSDL Mode - Updated in 2012, by Dr. Herong Yang