1 / 6

Web Service dengan NUSoap

Web Service dengan NUSoap. Wiratmoko Yuwono. Requirement. Apache Web Server PHP Library NUSoap. Contoh Web Service Server (WSServer.php). <? php // Pull in the NuSOAP code require_once ('lib/nusoap.php'); // Create the server instance $server = new soap_server ();

tynice
Download Presentation

Web Service dengan NUSoap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Service denganNUSoap WiratmokoYuwono

  2. Requirement • Apache Web Server • PHP • Library NUSoap

  3. Contoh Web Service Server(WSServer.php) • <?php • // Pull in the NuSOAP code • require_once('lib/nusoap.php'); • // Create the server instance • $server = new soap_server(); • // Initialize WSDL support • $server->configureWSDL('hellowsdl', 'urn:hellowsdl'); • // Register the method to expose • $server->register('hello', // method name • array('name' => 'xsd:string'), // input parameters • array('return' => 'xsd:string'), // output parameters • 'urn:hellowsdl', // namespace • 'urn:hellowsdl#hello', // soapaction • 'rpc', // style • 'encoded', // use • 'Says hello to the caller' // documentation • ); • // Define the method as a PHP function • function hello($name) { • return 'Hello, ' . $name; • } • // Use the request to (try to) invoke the service • $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; • $server->service($HTTP_RAW_POST_DATA); • ?>

  4. Contoh Web Service Client(WSClient.php)-Menggunakan Library Bawaan PHP • <?php • $client = new SoapClient('http://lecturer.eepis-its.edu/~moko/WSServer.php?wsdl'); • $names = array('Scott'); • $result = $client->__soapCall('hello', array('name' => 'Scott')); • print_r($result); • ?>

  5. Contoh Web Service Client(WSClient.php)-Menggunakan Library NUSOAP • <?php • // Pull in the NuSOAP code • require_once('lib/nusoap.php'); • // Create the client instance • $client = new soapclient('http://lecturer.eepis-its.edu/~moko/WSServer.php?wsdl', true); • // Call the SOAP method • $result = $client->call('hello', array('name' => 'Scott')); • // Result • print_r($result); • ?>

  6. Tugas • Aplikasikan WSClient.php ke server student dengan account masing-masing, WSServer.php bisadiaksespadaalamat : http://lecturer.eepis-its.edu/~moko/WSServer.php • Buat File WSServer1.php untukmencobamengaplikasikan formula. Ada 3 parameter : Parameter 1 ->Nilai 1 Parameter 2 ->Nilai 2 Parameter 3 -> berisi ‘+’, ‘-’, ‘*’, ‘/’ Output : Formula darinilai 1 dannilai 2 sesuaientri parameter 3 3. Buat File WSClient1.php untukmemanggil Web Service Server WSServer1.php 4. WSServer1.php dan WSClient1.php diletakkandi account server student anda

More Related