PHPBuilder - PHP, XML, XSL, XPATH and Web Services Page 2



RSS Twitter
Articles Application Architecture

PHP, XML, XSL, XPATH and Web Services - Page 2

by: Mashooq Badar
|
May 6, 2004

A Web Service implementation in PHP
PHP provides an ideal platform to implement Web Services. There are numerous PHP libraries available to make this as easy and painless as possible. The library used here is called NUSOAP . The following is a code snippet of how you would expose a PHP function as a Web Service method.

<?php
require_once('nusoap.php');

$server = new soap_server;
$server->register('get_siteuser');
$server->register('get_siteuser_list');

function 
get_siteuser($user_id
{

}
function 
get_siteuser_list($siteuser
{    

}
?>
NUSOAP also provides Web Service client-side libraries. The following is example code for invoking a Web Service:

<?php
require_once("nusoap.php");
$soapclient = new soapclient("http://localhost/~ nmcengine.php");
echo 
$soapclient->call('get_siteuser',array('user_id'=>"$arg1"));
?>
As you can see calling a web service using PHP is simply three lines of code. You may have noticed that WSDL is not being used to invoke the web service. NUSOAP libraries provide functionality to create the WSDL which will be needed if the web service is being invoked by other means in PHP or a different programming language.
The Content Engine
The Content Engine simply provides an XML based interface to the database schema. The Content Engine interface maps directly onto the tables, their attributes and the relationships between the tables. Given the following simplified schema:
Content Engine diagram

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Mashooq Badar

Comment:



Comment:

(Maximum characters: 1200). You have characters left.