2011-11-20 217 views
0

我是PHP新手,對web服務不太瞭解,但是我已經在PHP中編寫了代碼片段,但它沒有顯示輸出結果,可以請求任何幫助嗎?Web服務不能正常工作

下面是代碼:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title>PHP NuSoap Shakespeare Client</title> 
</head> 
<body> 
<h3>PHP program to access the Shakespeare web service.</h3> 
<?php 
require_once('lib/nusoap.php'); 
$request = array('Request'=> 'Winter of our discontent'); 
$wsdl="http://www.xmlme.com/WSShakespeare.asmx?wsdl"; 
$soapClient = new soapclient($wsdl, true); 
$result = $soapClient->call 
     (
       'Get Speech', 
       $request, 
       'http://xmlme.com/WebServices', 
       'http://xmlme.com.WebServices/GetSpeech'); 
echo '<h2>Shakespeare Web Service Response from a PHP Client</h2>'; 
echo '<h2>PHP Array Response</h2>'; 
print_r($result); 
echo '<h2>Request</h2>'; 
echo '<pre>'.htmlspecialchars($soapClient->request, ENT_QUOTES).'</pre>'; 
echo '<h2>Response</h2>'; 
echo '<pre>'.htmlspecialchars($soapClient->response, ENT_QUOTES).'</pre>'; 
?> 
</body> 
</html> 
+4

* 「這是不工作...」 *:這句話每一個開發人員,網絡管理員和支持高新技術絕對** **恨。我們可以請更多的細節?你會得到什麼錯誤信息?它在哪一行失敗? –

+1

當你說它沒有顯示任何輸出時,你的意思是什麼print_r($結果)? –

+0

嘗試'var_dump($ result);'並向我們顯示您的輸出。 – evotopid

回答

0
I have some results with this: 

$soap_client = new SoapClient("http://www.xmlme.com/WSShakespeare.asmx?WSDL"); 

$request = array('Request'=> 'To be, or not to be'); 
$quote = $soap_client->GetSpeech($request); 
$speech = $quote->GetSpeechResult; 

echo $speech; 

I am new to this, but maybe the info helps you further.