Initiated by the open service-Oriented Architecture Consortium (OSOA), component-oriented architecture (SCA) and Service Data Objects (SDO) have become the latest methods for developing service-oriented architectures. Initially, these developments were focused on a few common development environments, such as Java and C + +, where SCA and SDO have now started to enter some other platforms, where we will explain how to include some SOA technologies on PHP.
First we look at what SDO can offer you. In a typical PHP application, half of the data comes from a relational database, but if the application is not just getting the data from here, it gets the data from a plain text file or Web service. The problem is complicated, because each data source requires its own access method.
In this case, the SDO in PHP provides a transparent way to handle the data source. Instead of processing each data source separately, it provides a uniform way to access data objects. This process is done through the data Access Service (DAS), which is an intermediary approach on the SDO architecture. Let's look at an SDO request in PHP.
$providers = $company->shippingbyground; foreach ($providers as $name => $value) { echo "$name: $valuen"; } ? > |
Note that the last request is how to handle the unknown data source, you do not know where the data is extracted from, just use the PHP sdo format to do a lookup, and the details are completed by Das, PHP is currently able to support the acquisition of XML and relational database data source.
SDO is concerned with data, and SCA uses more generic classes and components to accomplish the same transparent approach. Does accessing existing business logic from any PHP class require developers to design around a specific type of hypothesis? Is the logic already in another native PHP class? Does it exist in the network? Was it written in PHP?
When the above mentioned scenarios are satisfied in their respective requirements, each needs to be handled in a different way.
Using the SCA approach, it doesn't matter where the logic is stored, let's not mention what language to use to implement it. So you're going to say, "Isn't that the same as a normal Web service?" No difference! "Then let's take a look at what's included in the PHP SCA component.
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 critical of the above is the statement part that contains the @, each of which provides a specific SCA behavior. The topmost @service identity, which indicates exposing a class as a service. In this example, the last GetQuote function will be the only operation exposed by the service, by using the @param and @return identities.
The execution or deployment of this last service--which will be delegated as a PHP SCA runtime--will bring us to a point where the WSDL contract is created, as you can see in the Web service. In addition to the simplicity of this approach to deploying services, the true benefits of the SCA model will become apparent as you examine the GetQuote code.
Notice that two statements $this- Getshippingprice ($shippingCo) and $this->discountfee->getdiscountrate ($customer), They are based on the previous application in the class. Each application is supported by its support service lock (as specified by the @reference and @binding) in the $discountfee use case, which will be a PHP class, and in the case of shipper, this will be a standard WSDL based service.
Although PHP's simple and large user base support makes it a good choice for building Web applications, it has limited capabilities in many scenarios for enterprise applications, and now provides strong support for PHP and previous technologies by adding SCA and SDO, as well as other mainstream languages. Can participate in the service-oriented trend.
"Related articles"
http://www.bkjia.com/PHPjc/446774.html www.bkjia.com true http://www.bkjia.com/PHPjc/446774.html techarticle initiated by the open service-Oriented Architecture Consortium (OSOA), component-oriented architecture (SCA) and Service Data Objects (SDO) have become the latest methods for developing service-oriented architectures. At the beginning this ...