|
|
Web Services using apache axis2 報告人:高明權 DATE :2010/05/30 Released V1.00 BLOG:http://tommykao.blogspot.com EMAIL : MCK6214@gmail.com
Web Services Agenda Background Case 01: Say Hello, pojo Case 02: File Upload & Download Case 03: Using the SoapMonitor module Case 04: SSL Transport Security Case 05: Message Level Security Case 06: Customized Module Case 07: Stateful Case 08: Clustering 2 著作人:高明權
Case 04-B: enforce SSL Transport Security Sample code: webservices_workspace_03_B.zip 3 著作人:高明權
Enforce SSL Transport Security META-INF\Services.xml <serviceGroup> <service name="StockQuoteService" scope="application"> <description>Stock Quote Service</description> <parameter name="ServiceClass">sample.webservice.case04.StockQuoteService</parameter> <messageReceivers>…</messageReceivers> <!-- use rampart module --> <module ref="rampart" /> <wsp:Policy wsu:Id="UsernameTokenOverHTTPS" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> <wsp:ExactlyOne><wsp:All> <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy><sp:TransportToken> <wsp:Policy><sp:HttpsToken RequireClientCertificate="false" /></wsp:Policy> </sp:TransportToken></wsp:Policy> </sp:TransportBinding> </wsp:All></wsp:ExactlyOne> </wsp:Policy> </service> </serviceGroup> 著作人:高明權 4
直接連線測試 (HTTPS) 經由瀏覽器連線測試,連線方式為 https://<host>:<port>/axis2/services/<ServiceName>/<OperationName>?<parameters_key_pair> 本例為: https://localhost:8443/axis2/services/StockQuoteService/getStockQuote?symbol=goog 注意:透過 HTTP 直接連線測試,將無法取得服務 Test the StockQuote Web Service 1/2 著作人:高明權 5 正常情況下,透過 HTTPS 連線會出現類似的警告訊息,原因在於本金鑰為測試用途,正式對外服務前,應透過合法的 CA 機構申請金鑰。
Test the StockQuote Web Service 2/2 用 SoapUI 連線測試 建立新專案,選擇 [File]/[New soapUI Project] 專案名稱 : StockQuoteService WSDL路徑 : http://localhost:8080/axis2/services/StockQuoteService?wsdl 展開服務項目並著手編輯 soap request message 注意:請選擇連線方式為 https 送出 soap request message,並檢視回傳結果。 若採用 http連線將會回覆異常 若採用 https 連線將可看到回傳結果當中包含了 SSL 相關訊息 著作人:高明權 6
參考資料 JAVA Cryptography Apache Rampart Knowledge Base 著作人:高明權 7
以上為基礎,務必照表操課 Know-How, ExAct, Knowledge
| URL: |
No comments posted yet
Comments