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
bz880bz880 

SOAP Fault

Has anyone been experiencing the following SOAP fault?

org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference. faultcode: soapenv:Server

I've been using the AJAX toolkit and some of my updates have this error.

Thanks
bz880bz880


bz880 wrote:
Has anyone been experiencing the following SOAP fault?

org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference. faultcode: soapenv:Server

I've been using the AJAX toolkit and some of my updates have this error.

Thanks


Some more information. The offending character is an "&". Is there any workaround to put into the AJAX toolkit to escape this?
DevAngelDevAngel
Hi bz880,

You are trying to upate a record and the value that is being updated contains an ampersand?
bz880bz880
that is correct. some of my oppportunity records contains &. When I switched my app to use the AJAX toolkit, I got the SAX error.

I am fixing it by escaping the & with &

value.replace(/&(?!amp;)/g, "&")
DevAngelDevAngel
Smiley replacement not withstanding, I understand. Should be something the toolkit does for you.
DevAngelDevAngel
Any other characters you think should be escaped?
bz880bz880
Sorry for late reply. At first, I thought that < and > might be a problem, but it doesn't seem to cause problems. Only & was causing the SAXException.

Anyone else have problems with other characters?
SuperfellSuperfell
You'll need to escape & < > otherwise a text value of <foo> will cause the generated XML to be not well formed.
DevAngelDevAngel
I've put a bug fix into the next release of the toolkit that leverages CDATA in the soap message (thanks to Paul Nakada for the tip) that should handle any issues. That version will be available post winter release.
UdiUdi
Hi!

I am still getting this error (even with toolkit 11.0). Was this fixed?

Thanx,

Udi