Wednesday, May 12, 2010

Sample Php Nusoap Client: - Using XML as parameter in Call method instead of Associative array.

Below is the Sample Php Client program using Xml as a parameter in Call method ............

require_once('D:/wamp/www/nusoap-0.7.3/lib/nusoap.php');
$serverpath= http: /localhost: 8080/Sample/services/SampleSOAP';

$BooksRQ= '< BSI_BooksListRQ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance echoToken="0123" >\Language >EN< /Language >< Credentials >< User > Jeniffer< /User  >< Password >mypasswrd< /Password >< /Credentials >';

try
{
$SOAPClient = new soapclient($serverpath);
$SOAPClient ->soap_defencoding = "UTF-8";
$SOAPClient –>call ("getBSIBooksList",array($BooksRQ),$BooksRQ, http://axis.frontend.bsi.testbooks.com/);
}
catch(Exception $e)
{
print $e;
}

// Display the request and response
echo '< h2 >Request< /h2 >';
echo '< pre >' . htmlspecialchars($SOAPClient->request, ENT_QUOTES) . '< /pre >';
echo '< h2 >Response< /h2 >';
echo '< pre >' . htmlspecialchars($SOAPClient->response, ENT_QUOTES) . '< /pre >';
unset($SOAPClient);
?>

No comments:

Post a Comment