+ Start a Discussion
Oli@clicktoolsOli@clicktools 

XML Parse Error: org.xml.sax.SAXParseException:

Hi all,

Using a partner application (Clicktools) that works through the API, I am attempting to create a new custom object and update fields within that object, from a custom form (built in Clicktools). I had set this up and it was all working fine. Now when I try to create the object Salesforce returns the following error message:

ERROR: Processing instance (Live) Loss Survey. Salesforce error: XML Parse Error: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.

at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)

        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)

        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)

        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)

        at org.apache.xerces.impl.XMLEntityScanner.peekChar(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanCDATASection(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)

        at javax.xml.parsers.SAXParser.parse(Unknown Source)

        at core.email.tools.XMLHandler.parse(XMLHandler.java:159)

        at core.email.tools.XMLHandler.parse(XMLHandler.java:129)

        at core.email.tools.BaseTempl

Within the custom object I am updating a number of custom fields. One of these is a date field. If I remove the date field from the object, or from the custom form information I’m passing through the API, everything works as it should. Adding a new date field causes the error again.

I have a similar problem when trying to update existing account information from a custom form – used to work, now it doesn’t. Again it seems to be a custom date field that’s causing the problem.

The Salesforce account I am working on has recently been upgraded from Professional to Enterprise edition.

 

Any ideas?

Thanks.

SuperfellSuperfell
do you have a capture of your actual request ?
Oli@clicktoolsOli@clicktools

Hi Simon, thanks for your response. Here's the detail you requested:

Soap request:

<?xml version="1.0" encoding="UTF-8" ?>

- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Header>
- <ns1:CallOptions soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="urn:partner.soap.sforce.com">
  <ns1:client>DoveTail/1.0</ns1:client>
  <ns1:defaultNamespace xsi:nil="true" />
  </ns1:CallOptions>
- <ns2:SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns2="urn:partner.soap.sforce.com">
  <ns2:sessionId>440700D20000000624n!ARkAQI5SZwIa0cDccvFpwsEbAvDaItblOiwcs0Hr.q4okPMu7Sbg0Ww3na2HpOeFY0AaboDf5n7WL1VS3JrM.38_iZbG4.J7</ns2:sessionId>
  </ns2:SessionHeader>
- <ns3:QueryOptions soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns3="urn:partner.soap.sforce.com">
  <ns3:batchSize>2000</ns3:batchSize>
  </ns3:QueryOptions>
  </soapenv:Header>
- <soapenv:Body>
- <create xmlns="urn:partner.soap.sforce.com">
- <sObjects>
  <ns4:type xmlns:ns4="urn:sobject.partner.soap.sforce.com">Loss_survey__c</ns4:type>
  <Opportunity__c xmlns="">00620000005WHK3</Opportunity__c>
  <response_date__c xmlns="">2008-08-28</response_date__c>
  </sObjects>
  </create>
  </soapenv:Body>
  </soapenv:Envelope>
 
 
I Appreciate you looking into this for me.
 
oli
Oli@clicktoolsOli@clicktools
Additionally, here's the Soap response:
 
  <?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <createResponse>
- <result>
- <errors>
  <fields xsi:nil="true" />
  <message>XML Parse Error: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.peekChar(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanCDATASection(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at core.email.tools.XMLHandler.parse(XMLHandler.java:159) at core.email.tools.XMLHandler.parse(XMLHandler.java:129) at core.email.tools.BaseTemplateReplace.getParsedHtml(BaseTemplateReplace.java:218) at core.email.tools.BaseTemplateReplace.getParsedHtml(BaseTemplateReplace.java:200) at core.email.tools.BaseTemplateReplace.fillEmail(BaseTemplateReplace.java:239) at core.email.tools.BaseTemplateReplace.fillEmailWithGack(BaseTemplateReplace.java:267) at core.email.tools.BaseTemplateReplace.fillEmailWithGack(BaseTemplateReplace.java:258) at common.rule.action.ActionEmailInfo.invoke(ActionEmailInfo.java:223) at common.rule.BaseWorkflowController.invokeQueuedActions(BaseWorkflowController.java:378) at common.udd.object.WorkflowController.executeWorkflowImpl(WorkflowController.java:376) at common.udd.object.WorkflowController.executeWorkflowWithErrors(WorkflowController.java:142) at common.udd.object.SavingEntityObject.executeWorkflowInternal(SavingEntityObject.java:958) at common.udd.object.SavingEntityObject.save(SavingEntityObject.java:251) at common.udd.object.EntityObject.save(EntityObject.java:1367) at common.udd.object.EntityObject.save(EntityObject.java:1360) at common.udd.object.ApiBulkEntityOp.saveSingleEntityObject(ApiBulkEntityOp.java:1248) at common.udd.object.ApiBulkEntityOp.saveBulkEntityObjects(ApiBulkEntityOp.java:1062) at common.udd.object.ApiBulkEntityOp.saveEntityObjects(ApiBulkEntityOp.java:1026) at common.udd.object.ApiBulkEntityOp.performBulkSave(ApiBulkEntityOp.java:184) at common.udd.object.ApiBulkEntityOp.apiBulkSave(ApiBulkEntityOp.java:144) at common.udd.object.ApiBulkEntityOp.apiBulkSave(ApiBulkEntityOp.java:119) at common.api.soap.SoapOperationSave.save(SoapOperationSave.java:169) at common.api.soap.SoapOperationSave.save(SoapOperationSave.java:68) at common.api.soap.SoapOperationCreate.create(SoapOperationCreate.java:36) at sun.reflect.GeneratedMethodAccessor501.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at shared.xml.soap.Envelope.execute(Envelope.java:127) at shared.xml.soap.SoapHttpRequestHandler.handleRequest(SoapHttpRequestHandler.java:63) at common.api.soap.SoapEngineSwitcherServlet.doPost(SoapEngineSwitcherServlet.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:152) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:90) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99) at shared.filter.SoapPostGzipFilter.doFilter(SoapPostGzipFilter.java:24) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.filters.GzipFilter.doFilter(GzipFilter.java:177) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at core.dns.filter.CustomDomainMappingFilter.doFilter(CustomDomainMappingFilter.java:138) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at core.dns.filter.BandwidthMeterFilter.doFilter(BandwidthMeterFilter.java:81) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.SoapPreGzipFilter.doFilter(SoapPreGzipFilter.java:49) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.PreGzipFilter.doFilter(PreGzipFilter.java:119) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.RedirectFilter.doFilter(RedirectFilter.java:102) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.XssFilter.doFilter(XssFilter.java:125) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.InstanceRedirectFilter.doFilter(InstanceRedirectFilter.java:457) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.filter.LegacyJSPFilter.doFilter(LegacyJSPFilter.java:168) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.loadbalancer.LoadBalancerFilter.doFilter(LoadBalancerFilter.java:64) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at system.context.ContextReleaseFilter.doFilter(ContextReleaseFilter.java:56) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:341) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:467) at com.caucho.util.ThreadPool.run(ThreadPool.java:408) at java.lang.Thread.run(Thread.java:595)</message>
  <statusCode>UNKNOWN_EXCEPTION</statusCode>
  </errors>
  <id xsi:nil="true" />
  <success>false</success>
  </result>
  </createResponse>
  </soapenv:Body>
  </soapenv:Envelope>
 
Thanks
SuperfellSuperfell
So it appears that your request is triggering workflow, which is triggering an email, but the email template is not valid (not sure how'd you get into that state). That is rather a poor error message, i'll see about getting that fixed. Perhaps you could try re-saving your email template to fix it up ?
Oli@clicktoolsOli@clicktools
Weird - slightly unexpected but kinda makes sense - thanks for the hlp!
jhamletjhamlet
I am getting a similar error while trying to create a new contact (or converting a lead) that is calling a workflow with an email alert:
 
Template XML Parse Error: XML document structures must start and end within the same entity.
 
I am not developer, but I assume that this is being caused by a similar issue.
 
I attempted to resave the workflow with the email template, but it did not resolve the issue.
 
Disabling the workflow is the only thing that I can do.
 
Any other troubleshooting advice?
venkateshvenkatesh

HI,

       

       We are facing the memory issue and Too many script statements issue, when we are using DOM parser to parse the Web Service XML. I got this thread and came to know that we can use SAX parser instead of using DOM parser. Please suggest us that how we can use the SAX parser to parse the external Web Service XML within Force.com platform.

 

 

Thanks in advance.