Use PHP to develop SCA and SDO. Initiated by an open service-oriented architecture joint organization (OSOA), component-Oriented Architecture (SCA) and service data object (SDO) have become the latest method for developing a service-oriented architecture. At the beginning, this was initiated by the open service-oriented architecture joint organization (OSOA), component-Oriented Architecture (SCA), and service data object (SDO) it has become the latest method for developing a service-oriented architecture. At the beginning, these development tasks were only concentrated in some common development environments, such as Java and C ++. Currently, SCA and SDO have started to enter other platforms, here we will explain how to include some SOA technologies in PHP.
First, let's take a look at what SDO can offer you. In a typical PHP application, half of the data comes from relational databases. However, if this application not only obtains data from this application, but is it getting data from a common text file or a Web service? This problem is complicated, because each data source requires its own method of acquisition.
In this case, SDO in PHP provides a transparent way to process data sources. Instead of processing each data source separately, it provides a unified way to access data objects. This process is done through the data access service (DAS), which is a mediation method in the SDO architecture. Let's take a look at an SDO request in PHP.
<?php $providers = $company->shippingByGround; foreach ($providers as $name => $value) { echo "$name: $valuen"; } ?> |
Note that the final request is used to process unknown data sources. you do not know where the data is extracted here, but use the SDO format of PHP for a search, the details are completed by DAS. PHP currently supports obtaining data sources of XML and relational databases.
SDO is concerned with data, while SCA uses more common classes and components to achieve the same transparency. To access existing business logic from any PHP class, do developers need to be forced to design a specific class of assumptions? Is the logic already in another local PHP class? Is it in the network? Is it written in PHP?
When the preceding scenarios are met in their respective requirements, different methods are required for each scenario.
With SCA, it doesn't matter where the logic is stored, let alone the language used for implementation. Then you must say, "Isn't this the same as a common Web Service? There is no difference !" Let's take an example to see what is included in the php sca component.
<?php include "SCA/SCA.php"; /** * Calculate a shipment price for a given customer using a specific provider * * @service */ class ShipmentQuote { /** * The customer discount fee service to use. * * @reference * @binding.php ../DiscountFeeRate/DiscountFeeRate.php */ public $discountFee; /** * The shipping service to use. * * @reference * @binding.wsdl ../Shipper/ShipperQuote.wsdl */ public $shipper; /** * Get a quote for a given customer using a specific provider * * @param string $shipping The shipping company * @param string $customer The customer requiring shipment, in order to obtain discount rate * @return float The quote for a given customer using a certain shipping provider. */ function getQuote($shippingCo, $customer) { $rateShip = $this->shipper->getShippingPrice($shippingCo); $rate = $this->discountFee->getDiscountRate($customer); return $rate * $rateShip; } } ?>
|
The most important part above is the statement that contains @, each of which provides a specific SCA behavior. The @ service identifier at the top layer, indicating that a class is exposed as a service. In this example, the final getQuote function will be the only operation exposed by the service, identified by @ param and @ return.
The execution or deployment of the final service will be delegated to a php sca runtime-it will bring us into an access point for creating the WSDL contract, as you can see in network services. In addition to the simplicity of this method of deploying services, the real advantages of the SCA model will become more apparent when you check the getQuote code.
Note the two statements $ this-<shipper-> getShippingPrice ($ shippingCo) and $ this-> discountprice-> getDiscountRate ($ customer), which are based on the applications before the class. Each application is supported by its support service Lock (identified by @ reference and @ binding). in the $ discountcounter use case, this will be a PHP class, and in the shipper use case, this will be a standard WSDL-based service.
Despite the simplicity of PHP and the support of a large number of user groups, PHP has become a good choice for building web applications, but it has limited capabilities in many enterprise application scenarios. now, by adding SCA and SDO, it provides strong support for PHP and previous technologies. like other mainstream languages, it can participate in the service-oriented trend.
[Related articles]
The component-Oriented Architecture (SCA) and service data object (SDO) initiated by Middleware (OSOA) have become the latest method for developing a service-oriented architecture. At the beginning, this...