Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Im folgenden Codebeispiel wird ein zwischengespeicherter Datenblock in der GetInitializer-Methode basierend auf der Konfiguration der SOAP-Erweiterung initialisiert. Wenn die SOAP-Erweiterung mithilfe eines Attributs konfiguriert wird, wie hier mit TraceExtensionAttribute, wird der im Attribut angegebene Dateiname zwischengespeichert. Wird die SOAP-Erweiterung mithilfe einer Konfigurationsdatei konfiguriert, dann wird der zwischengespeicherte Dateiname anhand des Typs des Webdiensts berechnet.
Beispiel
' 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";}
Siehe auch
Aufgaben
Exemplarische Vorgehensweise: Ändern der SOAP-Nachricht mit SOAP-Erweiterungen
.gif)
Copyright © 2007 by Microsoft Corporation. Alle Rechte vorbehalten.