Profile Picture
IT Made Easy
The site provides some rough IT Notes that make your life easier. The site currently has notes on HTML, CSS, Regex, OOPS, JS, JQuery, PHP, Java, ASP.NET, C#, Database, Linux, URL Rewrite, SEO, Project Management and Hosting. Please do share this site if you like.

WebService

Next
Next
  • Web Service is a standard way of interoperating between different software applications running on variety of platforms and/or frameworks
  • SOAP - Simple Object Acess Protocol.
  • RPC - Remote Procedure Call. It is the most common messaging pattern
  • REST - Representational State Transfer. Each resource must be identified by a global identifiera URI. To access these resources, clients communicate with the REST service by HTTP, and the server responds with a representation of the resource. They are not discoverable and hence has no WSDL. Websites that give RSS and RDFfeeds provide RESTful servicve. Delicious is an example which gives a XMlL ready to be consumed by SimpleXML. We pass the URL the username and password to obtain XML.
  • WSDL - Web Services Definition Lanaguage . It is a language for locating and describing web servicves
  • UDDP - Universal Description Discovery and Integration. It is a directory service where we can register and search web services
  • NuSoap is a famous SOAP library in PHP


Server

//We have to first code the class MySoapServer with a function named method with parameter param and locate this coode in server.php

$options = array(uri' => http://example.org/soap/server/);

$server = new SoapServer(NULL, $options);

$server->setClass(MySoapServer);

$server->handle();

Client

try

{

$options = array(

location => http://example.org/soap/server/server.php,

uri => http://example.org/soap/server/,

'trace'=1

);

$client = new SoapClient(NULL, $options);               

//WSDL URI if working in WSDL mode with options as next parameter. Here not in WSDL mode so first parameter is NULL and options have to include location an URI. Last parameter with trace=1 will debug

$results = $client->method(param);                  //Method from WSDL. Returns XML. You can loop through it

echo $client->__getLastRequestHeaders();               //Request headers

echo $client->__getLastRequest();                  //Request XML body

}

catch (SoapFault $e)

{

echo $e->getMessage();

}

IT Notes

by VinodSebastian



IT Downloads


Catalogue