构建安全的Xml Web Service系列之如何察看SoapMessage

简介: 原文:构建安全的Xml Web Service系列之如何察看SoapMessage    上一篇文章地址:构建安全的Xml Web Service系列一之初探使用Soap头 (5-22 12:53)          要分析Xml Web Service的安全性,首先要解决的问题是我们能了解和清楚Soap消息的格式和内容,如果获得不了SoapMessage,分析如何能构建安全Xml web service也就无从下手,即使分析出来,自己也可 能模模糊糊,不能定论。
原文: 构建安全的Xml Web Service系列之如何察看SoapMessage

    上一篇文章地址:构建安全的Xml Web Service系列一之初探使用Soap头 (5-22 12:53)    
     要分析Xml Web Service的安全性,首先要解决的问题是我们能了解和清楚Soap消息的格式和内容,如果获得不了SoapMessage,分析如何能构建安全Xml web service也就无从下手,即使分析出来,自己也可 能模模糊糊,不能定论。下面就分析下如何获得SoapMessage。
    首先介绍一个类-SoapExtension,msdn对这个类的备注为:ASP.NET 允许通过扩展性机制生成与 SOAP 相关的基础结构。ASP.NET SOAP 扩展结构以一种扩展为中心,该扩展可以在客户端或服务器上处理消息时在特定阶段中检查或修改消息。ASP.NET SOAP 扩展从 SoapExtension 类派生。GetInitializer 和 Initialize 方法提供其他可用机制,用于初始化 SOAP 扩展以增强性能。ProcessMessage 是大多数 SOAP 扩展的核心,原因是该方法在 SoapMessageStage 中定义的每一个阶段都被调用,从而使 SOAP 扩展得以执行所需的该特定 SOAP 扩展的行为。对于需要修改 SOAP 请求或 SOAP 响应的 SOAP 扩展,ChainStream 提供一个机会以接收要通过网络发送的建议数据。 仔细阅读这段文字,如果您以前开发过windows程序,那第一个应该想到的是:原来web service的处理机制和windows窗口程序的消息机制竟然有着一曲同工之妙。下面谈谈如何利用这个类,来截获Xml web Service请求和相应的Soap消息,从而看看xml web service的庐山真面目。
    首先大家先看看这个类,这个类完成的功能是将Xml Web Service通过扩展的方式,将每次的请求和响应的Soap消息通过日志的方式保存到文本文件中。日志记录的方式也有两种:
    1。针对每个WebMethod产生一个日志文件。
    2。针对每个WebService产生一个日志文件
 因为一个WebService可能包含一个或者多个WebMethod,所以如果指定两种方法都支持的话,那第二个日志两面应该包括第一个日志里面的内容,而有些情况下,是不需要对每个WebMethod都进行日志记录的,这时候采用第一种记录方式,增强了系统的灵活性。 
下面是扩展了的SoapExtension

