phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Web Services .NET Grid: Create SOAP Server

Tag: web services, .net, wsdl, soap, vb.net   Category: PHP Framework
post: 15 Apr 2008 read: 484


Web Services PHP - Grid .NET Step By Step Tutorial - Part 3: Our database and WSDL document are ready. Now, we create SOAP server to serve transmit data. All data will be convert to single line of string.

Create a file named "library_server.php" within www/test/wsdl. Enter following code:


<?php
if(!extension_loaded("soap")){
  dl("php_soap.dll");
}

ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("library.wsdl");

function doLibrary($name=''){
 // connect to database
 mysql_connect('localhost','root','admin');
 mysql_select_db('test');
 
 // query for retrieve data from books table
 $sql = "select * from books";
 $q	  = mysql_query($sql);
 
 while($r	  = mysql_fetch_array($q)){
   // convert to a line
   $str .= $r['id']."|".$r['title'].'|'.$r['author'];
   // row be separated with #
   $str .= '#';
 }

 // return a line of string
 return $str;
   
}

// register method
$server->AddFunction("doLibrary");
$server->handle();
?>


Series this article:
Web Services .NET Grid: Create WSDL Document
Web Services .NET Grid: Preparing Database
Web Services .NET Grid: Create SOAP Server
Web Services .NET Grid: Testing with SOAP client
Web Services .NET Grid: Creating User Interface for VB.NET
Web Services .NET Grid: Retrieve Data and Show to Data Grid

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting