【发布时间】:2012-02-02 22:04:39
【问题描述】:
我有一个程序将数据发送到 Web 服务并将数据存储到 XML 文件中。我想知道是否有一个类或方法可以捕获前往服务的肥皂对象并将其转储到文本文件中。谁能告诉我该怎么做?
编辑 1:
好的,所以在浏览了评论中发布的主题后,我编辑了我的 web.config 文件,如下所示:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XML_New.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="username" value="admin"/>
<add key="password" value="admin"/>
</appSettings>
<connectionStrings/>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\logs\messages.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="420">
<filters>
<add nodeQuota="10"
xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
/soap:Envelope/soap:Header
</add>
</filters>
</messageLogging>
</diagnostics>
</system.serviceModel>
<system.web>
<compilation debug="true" >
</compilation>
<authentication mode="Forms" />
</system.web>
<applicationSettings>
<XML_New.Properties.Settings>
<setting name="XML_New_localhost_Service1" serializeAs="String">
<value>http://localhost:1689/Admin.asmx</value>
</setting>
</XML_New.Properties.Settings>
</applicationSettings>
</configuration>
该文件应记录到 c:\logs\messages.svclog 但由于某些原因它没有记录。有人知道为什么吗?
【问题讨论】:
-
还没有,不知道有没有办法除了通过wireshark看流量。
-
@MK 谢谢我看看这个,然后我有一个额外的问题。
标签: c# asp.net web-services soap