why soap serializaiton take much time
-
Hi, I use the wsdl command to generate the client proxy for the java web service. And the service contain only one method and it like this:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="namespacess", ResponseNamespace="namespacess", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string execute([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string arg0) { object[] results = this.Invoke("execute", new object[] { arg0}); return ((string)(results[0])); }
I create a custom SoapExtension class that is used to calculate the serialize and deserialize time when calling this method. I found that serialize will take more than 2000 Milliseconds. The soap serialization take much time and it's not acceptable. the soapextension class is like this:public class TraceSoapExtension : SoapExtension { public override void ProcessMessage(SoapMessage message) { string methodname = message.MethodInfo.Name; string tmpInfo = "Call web method: " + methodname + " "; switch (message.Stage) { case SoapMessageStage.BeforeSerialize: stc.Reset(); stc.Start(); tmpInfo = tmpInfo + "Before the soap message serialize: " + Environment.NewLine + "Time is: " + System.DateTime.Now.ToUniversalTime().ToString("MM/dd/yyyy hh:mm:ss.ffffff"); break; case SoapMessageStage.AfterSerialize: stc.Stop(); tmpInfo = tmpInfo + "After the soap message serialize: " + Environment.NewLine + "Time is: " + System.DateTime.Now.ToUniversalTime().ToString("MM/dd/yyyy hh:mm:ss.ffffff"); tmpInfo += " Client serialize stop watch take time: " + stc.ElapsedMilliseconds; break; case SoapMessageStage.BeforeDeserialize: stc.Reset(); stc.Start(); tmpInfo = tmpInfo + "Receive soap message before deserialize: " + Environment.NewLine + "Time is: " + System.DateTime.Now.ToUniversalTime().ToStrin