SOAP 扩展实现

SOAP Extension Implementation

关于 SOAP 扩展实现 我正在创建一个 class TraceException,其中根据此 link https://msdn.microsoft.com/enus/library/7w06t139(v=vs.100).aspx.

实现 SoapExtension 接口
and also configure web.config as below:

<configuration>
 <system.web>
   <webServices>
     <soapExtensionTypes>
      <add type="Logger.LoggerExtension,logger"
           priority="1"
           group="0" />
     </soapExtensionTypes>
    </webServices>
 </system.web>
</configuration>

but till i am not able to create log file for SOAP Request and Response

尝试这样实现。

根据 https://msdn.microsoft.com/enus/library/7w06t139(v=vs.100).aspx 创建 TraceExtension class。

使用以下 collmands wsdl /out 创建 Web 服务的代理 class:myProxyClass.cs http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL

像这样将 TraceExtension 放入 web 服务方法中,您要为 soap 请求和响应创建日志文件的方法

[TraceExtension, System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://stamps.com/xml/namespace/2017/04/swsim/swsimv62/AuthenticateUser", RequestNamespace = "http://stamps.com/xml/namespace/2017/04/swsim/swsimv62", ResponseNamespace = "http://stamps.com/xml/namespace/2017/04/swsim/swsimv62", 使用 = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

通过创建 Proxy 对象访问 web-service 方法 class