5.5. Web Service instance

发布时间 : 2025-10-25 13:34:15 UTC      

Page Views: 10 views

Any application can have Web Service components.

The creation of Web Service is independent of the type of programming language.

In this section, we will introduce you to using PHP’s SOAP extension to create Web Service.

SOAP has two modes of operation, NO-WSDL and WSDL.

  • NO-WSDL mode: use parameters to pass the information to be used.

  • WSDL mode: use the WSDL file name as a parameter and extract the informationneeded for the service from the WSDL.

5.5.1. An example: PHP Web Service

Before starting the instance, we need to determine whether PHP has the SOAP extension installed. Looking at phpinfo, the following message appears to indicate that the SOAP extension has been installed:

Image0

In this example, we will use PHP SOAP to create a simple Web Service.

Server side the Server.php file code is as follows:

"http://localhost/soap/Server.php","uri"=>"Server.php")); // Export all functions in the SiteInfo class $s->setClass("SiteInfo"); // Process a SOAP request, call necessary functions, and send back a response. $s->handle(); ?> 

Client the Client.php file code is as follows:

"http://localhost/soap/Server.php",'uri'=>'Server.php')); // Call function $result1 = $soap->getName(); $result2 = $soap->__soapCall("getUrl",array()); echo $result1."
"; echo $result2; } catch(SoapFault $e){ echo $e->getMessage(); }catch(Exception $e){ echo $e->getMessage(); }

At this point, we visit http://localhost/soap/Client.php and the output is as follows:

Image1

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。