img_a6339ee3e57d1d52bc7d02b338e15a60.gif   < webServices >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< soapExtensionTypes >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif          
< add  type ="Jillzhang.TraceExtension,Jillzhang"  priority ="1"   group ="High"    />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ soapExtensionTypes >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif      
</ webServices >
img_1c53668bcee393edac0d7b3b3daff1ae.gif img_405b18b4b6584ae338e0f6ecaf736533.gif 可以记录SoapMessage的SoapExtension
img_a6339ee3e57d1d52bc7d02b338e15a60.gifnamespace Jillzhang
img_a6339ee3e57d1d52bc7d02b338e15a60.gif{
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    public class TraceExtension: SoapExtension
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        static readonly string LogRoot = System.Configuration.ConfigurationManager.AppSettings["logRoot"];
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        Stream oldStream;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        Stream newStream;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        string filename;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 将请求流和响应流存到内存流中,已被调用
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="stream">包含 SOAP 请求或响应的内存缓冲区</param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<returns>它表示此 SOAP 扩展可以修改的新内存缓冲区。</returns>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override Stream ChainStream(Stream stream)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            oldStream = stream;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            newStream = new MemoryStream();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            return newStream;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 在Xml Web Service第一次运行的时候,一次性的将通过TraceExtensionAttribute传递进来的
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 保存日志信息的文件名初始化
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="methodInfo">应用 SOAP 扩展的 XML Web services 方法的特定函数原型</param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="attribute">应用于 XML Web services 方法的 SoapExtensionAttribute</param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<returns>SOAP 扩展将对其进行初始化以用于缓存</returns>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            return ((TraceExtensionAttribute)attribute).Filename;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 替代为每个方法配置的保存SoapMessage文件名,而是将整个网络服务
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 的SoapMessage都保存到一个日志文件中,这个文件路径需要在Web Service
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 的配置文件中web.config指出,如
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<appSettings>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        ///  
<add key="logRoot" value="c:\\serviceLog"/>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</appSettings>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="WebServiceType">网络服务的类型</param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<returns>用于保存日志记录的文件路径</returns>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override object GetInitializer(Type WebServiceType)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            //return LogRoot.TrimEnd('\\') + "\\" + WebServiceType.FullName + ".log";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            return LogRoot.TrimEnd('\\')+"\\"+ WebServiceType.FullName + ".log";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        //获得文件名,并将其保存下来
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override void Initialize(object initializer)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            filename = (string)initializer;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 当数据还为Soap格式的时候,将数据写入日志
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif       /// 
<param name="message"></param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override void ProcessMessage(SoapMessage message)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            switch (message.Stage)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                case SoapMessageStage.BeforeSerialize:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    break;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                case SoapMessageStage.AfterSerialize:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    WriteOutput(message);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    break;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                case SoapMessageStage.BeforeDeserialize:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    WriteInput(message);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    break;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                case SoapMessageStage.AfterDeserialize:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    break;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                default:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    throw new Exception("invalid stage");
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 将SoapMessage写入到日志文件
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="message"></param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public void WriteOutput(SoapMessage message)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            newStream.Position = 0; 
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            //创建或追加记录文件
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            FileStream fs = new FileStream(filename, FileMode.Append,
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                FileAccess.Write);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            StreamWriter w = new StreamWriter(fs);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            string soapString = (message is SoapServerMessage) ? "Soap响应" : "Soap请求";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.WriteLine("-----" + soapString + " 在 " + DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒"));
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.Flush();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            Copy(newStream, fs);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.Close();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            newStream.Position = 0;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            Copy(newStream, oldStream);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public void WriteInput(SoapMessage message)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            Copy(oldStream, newStream);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            FileStream fs = new FileStream(filename, FileMode.Append,
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                FileAccess.Write);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            StreamWriter w = new StreamWriter(fs);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            string soapString = (message is SoapServerMessage) ?
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                 "Soap请求" : "Soap响应";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.WriteLine("-----" + soapString +
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                " 在 " + DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒"));
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.Flush();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            newStream.Position = 0;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            Copy(newStream, fs);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            w.Close();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            newStream.Position = 0;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 拷贝流到流
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="from"></param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<param name="to"></param>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        void Copy(Stream from, Stream to)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            TextReader reader = new StreamReader(from);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            TextWriter writer = new StreamWriter(to);
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            writer.WriteLine(reader.ReadToEnd());
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            writer.Flush();
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    //创建一个用于在WebMethod上使用的SoapExtension属性
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    [AttributeUsage(AttributeTargets.Method)]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    public class TraceExtensionAttribute : SoapExtensionAttribute
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        private string filename = "c:\\log.txt";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        private int priority;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 扩展类型
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override Type ExtensionType
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            get { return typeof(TraceExtension); }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 优先级 
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public override int Priority
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            get { return priority; }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            set { priority = value; }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
<summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 用于记录该WebMethod的SoapMessage的文件的绝对路径
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 默认为c:\\log.txt;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        /// 
</summary>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public string Filename
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            get
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                return filename;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            set
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                filename = value;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    }   
img_a6339ee3e57d1d52bc7d02b338e15a60.gif}
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
结下来,介绍一个如何使用该类:
如果要使让TraceExtension支持第一种记录方式,需要作的额外工作为:
只需要在要记录SoapMessage的WebMethod添加如下的Attribute
[TraceExtension(Filename="d:\\data.xml",Priority=0)]
当然路径,您可以自己设定
前一节的WebMethod就变成了
img_1c53668bcee393edac0d7b3b3daff1ae.gif img_405b18b4b6584ae338e0f6ecaf736533.gif 添加了针对WebMethod日志记录的WebMethod
img_a6339ee3e57d1d52bc7d02b338e15a60.gif public MySoapHeader header = new MySoapHeader();        
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        [WebMethod]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        [SoapHeader("header")]   
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        [TraceExtension(Filename="d:\\data.xml",Priority=0)]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        public string HelloWorld()
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            if (header == null)
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                return "您没有设置SoapHeader,不能正常访问此服务!";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            if (header.UserName != "jillzhang" || header.Pwd != "123456")
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            {
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                return "您提供的身份验证信息有误,不能正常访问此服务!";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            }
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            return "Hello World";
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        }
调用下该WebService,便在d盘产生一个data.xml文件,里面的内容为:
img_1c53668bcee393edac0d7b3b3daff1ae.gif img_405b18b4b6584ae338e0f6ecaf736533.gif 日志记录
img_a6339ee3e57d1d52bc7d02b338e15a60.gif-----Soap请求 在 2007年05月25日 09时06分29秒
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><MySoapHeader xmlns="http://tempuri.org/"><UserName>jillzhang</UserName><Pwd>123456</Pwd></MySoapHeader></soap:Header><soap:Body><HelloWorld xmlns="http://tempuri.org/" /></soap:Body></soap:Envelope>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif-----Soap响应 在 2007年05月25日 09时06分29秒
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><HelloWorldResponse xmlns="http://tempuri.org/"><HelloWorldResult>Hello World</HelloWorldResult></HelloWorldResponse></soap:Body></soap:Envelope>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
如何采用第二种方法,让WebService的每个WebMethod都能记录日志
需要在Web.config中作如下的设定
首先添加如下节点
img_a6339ee3e57d1d52bc7d02b338e15a60.gif   < webServices >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< soapExtensionTypes >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif          
< add  type ="Jillzhang.TraceExtension,Jillzhang"  priority ="1"   group ="High"    />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ soapExtensionTypes >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif      
</ webServices >
然后通过配置设定日志文件保留的路径:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < appSettings >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< add  key ="logRoot"  value ="d:" />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif  
</ appSettings >
找到日志文件,里面也赫然有着SoapMessage的真面目。通过以上方法,大家可以清晰地分析到SoapMessage的具体格式和内容,知道了这个以后,对付Web Service,您就可以随心应手,随心所欲,如果你愿意,你甚至也可以“强奸"一次webservice,哈哈!
上一篇文章地址: 构建安全的Xml Web Service系列一之初探使用Soap头 (5-22 12:53)
附:终于买上房了,虽然买的过程很累,但现在还是很Happy!
相关实践学习
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
目录
相关文章
|
前端开发 JavaScript 开发者
JavaScript:构建动态Web的核心力量
JavaScript:构建动态Web的核心力量
|
Web App开发 监控 安全
OSS客户端签名直传实践:Web端安全上传TB级文件方案(含STS临时授权)
本文深入解析了客户端直传技术,涵盖架构设计、安全机制、性能优化等方面。通过STS临时凭证与分片上传实现高效安全的文件传输,显著降低服务端负载与上传耗时,提升系统稳定性与用户体验。
1395 2
|
12月前
|
安全 Linux iOS开发
Burp Suite Professional 2025.10 发布 - Web 应用安全、测试和扫描
Burp Suite Professional 2025.10 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
719 3
|
安全 Linux iOS开发
Burp Suite Professional 2025.9 发布 - Web 应用安全、测试和扫描
Burp Suite Professional 2025.9 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
756 0
Burp Suite Professional 2025.9 发布 - Web 应用安全、测试和扫描
|
安全 Linux iOS开发
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
934 0
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
|
开发框架 JSON 中间件
Go语言Web开发框架实践:使用 Gin 快速构建 Web 服务
Gin 是一个高效、轻量级的 Go 语言 Web 框架,支持中间件机制,非常适合开发 RESTful API。本文从安装到进阶技巧全面解析 Gin 的使用:快速入门示例(Hello Gin)、定义 RESTful 用户服务(增删改查接口实现),以及推荐实践如参数校验、中间件和路由分组等。通过对比标准库 `net/http`,Gin 提供更简洁灵活的开发体验。此外,还推荐了 GORM、Viper、Zap 等配合使用的工具库,助力高效开发。
|
存储 安全 JavaScript
Web Storage有哪些安全风险?
Web Storage有哪些安全风险?
|
XML 前端开发 Java
讲解SSM的xml文件
本文详细介绍了SSM框架中的xml配置文件,包括springMVC.xml和applicationContext.xml,涉及组件扫描、数据源配置、事务管理、MyBatis集成以及Spring MVC的视图解析器配置。
460 1
|
XML Java 数据格式
Spring5入门到实战------7、IOC容器-Bean管理XML方式(外部属性文件)
这篇文章是Spring5框架的实战教程,主要介绍了如何在Spring的IOC容器中通过XML配置方式使用外部属性文件来管理Bean,特别是数据库连接池的配置。文章详细讲解了创建属性文件、引入属性文件到Spring配置、以及如何使用属性占位符来引用属性文件中的值。
Spring5入门到实战------7、IOC容器-Bean管理XML方式(外部属性文件)
|
Android开发 开发者
Android自定义View之不得不知道的文件attrs.xml(自定义属性)
本文详细介绍了如何通过自定义 `attrs.xml` 文件实现 Android 自定义 View 的属性配置。以一个包含 TextView 和 ImageView 的 DemoView 为例,讲解了如何使用自定义属性动态改变文字内容和控制图片显示隐藏。同时,通过设置布尔值和点击事件,实现了图片状态的切换功能。代码中展示了如何在构造函数中解析自定义属性,并通过方法 `setSetting0n` 和 `setbackeguang` 实现功能逻辑的优化与封装。此示例帮助开发者更好地理解自定义 View 的开发流程与 attrs.xml 的实际应用。
512 2
Android自定义View之不得不知道的文件attrs.xml(自定义属性)