PHP5的SOAP

看板PHP作者 (雷丘)時間19年前 (2006/05/29 01:33), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
想請問一下 Apache Web Server Version 2.0.55 PHP Script Language Version 5.1.1 MySQL Database Version 5.0.16 phpMyAdmin Database Manager Version 2.6.4-pl4 在上述的環境下 而且我有設定ini檔裡面的extension = php_soap.dll 可是下面這些code卻沒有辦法執行 想要測試SOAP的功能 下面依序是三個檔案 謝謝大家了<(_ _)> ---------------------------------------------------------------------------- temperature.wsdl <?xml version ='1.0' encoding ='UTF-8' ?> <definitions name='Temperature' targetNamespace='http://example.org/temperature' xmlns:tns=' http://example.org/temperature ' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns='http://schemas.xmlsoap.org/wsdl/'> <message name='getTempRequest'> <part name='symbol' type='xsd:string'/> </message> <message name='getTempResponse'> <part name='Result' type='xsd:float'/> </message> <portType name='TempPortType'> <operation name='getTemp'> <input message='tns:getTempRequest'/> <output message='tns:getTempResponse'/> </operation> </portType> <binding name='TempBinding' type='tns:TempPortType'> <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='getTemp'> <soap:operation soapAction='urn:localhost-temperature#getTemp'/> <input> <soap:body use='encoded' namespace='urn:localhost-temperature' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> </input> <output> <soap:body use='encoded' namespace='urn:localhost-temperature' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> </output> </operation> </binding> <service name='TemperatureService'> <port name='TempPort' binding='TempBinding'> <soap:address location='http://localhost/phptest/server.php'/> </port> </service> </definitions> --------------------------------------------------------------------------- server.php <?php function getTemp($zip) { $temp = rand(40,80); return $temp; } ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache $server = new SoapServer("temperature.wsdl"); $server->addFunction("getTemp"); $server->handle(); ?> ------------------------------------------------------------------------------ client.php <?php $ZIP = $_GET['zipcode']; $client = new SoapClient("temperature.wsdl"); $return = $client->getTemp($ZIP); echo("Temperature is: " . $return); ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.204.245

05/29 16:21, , 1F
去PHPINFO裡看看SOAP有沒被載入...
05/29 16:21, 1F

05/29 16:22, , 2F
有可能是版本不何.....
05/29 16:22, 2F

06/01 10:25, , 3F
可以考慮下載Nusoap來使用比較好上手
06/01 10:25, 3F
文章代碼(AID): #14UTxhXB (PHP)
文章代碼(AID): #14UTxhXB (PHP)