我已經創建了一個asp.net web服務,並且正在嘗試使用我的客戶端進行測試。我正在測試的web方法返回一個名爲GetAllTicketsSinceLastPullDateResult的自定義對象,它包含一個自定義clsTrip對象的ArrayList和一個名爲FaultResponse的自定義對象。這是我如何使用我的客戶:asp.net web服務,錯誤生成XML文檔
ServiceReference1.ServiceSoapClient myClient = new ServiceReference1.ServiceSoapClient();
ServiceReference1.GetAllTicketsSinceLastPullDateResult result = new ServiceReference1.GetAllTicketsSinceLastPullDateResult();
result = myClient.getAllTicketsSinceLastPullDate(myUser);
,但我得到了以下錯誤:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type clsTicket was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
我谷歌錯誤,最讓我找到答案的有序列化派生類的事情。但是我的clsTicket類不是派生類。什麼可能導致這個錯誤?我如何使用XmlInclude或SoapInclude?
在此先感謝!
感謝您的回覆。是的,我已經嘗試過,無濟於事。 – PaulG 2012-01-12 15:21:23