Web Services II Agenda Web Services ServiceOriented Computing
Web Services II
Agenda �Web Services �Service-Oriented Computing
What is a Web Service? �A Web Service is simply a service available via the Web �Service can be implemented as Java application, C++ application, Javascript code, etc. �Usually, web service means a service that can be accessed programmatically �Web “API”
Web Service �Self-contained, modular apps: �Described, published, located and invoked over a network, generally the Web �Likely the next architecture for internet based business computing
Universal Description, Discovery, and Integration (UDDI) �Web-based distributed directory: � Enables businesses to list themselves on the internet and discover each other �XML formatted information for: � Business entity - “white pages” � Address, contact, known identifiers � Business service - “yellow pages” � Grouped by categories � Binding Template - “green page”: � Technical information on service entry point and binding spec. � t. Models - specs for services or taxonomies � http: //en. wikipedia. org/wiki/Universal_Description_Discovery_and_Integration � UDDI Dead? � http: //uddi. xml. org/ � UDDI Alive and being developed?
Web Service Description Language (WSDL) �Defines a web/network service: � XML format � Set of end-points operating on messages containing either document-oriented or procedure-oriented information �Key elements of a web service: � � � Documentation – English description Types – Data type (e. g. structure) Message – Message format Port. Type – Abstract set of operations supported by one or more endpoints Binding – Concrete protocol and data format spec for a port Type Service – Specifies web addresses �WSDL description may be automatically generated based on Java class definitions
Google Web Services
Google SOAP API Note: has just been deprecated (11/1/2010). Use New APIs � Search Requests: � Search requests submit a query string and a set of parameters to the Google Web APIs service and receive in return a set of search results. Search results are derived from Google's index of billions of web pages. � The return type for search requests is a structured listing set. � Cache Requests: � Cache requests submit a URL to the Google Web APIs service and receive in return the contents of the URL when Google's crawlers last visited the page (if available). � The return type for cached pages is base 64 encoded text. � Spelling Requests: � Spelling requests submit a query to the Google Web APIs service and receive in return a suggested spell correction for the query (if available). Spell corrections mimic the same behavior as found on Google's Web site. � Spelling requests are subject to the same query string limitations as any other search request. (The input string is limited to 2048 bytes and 10 individual words. ) � The return type for spelling requests is a text string. � New APIs: � http: //code. google. com/more/
Web Service Description Language (WSDL) �Key elements of a web service � Documentation – English description � Types – Data type (e. g. structure) � Message – Message format � Port. Type – Abstract set of operations supported by one or more endpoints � Binding – Concrete protocol and data format spec for a port Type � Service – Specifies web addresses �WSDL description may be automatically generated based on Java class definitions � http: //jmvidal. cse. sc. edu/talks/wsdl/googleex. html
Documentation – English description Google WSDL <? xml version="1. 0"? > <!-- WSDL description of the Google Web APIs. The Google Web APIs are in beta release. All interfaces are subject to change as we refine and extend our APIs. Please see the terms of use for more information. --> <!-- Revision 2002 -08 -16 --> <definitions name="Google. Search" target. Namespace="urn: Google. Search" xmlns: typens="urn: Google. Search" xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" xmlns: soap="http: //schemas. xmlsoap. org/wsdl/soap/" xmlns: soapenc="http: //schemas. xmlsoap. org/soap/encoding/" xmlns: wsdl="http: //schemas. xmlsoap. org/wsdl/" xmlns="http: //schemas. xmlsoap. org/wsdl/">. . . </definitions>
<xsd: complex. Type name="Result. Element. Array"> <xsd: complex. Content> <xsd: restriction base="soapenc: Array"> <xsd: attribute ref="soapenc: array. Type" wsdl: array. Type="typens: Result. Element[]"/> </xsd: restriction> </xsd: complex. Content> </xsd: complex. Type> Types <xsd: complex. Type name="Directory. Category. Array"> <xsd: complex. Content> <xsd: restriction base="soapenc: Array"> <xsd: attribute ref="soapenc: array. Type" wsdl: array. Type="typens: Directory. Category[]"/> </xsd: restriction> </xsd: complex. Content> </xsd: complex. Type> <!-- Types for search - result elements, directory categories --> <types> <xsd: schema xmlns="http: //www. w 3. org/2001/XMLSchema" target. Namespace="urn: Google. Search"> <xsd: complex. Type name="Google. Search. Result"> <xsd: all> <xsd: element name="document. Filtering" <xsd: element name="search. Comments" <xsd: element name="estimated. Total. Results. Count" <xsd: element name="estimate. Is. Exact" <xsd: element name="result. Elements" <xsd: element name="search. Query" <xsd: element name="start. Index" <xsd: element name="end. Index" <xsd: element name="search. Tips" <xsd: element name="directory. Categories" <xsd: element name="search. Time" </xsd: all> </xsd: complex. Type> <xsd: complex. Type name="Directory. Category"> <xsd: all> <xsd: element name="full. Viewable. Name" type="xsd: string"/> <xsd: element name="special. Encoding" type="xsd: string"/> </xsd: all> </xsd: complex. Type> </xsd: schema> type="xsd: boolean"/> </types> type="xsd: string"/> type="xsd: int"/> type="xsd: boolean"/> type="typens: Result. Element. Array"/> type="xsd: string"/> type="xsd: int"/> type="xsd: string"/> type="typens: Directory. Category. Array"/> type="xsd: double"/> <xsd: complex. Type name="Result. Element"> <xsd: all> <xsd: element name="summary" type="xsd: string"/> <xsd: element name="URL" type="xsd: string"/> <xsd: element name="snippet" type="xsd: string"/> <xsd: element name="title" type="xsd: string"/> <xsd: element name="cached. Size" type="xsd: string"/> <xsd: element name="related. Information. Present" type="xsd: boolean"/> <xsd: element name="host. Name" type="xsd: string"/> <xsd: element name="directory. Category" type="typens: Directory. Category"/> <xsd: element name="directory. Title" type="xsd: string"/> </xsd: all> </xsd: complex. Type> Types – Data type (e. g. structure)
Message – Message format Messages <!-- Messages for Google Web APIs - cached page, search, spelling. --> <message name="do. Get. Cached. Page"> <part name="key" type="xsd: string"/> <part name="url" type="xsd: string"/> </message> <message name="do. Get. Cached. Page. Response"> <part name="return" type="xsd: base 64 Binary"/> </message> <message name="do. Spelling. Suggestion"> <part name="key" type="xsd: string"/> <part name="phrase" type="xsd: string"/> </message> <message name="do. Spelling. Suggestion. Response"> <part name="return" type="xsd: string"/> </message> <!-- note, ie and oe are ignored by server; all traffic is UTF-8. --> <message name="do. Google. Search"> <part name="key" type="xsd: string"/> <part name="q" type="xsd: string"/> <part name="start" type="xsd: int"/> <part name="max. Results" type="xsd: int"/> <part name="filter" type="xsd: boolean"/> <part name="restrict" type="xsd: string"/> <part name="safe. Search" type="xsd: boolean"/> <part name="lr" type="xsd: string"/> <part name="ie" type="xsd: string"/> <part name="oe" type="xsd: string"/> </message> <message name="do. Google. Search. Response"> <part name="return" type="typens: Google. Search. Result"/> </message>
Port. Type – Abstract set of operations supported by one or more endpoints. Port <!-- Port for Google Web APIs, "Google. Search" --> <port. Type name="Google. Search. Port"> <operation name="do. Get. Cached. Page"> <input message="typens: do. Get. Cached. Page"/> <output message="typens: do. Get. Cached. Page. Response"/> </operation> <operation name="do. Spelling. Suggestion"> <input message="typens: do. Spelling. Suggestion"/> <output message="typens: do. Spelling. Suggestion. Response"/> </operation> <operation name="do. Google. Search"> <input message="typens: do. Google. Search"/> <output message="typens: do. Google. Search. Response"/> </operation> </port. Type>
Binding – Concrete protocol and data format spec for a port Type Bindings <!-- Binding for Google Web APIs - RPC, SOAP over HTTP --> <binding name="Google. Search. Binding" type="typens: Google. Search. Port"> <soap: binding style="rpc" transport="http: //schemas. xmlsoap. org/soap/http"/> <operation name="do. Google. Search"> <soap: operation soap. Action="urn: Google. Search. Action"/> <input> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </input> <output> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </output> </operation> </binding> <operation name="do. Get. Cached. Page"> <soap: operation soap. Action="urn: Google. Search. Action"/> <input> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </input> <output> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </output> </operation> <operation name="do. Spelling. Suggestion"> <soap: operation soap. Action="urn: Google. Search. Action"/> <input> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </input> <output> <soap: body use="encoded" namespace="urn: Google. Search" encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> </output> </operation>
Service – Specifies web addresses Service <!-- Endpoint for Google Web APIs --> <service name="Google. Search. Service"> <port name="Google. Search. Port" binding="typens: Google. Search. Binding"> <soap: address location="http: //api. google. com/search/beta 2"/> </port> </service>
Java 2 WSDL & WSDL 2 Java �Fortunately, you can automagically use WSDL �Java 2 WSDL: setting up service: � Write your service class. � Call Java 2 WSDL. �WSDL 2 Java: � Call WSDL 2 Java on the required WSDL, � Import and use the generated library. �Google has already done this for you, so you can import their library
Using WSDL Stubs Web Services Engine Application Skeletons WSDL 2 Java import … <? xml … ? > <definitions> … <types>… <messages> … … WSDL Java 2 WSDL public class service { …
Google Web Services Example [servlet imports] import com. google. soap. search. *; public class Google. Example extends Http. Servlet { private static String client. Key = “ google-key"; . . . do. Get (. . . request, . . . response) throws. . . { [ set content type, get writer, output doctype… ] out. println("<html><head><title>Google Example</title></head><body>"); [ check params, call web services, response output ] } }
Check Parameters String op = request. get. Parameter("op"); String arg = request. get. Parameter("arg"); if ( (op != null) && (arg!= null) && (!op. equals("")) && (!arg. equals(""))) { [Call Web Service, Display Results] } else { out. println("Parameter Missing or Empty"); } out. println("</body></html>"); out. close();
Exception Handling try { [ web services actions ] } catch (Google. Search. Fault f) { out. println("The call to the Google Web APIs failed: "); out. println(f. to. String()); } catch (Exception e) { out. println("Unanticipated Exception"); e. print. Stack. Trace(out); }
Setting up Google. Search s = new Google. Search(); s. set. Key(client. Key);
Spelling Web Service else if (op. equals. Ignore. Case("spell")) { out. println("<hr><h 2>Spelling Suggestion</h 2><hr>"); String suggestion = s. do. Spelling. Suggestion(arg); out. println(arg + " ==> " + suggestion); } else { out. println("Unknown Command: " + op); }
Simplified Spelling Request <? xml version='1. 0' encoding='UTF-8'? > <Envelope> <Body> <do. Spelling. Suggestion> <key type="string">0000000000000000</key> <phrase type="string">britney speers</phrase> </do. Spelling. Suggestion> </Body> </Envelope>
Example Spelling Request <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsi="http: //www. w 3. org/1999/XMLSchema-instance" xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Spelling. Suggestion xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style= "http: //schemas. xmlsoap. org/soap/encoding/"> <key xsi: type="xsd: string"> 0000000000000000 </key> <phrase xsi: type="xsd: string">britney speers</phrase> </ns 1: do. Spelling. Suggestion> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Example Spelling Response <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsi="http: //www. w 3. org/1999/XMLSchema-instance" xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Spelling. Suggestion. Response xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"> <return xsi: type="xsd: string">britney spears</return> </ns 1: do. Spelling. Suggestion. Response> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Cache Web Service else if (op. equals. Ignore. Case("cached")) { out. println("<hr><h 2>Cached Page</h 2><hr>"); byte [] cached. Bytes = s. do. Get. Cached. Page(arg); String cached. String = new String(cached. Bytes); out. println(cached. String); }
Example Cached Page Request <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV=“http: //schemas. xmlsoap. org/soap/envelope/” xmlns: xsi=“http: //www. w 3. org/1999/XMLSchema-instance” xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Get. Cached. Page xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"> <key xsi: type="xsd: string">0000000000000000</key> <url xsi: type="xsd: string">http: //www. google. com/</url> </ns 1: do. Get. Cached. Page> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Example Cached Page Response <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsi="http: //www. w 3. org/1999/XMLSchema-instance" xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Get. Cached. Page. Response xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"> <return xmlns: ns 2="http: //schemas. xmlsoap. org/soap/encoding/" xsi: type="ns 2: base 64"> PEJBU 0 Ug. SFJFRj 0 ia. HR 0 c. Dov. L 3 d 3 dy 5 nb 29 nb. GUu. Y 29 t. Ly. I+PHRh. Ymxl. IGJvcm. Rlcj 0 x. IHdp. ZHRo. PTEw … em. U 9 LTI+IC 0 g. U 2 Vhcm. Noa. W 5 n. IDIs. MDcz. LDQx. OCwy. MDQgd 2 Vi. IHBh. Z 2 Vz. PC 9 mb 250 Pjwv. Y 2 Vud. GVy. Pjwv. Ym 9 ke. T 48 L 2 h 0 b. Ww+DQo= </return> </ns 1: do. Get. Cached. Page. Response> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Base-64 Encoded Text PEJBU 0 Ug. SFJFRj 0 ia. HR 0 c. Dov. L 3 d 3 dy 5 nb 29 nb. GUu. Y 29 t. Ly. I+PHRh. Ymxl. IGJvcm. Rlcj 0 x. IHdp. ZHRo. PTEw. MCU+PHRy. Pjx 0 ZD 48 d. GFib. GUg. Ym 9 y. ZGVy. PTEg. Ymdjb 2 xvcj 0 j. Zm. Zm. IGNlb. Gxw YWRka. W 5 n. PTEw. IGNlb. Gxzc. GFja. W 5 n. PTAgd 2 lkd. Gg 9 MTAw. JSBjb 2 xvcj 0 j. Zm. Zm. Pjx 0 cj 48 d. GQ+PGZvbn. Qg. Zm. Fj. ZT 1 hcmlhb. Cxz. YW 5 z. LXNlcmlm. IGNvb. G 9 y. PWJs. YWNr. IHNpem. U 9 LTE+V Ghpcy. Bpcy. A 8 Yj 48 Zm 9 ud. CBjb 2 xvcj 0 j. MDAz. OWI 2 Pkc 8 L 2 Zvbn. Q+IDxmb 250 IGNvb. G 9 y. PSNj. NDEy. MDA+bzwv. Zm 9 ud. D 4 g. PGZvbn. Qg. Y 29 sb 3 I 9 I 2 Yz. Ux. OD 5 v. PC 9 mb 250 Pi. A 8 Zm 9 ud. CBjb 2 xvcj 0 j. MDAz. O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Um. Vzb 3 Vy. Y 2 Vz. PC 9 h. Pi. At. IDxh. IGhy. ZWY 9 L 2 Fib 3 V 0 Lmh 0 b. Ww+Sm 9 icywg. UHJlc 3 Ms. IENvb 2 wg. U 3 R 1 Zm. Yu. Li 48 L 2 E +PC 9 mb 250 Pgo 8 c. D 48 Zm 9 ud. CBza. Xpl. PS 0 y. Pi. Zjb 3 B 5 Oz. Iw. MDIg. R 29 v. Z 2 xl. PC 9 mb 250 Pjxmb 250 IHNpem. U 9 LTI+IC 0 g. U 2 Vhcm. Noa. W 5 n. IDIs. MDcz. LDQx. OCwy. MDQgd 2 Vi. IHBh. Z 2 Vz. PC 9 mb 250 Pj wv. Y 2 Vud. GVy. Pjwv. Ym 9 ke. T 48 L 2 h 0 b. Ww+DQo= http: //en. wikipedia. org/wiki/Base 64 Discuss: is Base 64 encoded data “safe”
Search Web Service if (op. equals. Ignore. Case("search")) { out. println("<hr><h 2>Google Search Results</h 2><hr>"); s. set. Query. String(arg); Google. Search. Result r = s. do. Search(); out. println("Results “ + r. get. Start. Index() + " to " + r. get. End. Index() + " of "); if (!r. get. Estimate. Is. Exact()) { out. println(" an estimated "); } out. println(r. get. Estimated. Total. Results. Count() + " possible. "); Google. Search. Result. Element[] results = r. get. Result. Elements(); for (int i=0; i<results. length; i++) { out. println("<p>"); out. println(results[i]); out. println("</p>"); } }
Simplified Search Request <? xml version='1. 0' encoding='UTF-8'? > <Envelope> <Body> <do. Google. Search> <key type="string">0000000000000000</key> <q type="string">shrdlu winograd maclisp teletype</q> <start type="int">0</start> <max. Results type="int">10</max. Results> <filter type="boolean">true</filter> <restrict type="string"></restrict> <safe. Search type="boolean">false</safe. Search> <lr type="string"></lr> <ie type="string">latin 1</ie> <oe type="string">latin 1</oe> </do. Google. Search> </Body> </Envelope>
Example Search Request <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsi="http: //www. w 3. org/1999/XMLSchema-instance" xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Google. Search xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"> <key xsi: type="xsd: string">0000000000000000</key> <q xsi: type="xsd: string">shrdlu winograd maclisp teletype</q> <start xsi: type="xsd: int">0</start> <max. Results xsi: type="xsd: int">10</max. Results> <filter xsi: type="xsd: boolean">true</filter> <restrict xsi: type="xsd: string"></restrict> <safe. Search xsi: type="xsd: boolean">false</safe. Search> <lr xsi: type="xsd: string"></lr> <ie xsi: type="xsd: string">latin 1</ie> <oe xsi: type="xsd: string">latin 1</oe> </ns 1: do. Google. Search> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Example Search Response <? xml version='1. 0' encoding='UTF-8'? > <SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsi="http: //www. w 3. org/1999/XMLSchema-instance" xmlns: xsd="http: //www. w 3. org/1999/XMLSchema"> <SOAP-ENV: Body> <ns 1: do. Google. Search. Response xmlns: ns 1="urn: Google. Search" SOAP-ENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"> <return xsi: type="ns 1: Google. Search. Result"> <document. Filtering xsi: type="xsd: boolean">false</document. Filtering> <estimated. Total. Results. Count xsi: type="xsd: int">3</estimated. Total. Results. Count> <directory. Categories xmlns: ns 2="http: //schemas. xmlsoap. org/soap/encoding/" xsi: type="ns 2: Array" ns 2: array. Type="ns 1: Directory. Category[0]"></directory. Categories> <search. Time xsi: type="xsd: double">0. 194871</search. Time> <result. Elements xmlns: ns 3="http: //schemas. xmlsoap. org/soap/encoding/" xsi: type="ns 3: Array" ns 3: array. Type="ns 1: Result. Element[3]">. . . </result. Elements> <end. Index xsi: type="xsd: int">3</end. Index> <search. Tips xsi: type="xsd: string"></search. Tips> <search. Comments xsi: type="xsd: string"></search. Comments> <start. Index xsi: type="xsd: int">1</start. Index> <estimate. Is. Exact xsi: type="xsd: boolean">true</estimate. Is. Exact> <search. Query xsi: type="xsd: string">shrdlu winograd maclisp teletype</search. Query> </return> </ns 1: do. Google. Search. Response> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Example <result. Elements> <item xsi: type="ns 1: Result. Element"> <cached. Size xsi: type="xsd: string">12 k</cached. Size> <host. Name xsi: type="xsd: string"></host. Name> <snippet xsi: type="xsd: string"> < b> . . . < /b> on a simple dialog (via < b> teletype< /b> ) with a user, about a < b> . . . < /b> http: //hci. stanford. edu/< b> winograd< /b> /< b> shrdlu< /b> < br> . It is written in < b> Mac. Lisp< /b> , vintage 1970, and to < b> . . . < /b> </snippet> <directory. Category xsi: type="ns 1: Directory. Category"> <special. Encoding xsi: type="xsd: string"></special. Encoding> <full. Viewable. Name xsi: type="xsd: string"></full. Viewable. Name> </directory. Category> <related. Information. Present xsi: type="xsd: boolean">true</related. Information. Present> <directory. Title xsi: type="xsd: string"></directory. Title> <summary xsi: type="xsd: string"></summary> <URL xsi: type="xsd: string">http: //hci. stanford. edu/cs 147/examples/shrdlu/</URL> <title xsi: type="xsd: string">< b> SHRDLU< /b> </title> </item>
Result Elements <item xsi: type="ns 1: Result. Element"> <cached. Size xsi: type="xsd: string">12 k</cached. Size> <host. Name xsi: type="xsd: string"></host. Name> <snippet xsi: type="xsd: string"> < b> . . . < /b> on a simple dialog (via < b> teletype< /b> ) with a user, about a < b> . . . < /b> http: //hci. stanford. edu/< b> winograd< /b> /< b> shrdlu< /b> < br> . It is written in < b> Mac. Lisp< /b> , vintage 1970, and to < b> . . . < /b> </snippet> <directory. Category xsi: type="ns 1: Directory. Category"> <special. Encoding xsi: type="xsd: string"></special. Encoding> <full. Viewable. Name xsi: type="xsd: string"></full. Viewable. Name> </directory. Category> <related. Information. Present xsi: type="xsd: boolean">true</related. Information. Present> <directory. Title xsi: type="xsd: string"></directory. Title> <summary xsi: type="xsd: string"></summary> <URL xsi: type="xsd: string">http: //hci. stanford. edu/cs 147/examples/shrdlu/</URL> <title xsi: type="xsd: string">< b> SHRDLU< /b> </title> </item> <item xsi: type="ns 1: Result. Element"> <cached. Size xsi: type="xsd: string">12 k</cached. Size> <host. Name xsi: type="xsd: string"></host. Name> <snippet xsi: type="xsd: string"> < b> . . . < /b> on a simple dialog (via < b> teletype< /b> ) with a user, about a < b> . . . < /b> http: //hci. stanford. edu/< b> winograd< /b> /< b> shrdlu< /b> /code< br> . It is written in < b> Mac. Lisp< /b> , vintage 1970, and to < b> . . . < /b> </snippet> <directory. Category xsi: type="ns 1: Directory. Category"> <special. Encoding xsi: type="xsd: string"></special. Encoding> <full. Viewable. Name xsi: type="xsd: string"></full. Viewable. Name> </directory. Category> <related. Information. Present xsi: type="xsd: boolean">true</related. Information. Present> <directory. Title xsi: type="xsd: string"></directory. Title> <summary xsi: type="xsd: string"></summary> <URL xsi: type="xsd: string">http: //hci. stanford. edu/winograd/shrdlu</URL> <title xsi: type="xsd: string">< b> SHRDLU< /b> </title> </item> <item xsi: type="ns 1: Result. Element"> <cached. Size xsi: type="xsd: string">32 k</cached. Size> <host. Name xsi: type="xsd: string"></host. Name> <snippet xsi: type="xsd: string"> < b> . . . < /b> man and woman through < b> teletype< /b> and has to < b> . . . < /b> human diseases) 1970* Terry < b> Winograd' s< /b> < b> SHRDLU< /b> < br> (Natural Language Processing < b> . . . < /b> Lisp Machine Lisp, < b> Mac. Lisp< /b> , NIL, S-1 < b> . . . < /b> </snippet> <directory. Category xsi: type="ns 1: Directory. Category"> <special. Encoding xsi: type="xsd: string"></special. Encoding> <full. Viewable. Name xsi: type="xsd: string"></full. Viewable. Name> </directory. Category> <related. Information. Present xsi: type="xsd: boolean">true</related. Information. Present> <directory. Title xsi: type="xsd: string"></directory. Title> <summary xsi: type="xsd: string"></summary> <URL xsi: type="xsd: string">http: //www. trentu. ca/csd/newsarchives/trentu/csp/cr 350/79</URL> <title xsi: type="xsd: string"></title> </item>
More References �Java XML Tutorial � http: //java. sun. com/xml/tutorial_intro. html �Apache Axis User Guide � http: //ws. apache. org/axis/java/user-guide. html �Google Search API � http: //www. google. com/apis/ �Java Web Services Tutorial � http: //java. sun. com/webservices/docs/1. 6/tutorial/doc/index. html
- Slides: 36