SOAP is not so slippery then soap

SOAP (Simple Object Access Protocol) is not a new technology, however it’s technique can double size the security sides and supporting multi-platform application accessibility. As you know, the SOAP method is unique, it’s accessing the database not with the application own hands. So what is the others hands? Sure, XML (eXtensible Markup Language) as the web service did.



Usually, SOAP implemented in the most of web based applications, but few of it used as the part of the application modules. Why? Because it is so complicated, I guess. The SOAP technique require server’s RPC (Remote Procedure Call) before it can connect to the databases. This thing is always left by the programmers since it will decrease the application performance.

However, I’ll give you an example how to create SOAP based application instead of the RPC it self. I developed this using PHP programming (even it is wide large support also by the ASP programming). To reduce both the code size and your head ache, I’ll implemented a class named nusoap.php which available at http://dietrich.ganx4.com/nusoap.

What you need is to create both the client and the server module. The client module is a part of the front-end while the server module is a part of the back-end. To shorten this post, I’ll just explained you a module which process the login validation.

In the server module, you have to create the server object, register the lookup service and finally send the result as a SOAP response over HTTP.

// create the server object
$server = new soap_server;

// register the lookup service
$server->register('login');

// send the result as a SOAP response over HTTP
$server->service($HTTP_RAW_POST_DATA);

In the client module, you have to define the parameter also the server file target, create client object, run the RPC backstage, and finally release it after accepting the response.

// define the parameter
$param =
array('user_name'=>$user_name,'passwd'=>$passwd);

// define the
server file target
$serverpath ='http://localhost/soap/server.php';

// method namespace-nya
$namespace="urn:xmethods-SOAPWebService";

// create client object
$client = new soapclient($serverpath);

// run the RPC
$is_login =
$client->call('login',$param,$namespace);

// kill object
unset($client);


So simple isn’t it? Not exactly the hard code you expected before. Please have a try and share your experiences.


PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address to receive feed update from this blog:

Post a Comment

 

Post a Comment

Leave comments here...