2011-11-20 176 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.