WSE 1.0、2.0 で リクエストのトレースをとる設定

WSE(Web Services Enhancements) とか今更ですが、備忘録に。
Soap拡張を使ってトレースしたものと、キャプチャツールを使ってリクエストを見た内容とでは結果が異なった。
MSDN SoapExtension クラス に載ってる TraceExtension では、リクエスト の SoapHeader が出力されなかった。
そこで、色々調べてると config ファイルにちょっと書けばトレース出来ることが判明。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <configSections>
  <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration,
          Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
          PublicKeyToken=31bf3856ad364e35" />
  <section name="microsoft.web.services" type="Microsoft.Web.Services.Configuration.WebServicesConfiguration,
          Microsoft.Web.Services, Version=1.0.0.0, Culture=neutral,
          PublicKeyToken=31bf3856ad364e35" />
 </configSections>
 <microsoft.web.services>
  <diagnostics>
   <trace enabled="true" input="./InputTrace.xml" output="./OutputTrace.xml"/>
  </diagnostics>
 </microsoft.web.services>
 <microsoft.web.services2>
  <diagnostics>
   <trace enabled="true" input="./InputTrace2.xml" output="./OutputTrace2.xml"/>
   <detailedErrors enabled="true"/>
  </diagnostics>
 </microsoft.web.services2>
</configuration>

MSDN <microsoft.web.services2> Element
WSE1 のは見つけられず…、体験談です。WSE3 でもきっと殆ど同じだと思います。MSDN <microsoft.web.services3> Element
※英語のページしかなかった…


ちなみに、WSE を使用しない System.Web.Services.Protocols.SoapHttpClientProtocol では、TraceExtension と キャプチャツールで見たリクエストの内容は同じでした。