function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ejunkie2005ejunkie2005 

Querying for CreatedDate results in "There is an eror in XML Document" error

I am using C# to obtain case data from Salesforce in my application. I dont have any problems querying the rest of the case-related information.

When I run the following query:

QueryResult qr = binding.query("Select CreatedDate from Case where CaseNumber = '00003511'");

The following exception is thrown:

Message: There is an error in XML document (1, 477).
Trace:    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlRea
der, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, St
ring encodingStyle)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClie
ntMessage message, WebResponse response, Stream responseStream, Boolean asyncCal
l)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
   at SFIncidentCaseData.sforce.SforceService.query(String queryString) in <path to project>\Web References\sforce\Reference.cs:line 678
   at SFIncidentCaseData.Program.GetIncidentCaseData(String strOrgName, String s
trStartCreatedDate, String strEndCreatedDate) in <path to source  file>:line 62

Any help is appreciated!

Thanks,
Prashanth
SuperfellSuperfell
See some of the other threads, there seems to be an intermitent bug in .NET 2.0 in deserializing dateTimes.
ejunkie2005ejunkie2005
Thanks for the quick turn-around.

Would you please point me to some? I didnt find anyting relevant.

Thanks,
Prashanth
ejunkie2005ejunkie2005
It's critical that we get this resolved. Would somebody please point me in the right direction?

Thanks,
~p
SuperfellSuperfell
I'm not aware of a work around. My advise to the other posters with this problem has been to call microsoft support. I don't know if anyone has.
MazAMazA
Hi,
 
I'm having the same problem. Were you able to fix it?
 
thanks
Maz.
ejunkie2005ejunkie2005
I ran into a work-around accidentally. I re-compiled the code on a different computer and ran the executable. It worked like a charm. But I still havent been able to figure out the real cause of the problem :(
MazAMazA

I managed to get this working finally (cheap approach) by removing anything unwanted from the .wsdl file. I think it's the size of the .wsdl file that messes it up.

Example,

Any part that I don't need now looks like the following

<xsd:complexType name="ActivityHistory">
<
xsd:complexContent mixed="false">
<
xsd:extension base="ens:sObject">
<
xsd:sequence />
</
xsd:extension>
</
xsd:complexContent>
</
xsd:complexType>

BTW, Salesforce should add this as a feature to their .wsdl generator tool where you can select only the elements(sections) that you use.

Maz.

MazAMazA
Ignore my last email. It was working but when I changed the following

https://www.salesforce.com/services/Soap/c/7.0

to

https://www.salesforce.com/services/Soap/c/8.0 in my web.config. It stopped working.

Any help would be greatly appreciated.

Thanks
Maz.

SuperfellSuperfell
See the thread at the top of the forum on .NET dateTime parsing.
http://community.salesforce.com/sforce/board/message?board.id=NET_development&message.id=4069
MazAMazA

Thanks.. that worked.

http://support.microsoft.com/kb/925272

Maz.