0
我在嘗試使用服務(第三方)時遇到異常,下面是異常的堆棧跟蹤。序列化消息主體時發生錯誤
StackTrace " at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)\r\n at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)\r\n at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object returnValue, Object[] parameters)\r\n at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)" string
此前它工作正常,但更新服務引用後,它開始拋出上述異常。
也嘗試了下面的鏈接中描述的解決方案,但沒有任何幫助。
There was an error in serializing body of message
欣賞在解決同你的幫助。
下面是// reportContent由具有XML數據作爲串,我使用
的代碼。
XmlDocument xmlReportDocument = new XmlDocument();
xmlReportDocument.LoadXml(reportContent);
RequestHandlerProcessSoapClient ws = new RequestHandlerProcessSoapClient();
ws.ClientCredentials.UserName.UserName = _reportFormatData.User;
ws.ClientCredentials.UserName.Password = _reportFormatData.Password;
///Create the request
myRequest request = new myRequest();
request.Requestor = new Requestor();
request.Requestor.ApplicationID = _reportFormatData.ApplicationId;
request.Requestor.Stylesheet = template;
request.Requestor.Environment = _reportFormatData.Environment;
request.Payload = xmlReportDocument;
///Setup the attachements
myAttachmentRequest attachmentrequest = new myAttachmentRequest();
attachmentrequest.setRequest = request;
myResponse serResp = ws.renderDocument(attachmentrequest)//錯誤出現在這一行。
而不是提供一些鏈接描述你的問題。 –
請添加問題而不是鏈接問題 –
發佈您的代碼! – Raghurocks