This work is licensed under a Creative Commons |
Web-based services can be invoked using Web technologies, and provide results in some format. Web-oriented services often provide HTML as the result format, which is not well suited for processing. Application-oriented service often provide XML as the result format, which is easier to process and can be structured specifically for the needs of a service. One of the key questions when designing and using XML-based services is the underlying data model of the XML, and in this lecture we will
Serviceis a very broad term
anything you can get somebody else to do
some interface which your application can use
A service is an independently reusable unit of functionality
true servicescan be outsourced without causing side-effects
bigger picture
loose ends
<?xml version="1.0" encoding="UTF-8"?> <文書 改訂日付="1999年3月1日"> <題>サンプル</題> <段落>これはサンプル文書です。</段落> <!-- コメント --> <段落>会社名</段落> <図面 図面実体名="サンプル" /> </文書>
local modelfully exploits the data
good service
<topics> <topic name="rdf" weight="0.6"/> <topic name="shiq" weight="0.6"/> <topic name="owl" weight="0.8"/> </topics>
<field type="bibtex:topic">rdf[0.6] shiq[0.6] owl[0.8]</field>
wire formatof many services
screen scraping
$snoopy->fetch("http://dret.net/lectures/services-fall06/a/4/query.php?format=xml&author=" . urlencode($formval_author)); $xml = new SimpleXMLElement($snoopy->results);
<ul> <?php include "Snoopy.class.php"; $snoopy = new Snoopy; import_request_variables("g", "formval_") ; $snoopy->fetch("http://dret.net/lectures/services-fall06/a/4/query.php?format=xml&author=" . urlencode($formval_author)); $xml = new SimpleXMLElement($snoopy->results); foreach ($xml->xpath('//title[@type = "sharef:primaryTitle"]') as $title) { echo '<li>' , $title , '</li>'; } ?> </ul>
children()
returns the children of the given objectattributes()
returns the attributes of the given objectXSLT
addChild()
adds a child node to an elementaddAttribute()
adds an attribute node to an element<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/ | node() | @*"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>