9. quot; Have you ever had a dream,
Neo, that you were so sure
was real?
What if you were unable to
wake from that dream, Neo?
How would you know the
difference between the
dream world and the real. quot;
Morpheus
10. quot; You take the blue pill, the
story ends; you wake up in
your bed and believe...
whatever you want to believe.
You take the red pill, you
stay in Wonderland; and I
show you how deep the
rabbit hole goes. quot;
Morpheus
25. quot; I’ll let you in on a little secret.
Being the one is just like being
love.
No one can tell you you’re in
love.
You just knew it…
through and through.
Balls to bones. quot;
The Oracle
26. Stub / Skeleton
• 離れていても同じように。
Main program Sub program
• なるべく簡単に出来るための…
27. Stub / Skeleton ( Tie )
• そのための仕組み。
Interface Interface
Language Language
Main program Sub program
Stub Skeleton
Runtime Runtime
Transport
28. Web Services
• JAX-RPC
WSDL WSDL
Web Service Web Service
Client
Implementation
Application Stub
Tie (Skeleton)
JAX-RPC JAX-RPC
Runtime Runtime
SOAP/HTTP
48. quot; But this is not a reason,
this is not a why,
The keymaker himself, his
very nature, is a means, it
is not an end. quot;
Merovingian
49. Google Web Services
• Google Web APIs (beta)
– Google 提供のWebサービスのベータ版
– スペルの候補を教えてくれる?みたい。
– キーワードでの検索などができる?みたい。
• Webサービスのクライアントをつくってみる。
– 標準であるJAX-RPC のAPIをつかう。
– 予めStubを作成しておいて、それに面倒な事
は、お任せしたプログラムを作成する。
66. Google WSDL cont.
• http://api.google.com/GoogleSearch.wsdl
:
<!-- Messages for Google Web APIs - cached page, search, spelling. -->
<message name=quot;doSpellingSuggestionquot;>
<part name=quot;keyquot; type=quot;xsd:stringquot; />
<part name=quot;phrasequot; type=quot;xsd:stringquot; />
</message>
<!-- Port for Google Web APIs, quot;GoogleSearchquot; -->
<portType name=quot;GoogleSearchPortquot;>
<!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->
<binding name=quot;GoogleSearchBindingquot;
type=quot;typens:GoogleSearchPortquot;>
:
67. Google WSDL cont.
• http://api.google.com/GoogleSearch.wsdl
:
<!-- Endpoint for Google Web APIs -->
<service name=quot;GoogleSearchServicequot;>
<port name=quot;GoogleSearchPortquot;
binding=quot;typens:GoogleSearchBindingquot;>
<soap:address location=
quot;http://api.google.com/search/beta2quot; />
</port>
</service>
</definitions>
68. quot; It is purpose that created us.
Purpose that connects us.
Purpose that pull us.
That guides us.
That drives us.
It is purpose that defines.
Purpose that bind us.quot;
Smith (not Agent)
76. Static Stub 2/4
Set a endpoint address
• サービスのアドレスを設定する。
stub._setProperty
(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
quot;http://api.google.com/search/beta2quot;);
• アドレスはURLをStringで指定する。
– http://api.google.com/search/beta2
77. Static Stub 3/4
Cast stub to the service
endpoint interface
• サービスエンドポイントインターフェースに
型変換する。
GoogleSearchPort google = (GoogleSearchPort)stub;
• これで該当のメソッドを呼び出す事が可能。
78. Static Stub 4/4
Coding a Client
• クライアントコードの一部
Stub stub =
(Stub) (new GoogleSearchService_Impl().getGoogleSearchPort());
endpointAddress = quot;http://api.google.com/search/beta2quot;;
stub._setProperty
(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
endpointAddress);
GoogleSearchPort google = (GoogleSearchPort)stub;
// Call doSpellingSuggestion of Google Web Services
String result
= google.doSpellingSuggestion(googleLicenseKey, phrase );
System.out.println( quot;==> Candidate : quot; + result );
84. quot; Almost no one comes down here.
Unless, of course, there’s a
problem.
That’s new it is with people.
Nobody cares how it works as
long as it works. quot;
Councillor Hamann
99. DII 1/6
Creates a Service object
• Serviceオブジェクトを生成する。
Service service =
factory.createService(new QName(qnameService));
• サービス名はWSDLでの service name
を Stringで指定する。
100. DII 2/6
Creates a Call object
• Call オブジェクトを生成する。
String qnamePort = quot;GoogleSearchPortquot;;
QName port = new QName(qnamePort);
Call call = service.createCall(port);
• ポート名はWSDLでの port name を
Stringで指定する。
101. DII 3/6
Set a endpoint address
• サービスエンドポイントアドレスを設定する。
call.setTargetEndpointAddress(quot;http://api.google.com/search/beta2quot;);
• アドレスはURLをStringで指定する。
– http://api.google.com/search/beta2
102. DII 4/6
Set a properties
• プロパティを設定する。
call.setProperty(Call.SOAPACTION_USE_PROPERTY,
new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, quot;quot;);
call.setProperty(ENCODING_STYLE_PROPERTY,
quot;http://schemas.xmlsoap.org/soap/encoding/quot;);
• 詳細は、SOAP及びWSDLを参照の事。
113. Philosophy
• EXISTENTIAL PHENOMENOLOGY
AND THE BRAVE NEW WORLD OF
THE MATRIX
– HUBERT DREYFUS & STEPHEN
DREYFUS
– http://whatisthematrix.warnerbros.com/
• PHILOSOPHY AND THE MATRIX
– http://whatisthematrix.warnerbros.com/rl_cm
p/phi.html
114. Resources
• Java Technology and Web Services
– http://java.sun.com/webservices/
• Java API for XML-Based RPC (JAX-
RPC) Downloads & Specifications
– http://java.sun.com/xml/downloads/jaxrpc.ht
ml
115. Resources
• Google Web APIs (beta)
– http://www.google.co.jp/apis/index.html
• Apache AXIS
– http://ws.apache.org/axis/index.html
116. Resources
• Web Services Description
Language (WSDL) 1.1
– http://www.w3.org/TR/wsdl
• Simple Object Access Protocol
(SOAP) 1.1
– http://www.w3.org/TR/soap/
117. quot; You knew what that mean?
It’s Latin.
Means, ‘Know thyself’. quot;
The Oracle