Data8 / DataverseClient

WS-Trust compatible version of the Microsoft Dataverse client for .NET Core
MIT License
34 stars 16 forks source link

DTD is prohibited in this XML document #19

Open vascofernandes opened 2 years ago

vascofernandes commented 2 years ago

Hi,

Thanks for the cool library.

Sometimes I get the following error message:

"For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method. "

With this stack trace:

System.Xml.XmlException:
   at System.Xml.XmlTextReaderImpl.Throw (System.Private.Xml, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl (System.Private.Xml, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent (System.Private.Xml, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.Xml.XmlReader.MoveToContent (System.Private.Xml, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
   at System.ServiceModel.Channels.StreamedMessage..ctor (System.Private.ServiceModel, Version=4.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at System.ServiceModel.Channels.Message.CreateMessage (System.Private.ServiceModel, Version=4.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at Data8.PowerPlatform.Dataverse.Client.ADAuthClient.Execute (Data8.PowerPlatform.Dataverse.Client, Version=2.1.1.0, Culture=neutral, PublicKeyToken=null)
   at Data8.PowerPlatform.Dataverse.Client.ADAuthClient.RetrieveMultiple (Data8.PowerPlatform.Dataverse.Client, Version=2.1.1.0, Culture=neutral, PublicKeyToken=null)
   at Data8.PowerPlatform.Dataverse.Client.OnPremiseClient.RetrieveMultiple (Data8.PowerPlatform.Dataverse.Client, Version=2.1.1.0, Culture=neutral, PublicKeyToken=null)
   at MyCrmApi.Extensions.OrganizationServiceExtensions.RetrieveMultipleComplete (Crmp.Kverneland.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Could this https://stackoverflow.com/a/28459398 be relevant?

Regards

MarkMpn commented 2 years ago

Thanks for the details. Can you reproduce this error with specific requests? Would you be able to capture a Fiddler trace of the request & response so I can see the best way of fixing this?

yogster commented 1 year ago

I had this issue and found it was due to the service returning an HTML error page, containing a DTD in the first line.

akaskela commented 3 weeks ago

I just reproduced this error accidentally. When I specified the On Prem URL I had just the server name, not the "XRMServices/2011/Organization.svc" path. Once I corrected this it was fine.