<p>I'm trying to consume a SharePoint webservice from ColdFusion via cfinvoke ('cause I don't want to deal with (read: parse) the SOAP response itself).</p>

<p>The SOAP response includes a byte-order-mark character (BOM), which produces the following exception in CF:</p>

<pre><code>"Cannot perform web service invocation GetList.
The fault returned when invoking the web service operation is:
'AxisFault
faultCode: {http://www.w3.org/2003/05/soap-envelope}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Content is not allowed in prolog."
</code></pre>

<p>The standard for UTF-8 encoding optionally includes the BOM character (<a href="http://unicode.org/faq/utf_bom.html#29" rel="nofollow noreferrer">http://unicode.org/faq/utf_bom.html#29</a>). Microsoft almost universally includes the BOM character with UTF-8 encoded streams . From what I can tell there’s no way to change that in IIS. The XML parser that JRun (ColdFusion) uses by default doesn’t handle the BOM character for UTF-8 encoded XML streams. So, it appears that the way to fix this is to change the XML parser used by JRun (<a href="http://www.bpurcell.org/blog/index.cfm?mode=entry&amp;entry=942" rel="nofollow noreferrer">http://www.bpurcell.org/blog/index.cfm?mode=entry&amp;entry=942</a>).</p>

<p>Adobe says that it doesn't handle the BOM character (see comments from anoynomous and halL on May 2nd and 5th).<br />
<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_g-h_09.html#comments" rel="nofollow noreferrer">http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_g-h_09.html#comments</a></p>

[{'answer_id': 56896, 'author': 'matt b', 'author_id': 4249, 'author_profile': 'https://Stackoverflow.com/users/4249', 'pm_score': 0, 'selected': False, 'text': '<p>It sounds like ColdFusion is using Apache Axis under the covers.</p>\n\n<p>This doesn\'t apply exactly to your solution, but I\'ve had to deal with this issue once before when consuming a .NET web service with Apache Axis/Java. The only solution I was able to find (since the owner of the web service was unwilling to change anything on his end) was to write a Handler class that Axis would plug into the pipeline which would delete the BOM from the message if it existed. </p>\n\n<p>So perhaps it\'s possible to configure Axis through ColdFusion? If so <a href="http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration" rel="nofollow noreferrer">you can add additional Handlers to the message handling flow</a>.</p>\n'}, {'answer_id': 56918, 'author': 'Adam Tuttle', 'author_id': 751, 'author_profile': 'https://Stackoverflow.com/users/751', 'pm_score': 3, 'selected': True, 'text': '<p>I\'m going to say that the answer to your question (is it possible?) is no. I don\'t know that definitively, but the poster who commented just above halL (<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html#comments" rel="nofollow noreferrer">in the comments on this page</a>) gave a work-around for the problem -- so I assume it is possible to deal with when parsing manually.</p>\n\n<p>You say that you\'re using CFInvoke because you don\'t want to deal with the soap response yourself. It looks like you don\'t have any choice.</p>\n'}, {'answer_id': 73634, 'author': 'Dan Cramer', 'author_id': 3274, 'author_profile': 'https://Stackoverflow.com/users/3274', 'pm_score': 2, 'selected': False, 'text': '<p>As Adam Tuttle said already, the workaround is on the page that you linked to</p>\n\n<pre><code>&lt;!--- Remove BOM from the start of the string, if it exists ---&gt;\n&lt;cfif Left(responseText, 1) EQ chr(65279)&gt;\n&lt;cfset responseText = mid(xmlText, 2, len(responseText))&gt;\n&lt;/cfif&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/56812', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5849/']