how to create nusoap_server and nusoap_client implemention using php
1st-> download nusoap class library
2nd->create wsdl function "getrequest()" using below code
your WSDL url could be (http://127.0.0.1/test/nusoap/samples/index.php?wsdl)
--------------------index.php--------------------------------------------
require_once('../lib/nusoap.php');
$server = new nusoap_server;
$server->configureWSDL('server', 'urn:server');
$server->wsdl->schemaTargetNamespace = 'urn:server';
$server->register('getrequest',
array('value' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:server',
'urn:server#pollServer');
function getrequest($value){
if($value=="bikash"){
return "well come bikash";
}else{
return "not bikash";
}
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
------------------------------end nusoap server-------------------------------------------------------
3rd-> call the wsdl what you create
-------------------------------------------------
create nusoapcallwsdl.php
past below my code
require_once('../lib/nusoap.php');
$client = new soapclient('http://127.0.0.1/test/nusoap/samples/index.php?wsdl');
$res=$client->__call('getrequest',array('bikash'));
print_r($res);
2nd->create wsdl function "getrequest()" using below code
your WSDL url could be (http://127.0.0.1/test/nusoap/samples/index.php?wsdl)
--------------------index.php--------------------------------------------
require_once('../lib/nusoap.php');
$server = new nusoap_server;
$server->configureWSDL('server', 'urn:server');
$server->wsdl->schemaTargetNamespace = 'urn:server';
$server->register('getrequest',
array('value' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:server',
'urn:server#pollServer');
function getrequest($value){
if($value=="bikash"){
return "well come bikash";
}else{
return "not bikash";
}
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
------------------------------end nusoap server-------------------------------------------------------
3rd-> call the wsdl what you create
-------------------------------------------------
create nusoapcallwsdl.php
past below my code
require_once('../lib/nusoap.php');
$client = new soapclient('http://127.0.0.1/test/nusoap/samples/index.php?wsdl');
$res=$client->__call('getrequest',array('bikash'));
print_r($res);
Comments
Post a Comment