このトピックの対象は、レガシ テクノロジに特定されています。XML Web サービスと XML Web サービス クライアントは以下を使用して作成してください。 Windows Communication Foundation.
SOAP 拡張機能を実際に構成している方法に基づいて、キャッシュされたデータを GetInitializer メソッド内で初期化するコード例を次に示します。属性を使って SOAP 拡張を構成する場合 (この例では TraceExtensionAttribute
)、属性で指定されたファイル名がキャッシュされます。構成ファイルを使って SOAP 拡張を構成する場合、Web サービスの型に基づいて、キャッシュされたファイル名が計算されます。
例
' When the SOAP extension is accessed for the first time, the XML
' Web service method it is applied to is accessed to store the file
' name passed in, using the corresponding SoapExtensionAttribute.
Public Overloads Overrides Function GetInitializer(methodInfo As _
LogicalMethodInfo, attribute As SoapExtensionAttribute) As Object
Return CType(attribute, TraceExtensionAttribute).Filename
End Function
' The extension was configured to run using a configuration file
' instead of an attribute applied to a specific Web service method.
' Return a file name, based on the class implementing the XML Web
' service's type.
Public Overloads Overrides Function GetInitializer(WebServiceType As _
Type) As Object
' Return a file name to log the trace information, based on the type.
Return "C:\" + WebServiceType.FullName + ".log"
End Function
// When the SOAP extension is accessed for the first time, the XML
// Web service method it is applied to is accessed to store the file
// name passed in, using the corresponding SoapExtensionAttribute.
public override object GetInitializer(LogicalMethodInfo methodInfo,
SoapExtensionAttribute attribute)
{
return ((TraceExtensionAttribute) attribute).Filename;
}
// The extension was configured to run using a configuration file instead of
// an attribute applied to a specific Web service method.
public override object GetInitializer(Type WebServiceType)
{
// Return a file name to log the trace information, based on the type.
return "C:\\" + WebServiceType.FullName + ".log";}