PHP uses Nusoap to invoke the Web service's method, Phpnusoap calls the web
This example describes how PHP uses Nusoap to invoke Web services. Share to everyone for your reference. Specific as follows:
Steps:
1. Download Nusoap Library from the Internet.
2. Pass parameter list in your $client->call and enjoy.
<?phprequire_once ('./lib/nusoap.php '); $client = new Soapclientnusoap (' http://www.devtrackn.com/webservice/ Server.php '); $err = $client->geterror (); if ($err) {//Display the error echo 'Constructor error: '. $err. '
'; At this point, you know the follows would fail}////////////////////////////////////////////////////////////// Update_location Method Parameter$param = Array (' Device_number ' = ' 9910948357 ', ' latitude ' = ' 40.727757 ', ' longitude ' = ' -73.984366 ', ' Battery_status ' => ; ' + ');//User_action Method parameter$param2 = Array (' device_number ' = ' 27ab2026da5213ebd6c95e5fbe50965bdfaddf 4b ', ' latitude ' = ' 40.727757 ', ' longitude ' and ' -73.984366 ', ' user_action ' = ' meeting_test ' ///sos Method PARAMETER$PARAM3 = Array (' device_number ' = ' 9910948357 ', ' latitude ' = ' 40.727757 ', ' Longitude ' = ' -73.984366 ',);//$result = $client->call (' update_location ', $param);//$result = $client->c All (' User_action ', $param 2);//$result = $client->call (' SOS ', $param 3); $result = $client->call (' User_entity_ Status ', Array (' Device_number' = ' 27ab2026da5213ebd6c95e5fbe50965bdfaddf4b ');/////////////////////////////////////////////////////////// Check for a faultif ($client->fault) {echo 'Fault: '; Print_r ($result); Echo '
';} else {//Check for errors $err = $client->geterror (); if ($err) {//Display the error echo 'Error: '. $err. '
'; } else {//Display the result echo ""; Print_r ($result); echo "
"; }}echo 'Request
'; Echo '' . Htmlspecialchars ($client->request, ent_quotes). '
'; Echo 'Response
'; Echo '' . Htmlspecialchars ($client->response, ent_quotes). '
';/*//Display the Debug Messagesecho 'Debug
'; Echo '' . Htmlspecialchars ($client->debug_str, ent_quotes). '
';*/?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1034535.html www.bkjia.com true http://www.bkjia.com/PHPjc/1034535.html techarticle PHP uses Nusoap to invoke the Web service's method, Phpnusoap calls the Web This example describes the way PHP uses Nusoap to invoke a Web service. Share to everyone for your reference. Specific as follows: Steps: ...