|
 |
|
ทำ WebService ด้วย ASP.NET แล้วเรียกใช้งานด้วย PHP ค่ะ |
|
 |
|
|
 |
 |
|
ลองใช้ nusoap ครับ
Code (PHP)
<?php
/*
* $Id: getfile1client.php,v 1.1 2005/05/18 14:38:53 snichol Exp $
*
* Get file client sample.
*
* Service: SOAP endpoint
* Payload: rpc/encoded
* Transport: http
* Authentication: none
*/
require_once('../lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new soapclient('http://www.scottnichol.com/samples/getfile1.php?wsdl', true,
$proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$result = $client->call('getFile', array('filename' => 'getfile1.php'));
if ($client->fault) {
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>' . htmlspecialchars($result, ENT_QUOTES) . '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
Go to : แบบนี้เรียก web service เปล่างับแน่ะนำหน่อย คือ อาจารย์เค้าให้ทำ เวปรถทัวร์ขึ้นมา(เลียนแบบนครชัยแอร์)
Go to : อยากเรียก database ผ่านทาง webservice (nusoap) ครับช่วยหน่อย
Download
http://sourceforge.net/projects/nusoap/
|
 |
 |
 |
 |
Date :
2011-03-26 07:12:11 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะ พี่วิน
แต่อย่างที่หนูบอกไปข้างต้นแล้ว ตอนนี้หนูสามารถเรียกใช้งานwebserviceได้แล้ว แค่ส่วนที่ไม่ต้องกรอก
ค่าอะไรค่ะ เช่น HelloWordแบบนี้อะค่ะ แต่ที่หนูยังหาทางไปไม่ได้คือ ส่วนที่มีการรับค่าอะค่ะ
ทำแล้วยังerror เพราะหนูไม่รู้ว่าต้องส่งตัวแปรไปกับบบรทัดไหน
แล้วหนูต้องการให้มันแสดงหน้า interfaceของ webserviceในส่วนที่รันด้วยphpอะค่ะ
หนูจะทำได้หรือเปล่า อย่างไรค่ะ แนะนำด้วยค่ะ
ขอบคุณค่ะ
|
 |
 |
 |
 |
Date :
2011-03-26 14:14:31 |
By :
inoi |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|