WS-I Testing Tools
技術解説
ビーコン
IT
岩本幸男
Testing Toolの構成(1)
Port番号
で切替
Testing Toolの構成(2)
Testing Tools V1.0 User Guide より抜粋
Demo:Java環境でのTesting Tools
サーバ
クライアント
log.
xml
report.
xml
Analyzer
Sample
SampleWSI
ab+‘日本語’+cd
Monitor
SOAPメッセージ
‘日本語’
‘ab日本語cd’
How to use Testing Tools (1)
以下のサイトから使用する
Testing Toolsのセットをダウ
ンロードする
WS-I Testing Tools - Final
How to use Testing Tools (2)
設定に際して必要な事項の確認(1)
Monitorがlistenするポート番号
→ クライアントがアクセスする際のアドレス:ポート
ex) http://localhost:
9090
/HelloWorld.jws
テスト対象の
Webサービスのエンドポイント
ex)
http://localhost:8080
/HelloWorld.jws
テスト対象の
WebサービスのWSDL文書のURL
ex)
http://localhost:8080/HelloWorld.jws?wsdl
設定に際して必要な事項の確認(2)
ツール実行時のカレントディレクトリ
ex) c:¥wsi-test-tools¥java¥bin
トレースログファイルの出力先
ex) c:¥wsi-test-tools¥java¥samples
コンフォーマンスレポートの出力先
ex) C:¥wsi-test-tools¥java¥sample
日本語
Basic Profileの参照先
ex)
http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a-ja.html
Monitor Toolの設定(1)
Monitorの基本設定
<wsi-monConfig:configuration
xmlns:wsi-monConfig="http://www.ws-i.org/testing/2003/03/monitorConfig/">
<wsi-monConfig:comment>
This configuration file is used to test the WS-I sample applications running on a single system.
</wsi-monConfig:comment>
<wsi-monConfig:logFile replace="true" location=“
../samples/log.xml
">
<wsi-monConfig:addStyleSheet href=“
../../common/xsl/log.xsl
" type="text/xsl"/>
</wsi-monConfig:logFile>
<wsi-monConfig:logDuration>600</wsi-monConfig:logDuration>
<wsi-monConfig:cleanupTimeoutSeconds>3</wsi-monConfig:cleanupTimeoutSeconds>
</wsi-monConfig:configuration>
Monitor Toolの設定(2)
Monitorのリクエスト転送設定
<wsi-monConfig:manInTheMiddle>
<wsi-monConfig:redirect>
<wsi-monConfig:comment>
This is a redirect example for local Retailer Sample App on port
8080.
</wsi-monConfig:comment>
<wsi-monConfig:listenPort>
9090
</wsi-monConfig:listenPort>
<wsi-monConfig:schemeAndHostPort>
http://localhost:8080
</wsi-monConfig:schemeAndHostPort>
<wsi-monConfig:maxConnections>
1000
</wsi-monConfig:maxConnections>
<wsi-monConfig:readTimeoutSeconds>
15
</wsi-monConfig:readTimeoutSeconds>
</wsi-monConfig:redirect>
Analyzer Toolの設定(1)
WSDLを確認
<wsdl:binding name="
HelloWorldSoapBinding
" type="impl:HelloWorld">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="helloRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="helloResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:8080/axis/HelloWorld.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
Analyzer Toolの設定(2)
Analyzerの基本設定
<wsi-analyzerConfig:verbose>false</wsi-analyzerConfig:verbose>
<wsi-analyzerConfig:assertionResults type="all" messageEntry="true" failureMessage="true"/>
<wsi-analyzerConfig:reportFile replace="true" location="
../samples/report.xml
">
<wsi-analyzerConfig:addStyleSheet href="
../../common/xsl/report.xsl
" type="text/xsl"/>
</wsi-analyzerConfig:reportFile>
<wsi-analyzerConfig:testAssertionsFile>
../../common/profiles/BasicProfileTestAssertions.xml
</wsi-analyzerConfig:testAssertionsFile>
<wsi-analyzerConfig:logFile correlationType="endpoint">
../samples/log.xml
Analyzer Toolの設定(3)
AnalyzerのWebサービス参照設定
<wsi-analyzerConfig:wsdlReference>
<wsi-analyzerConfig:wsdlElement type="
binding
"
namespace="
http://localhost:8080/axis/HelloWorld.jws
">
HelloWorldSoapBinding
</wsi-analyzerConfig:wsdlElement>
<wsi-analyzerConfig:wsdlURI>
http://localhost:8080/axis/HelloWorld.jws?wsdl
</wsi-analyzerConfig:wsdlURI>
<wsi-analyzerConfig:serviceLocation>
http://localhost:8080/axis/HelloWorld.jws
</wsi-analyzerConfig:serviceLocation>
日本語版
Basic Profileの参照設定
Test Assertion Documentを編集
参照箇所をローカルファイルとすることも可能
ex)
c:¥wsi-test-tools¥common¥docs¥BasicProfile-1.0a-ja.html
最新版の参照設定(英語版)
<profileList>
<profile id="BP1" name="Basic Profile" version="1.0" revision="Final"
location="
http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a-ja.html
"/>
</profileList>
ツールの実行手順
実行時カレントディレクトリを
c:¥wsi-test-tools¥java¥bin
とする
WSI_HOME環境変数を設定
ex) set WSI_HOME=c:¥wsi-test-tools
Monitorツールの実行
monitor – config ../samples/monitorConfig.xml
Webサービスのリクエストを行う
→
Motniorツールでログの収集が完了
Analyzerツールの実行
analyzer – config ../samples/analyzerConfig.xml
Comformance Reportの確認
MonitorConfigについて
<wsi-monConfig:manInTheMiddle>
<wsi-monConfig:redirect>
<wsi-monConfig:comment>Sample App on port 8080.</wsi-monConfig:comment>
<wsi-monConfig:listenPort>
4040
</wsi-monConfig:listenPort>
①
<wsi-monConfig:schemeAndHostPort>
http://localhost:8080
</wsi-monConfig:schemeAndHostPort>
②
<wsi-monConfig:maxConnections>1000</wsi-monConfig:maxConnections>
<wsi-monConfig:readTimeoutSeconds>15</wsi-monConfig:readTimeoutSeconds>
</wsi-monConfig:redirect>
</wsi-monConfig:manInTheMiddle>
①Monitorのポート
localhost:4040
②Serverのポート
localhost:8080
①Monitorのポート
localhost:4040
②Serverのポート
localhost:8080
Monitorを停止するには
AnalyzerConfigについて
<wsi-analyzerConfig:testAssertionsFile>
../common/profiles/BasicProfileTestAssertions.xml
</wsi-analyzerConfig:testAssertionsFile>
<wsi-analyzerConfig:logFile correlationType="endpoint">
log.xml
①
</wsi-analyzerConfig:logFile>
<wsi-analyzerConfig:wsdlReference>
<wsi-analyzerConfig:wsdlElement type="port"
parentElementName="SampleServiceService"
namespace="http://localhost:8080/wsi/services/Sample">
Sample
②
</wsi-analyzerConfig:wsdlElement>
<wsi-analyzerConfig:wsdlURI>
http://localhost:8080/wsi/services/Sample?wsdl
③
</wsi-analyzerConfig:wsdlURI>
</wsi-analyzerConfig:wsdlReference>
Analyzerは処理終了後自動的に終了する。
①Monitorの出力Logファイル名称
②WSDLのport句“Sample”を検査の対象とする
①Monitorの出力Logファイル名称
②WSDLのport句“Sample”を検査の対象とする
AXISによるデフォルトコール時のLog抜粋
Request
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getMessage soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://services.wsi_demo.beacon_it.co.jp">
<userName xsi:type="xsd:string">ゲストユーザ</userName> </ns1:getMessage> </soapenv:Body></soapenv:Envelope> soap:encodingStyle 属性を含んではなら ない (MUST NOT) Response <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getMessageResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://services.wsi_demo.beacon_it.co.jp"> <ns1:getMessageReturn xsi:type="xsd:string">[2004-32-20 16:04:02]: こんにちは、ゲストユーザさん。 こちらはjp.co.beacon_it.wsi_demo.services.SampleServiceです。</ns1:getMessageReturn> </ns1:getMessageResponse> ns1のNameSpaceが WSDLの内容と異な る。
AnalyzerによるBP適合性分析(1)
passedColor:
green
failedColor:
red
warningColor:
orange
notApplicableColor: blue
missingInputColor:
brown
Report中の色の意味
スタイルシートの指定
(AnalyzerConfig)
Report
TestAssertions
BasicProfile
WS-I BPに準拠させたコール時のLog抜粋
Request
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <getMessage xmlns="http://www.beacon-it.co.jp/schema/wsi/demo/"> <userName xmlns="">ゲストユーザ</userName> </getMessage> </soapenv:Body></soapenv:Envelope> Response <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getMessageResponse xmlns="http://www.beacon-it.co.jp/schema/wsi/demo/">
<getMessageReturn xmlns="">[2004-34-20 16:04:49]: こんにちは、ゲストユーザさん。
Testにpassした場合のAnalyzerReport
Resultに「passed」
と表示される
Deployment Descriptorの比較
Sample
<service name="Sample" provider="java:RPC" >
<parameter name="className" value="jp.co.beacon_it.wsi_demo.services.SampleService"/> <parameter name="allowedMethods" value="getMessage"/>
</service>
SampleWSI
<service name="SampleWSI" provider="java:RPC" style="rpc" use="literal">
<parameter name="wsdlTargetNamespace" value="http://www.beacon-it.co.jp/schema/wsi/demo/"/> <parameter name="className" value="jp.co.beacon_it.wsi_demo.services.SampleService"/>
<parameter name="allowedMethods" value="getMessage"/>
<operation name="getMessage" qname="getMessage"
returnQName="getMessageReturn" returnType="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <parameter name="userName" type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
Operationに対し
てNameSpaceを
WSDLの比較
Sample - <wsdl:operation name="getMessage"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getMessageRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.wsi_demo.beacon_it.co.jp" use="encoded" /> </wsdl:input> - <wsdl:output name="getMessageResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://127.0.0.1:8080/wsi/services/Sample" use="encoded" /> </wsdl:output> </wsdl:operation>soap:encodingStyl
e 属性を含んでは
ならない
SampleWSI - <wsdl:operation name="getMessage"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getMessageRequest"><wsdlsoap:body namespace="http://www.beacon-it.co.jp/schema/wsi/demo/" use="literal" /> </wsdl:input>
- <wsdl:output name="getMessageResponse">
<wsdlsoap:body namespace="http://www.beacon-it.co.jp/schema/wsi/demo/" use="literal" /> </wsdl:output>