Post

1 follower Follow
0
Avatar

Getting XML error when using web service API to query timesheets.

Looks like a data issue because I can query other dates without getting the error.

The error is this when I try to request timesheet information for July 22nd (Earlier dates in July work fine):

There is an error in XML document (1, 294313).

Is there a log file somewhere that will show the error details?

Darenc Answered

Please sign in to leave a comment.

6 comments

0
Avatar

If I change the requested fields in the query to exclude "Comments", then it works so it must be an invalid character in that field for one of the users. I have exported the data for July 22nd using the "Resource(s) Hourly Report" but I don't see anything in the comments that would be a problem.

Darenc 0 votes
Comment actions Permalink
0
Avatar

Hi Danrec.

You're probably right about having invalid (XML) characters in the Comments field. The exception is thrown by the .NET client parsing the XML, so it only applies to the API, not export of reports.

Fortunately, there's an easy way to turn off XML character validation. Please check this post:

http://stackoverflow.com/questions/549896/illegal-characters-in-xml-document-in-asp-net-web-service

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Sorry, I'm not understanding the link.

I ran the following command using the path to my web service:

wsdl.exe <path to webservice>

but the following error was generated:

Error: Item has already been added. Key in dictionary: '[8]:file:///:Negotiate'

 Key being added: '[8]:file:///:Negotiate'

After searching my webservice, I don't have a "GetReaderForMessage" method so I can't overload it

 

 

Darenc 0 votes
Comment actions Permalink
0
Avatar

Hi Danrec.

Try adding the following code, under the namespace of your Clarizen service (so the new override will be a part of the web service proxy class):

public partial class Clarizen

{

protected override System.Xml.XmlReader GetReaderForMessage(System.Web.Services.Protocols.SoapClientMessage message, int bufferSize)

{

System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings();

settings.CheckCharacters = false;

return System.Xml.XmlTextReader.Create(message.Stream, settings);

}

}

 

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi Daren,

Just to clarify, you don't have to use WSDL.exe for this. The proxy class generated by 'Add web reference' you probably have will do.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink