Configuring and Testing SOAP Extension

This section provides a tutorial example on how to configure and test SOAP Extension with a WSDL 2.0 document. It fails with an error.

Once PHP is installed, I need to turn on the SOAP Extension with these steps:

1. If \local\php\php.ini does not exist, create it by copying the file \local\php.ini-production.

2. Edit \local\php\php.ini to set these configuration settings:

...
extension_dir = "C:\local\php\ext"
...
extension=php_soap.dll
...

3. Creating a testing PHP program, SOAP_Hello.php:

<?php
#- WDSL_20_Hello.php
#- Copyright (c) 2009 HerongYang.com. All Rights Reserved.

  $client = new SoapClient(
      "file:///C:/herong/Hello_WSDL_20_SOAP.wsdl");
   echo $client->Hello("Hello from client.");
?>

4. Run the test program:

herong> \local\php\php WSDL_20_Hello.php

PHP Fatal error:  SOAP-ERROR:
   Parsing WSDL: Couldn't find <definitions>
   in 'file:///C:/herong/Hello_WSDL_20_SOAP.wsdl'
   in C:\herong\WSDL_20_Hello.php on line 6

Stack trace:
#0 C:\herong\WSDL_20_Hello.php(6):
   SoapClient->SoapClient('file:///C:/hero...')
#1 {main}
   thrown in C:\herong\WSDL_20_Hello.php on line 6
...

As you can see, PHP SOAP Extension fails to parse the WSDL 2.0 "description" element. It is expecting the WSDL 1.1 "definitions" element.

Conclusion: PHP SOAP Extension does not support WSDL 2.0.

See other tutorials in this book on how to use PHP SOAP Extension to test WSDL 1.1 documents.

Table of Contents

 About This Book

 Introduction to WSDL 2.0

 WSDL 2.0 Document Structure and Syntax

 WSDL Version 2.0 Part 2: Adjuncts

 WSDL 2.0 Document Examples with SOAP Binding

 Using WSDL Document in Java Apache Axis2/Java for WSDL

 Apache Woden for WSDL Documents in Java

 SoapUI - Web Service Testing Tool

PHP SOAP Extension for WSDL

 What Is PHP SOAP Extension

 Downloading and Installing PHP

Configuring and Testing SOAP Extension

 Perl SOAP::Lite for WSDL

 Introduction to WSDL 1.1

 WSDL 1.1 Document Structure and Syntax

 WSDL 1.1 Binding Extension for SOAP 1.1

 SoapUI as WSDL 1.1 Testing Tool

 WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

 PHP SOAP Extension for WSDL 1.1

 Perl SOAP::Lite for WSDL 1.1

 Apache Axis2/Java for WSDL 1.1

 Using WSDL2Java to Generate Web Service Stub Classes

 WSDL 1.1 Binding Extension for SOAP 1.2

 WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles

 SOAP 1.2 Binding - PHP, Java and Perl Clients

 Python SOAP Client: Zeep

 WSDL Related Terminologies

 Archived Tutorials

 References

 Full Version in PDF/EPUB