wsdl2php

home
download
manual
about


Support This Project

wsdl2php Manual

This document should contain all you need to know on how to use wsdl2php.

Introduction

wsdl2php can be a handy tool to auto generate PHP code from a WSDL-file.

Requirements

In order to use wsdl2php you need to satisfy the following requirements:

You need to have a php-cli version of PHP 5 compiled with:

  • soap - SOAP extension
  • dom - DOM extension
  • spl - Standard PHP Library

NOTE: 0.1 is only working on *NIX systems.

Installation

Download the latest release from http://sourceforge.net/projects/wsdl2php. Then install the package with the PEAR-installer.

sudo pear install wsdl2php-0.2.1-pear.tgz

Configuration

No configuration is needed at this stage.

Usage

Using wsdl2php is as simple as type wsdl followed by your URL or path to your WSDL-file.

Basic example

Here goes a very basic example. Let's try out a simple webservice called "Hello Translated" found on XMethods.net. Create a working directory and type:

wsdl2php http://lepago.homeip.net/HelloLangJB4EAR/HelloLangJB4EJB/HelloLangEndpointPort?wsdl

Then you'll get a PHP file called HelloLangService.php which is the webservice communication class.

Now create a file called hello.php in the same directory with this code:

<?php
require_once 'HelloLangService.php';
$hello = new HelloLangService();
print ucfirst($hello->sayHello('Japanese')).' '.ucfirst(`whoami`);
?>

Save if and execute it with:

php hello.php

Now you should get a friendly message in Japanese :) Good luck!