CUCM 6.13 - cURL Issue

Version 1
    This document was generated from CDN thread

    Created by: Keith Lunn on 07-08-2009 12:46:24 AM
    Hey Folks! - Has anyone used cURL with AXL? Im trying to connect to a 6.13 server using cURL and i get a 5001 error - Content is not allowed in prolog.
    >D:\Data\Utils\cURL\curl-7.19.5\curl.exe -k -u user1:pass1 -H "Content-type: text/xml;" -H "SOAPAction: CUCMB ver=6.1" -d executeSQLQuery.xml <a></a>]
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="<a></a>]"
    <faultstring>Content is not allowed in prolog.</faultstring>
    <axl:Error xmlns:axl="<a></a>]">
    <axl:message>Content is not allowed in prolog.</axl:message>
    The xml request file (executeSQLQuery.xml ) contents:
    <?xml version="1.0"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="<a></a>]" xmlns:axlns="<a></a>]">
    <axlns:executeSQLQuery sequence="600">
    <sql>SELECT userid, firstname, lastname FROM enduser WHERE firstname LIKE 'Ke%';<sql>
    Any ideas as to what is causing the "Content is not allowed in prolog" error. I use the exact same SOAP payload in a program and it works fine in my program.

    Subject: RE: CUCM 6.13 - cURL Issue
    Replied by: David Staudt on 07-08-2009 03:32:20 AM
    I'm pretty sure that error is specific to having anything at all (white space, BOM) before the XML content.  This is especially common when you edit the XML file in notepad, and save it as Unicode rather than ANSI - this results in an invisible 3 byte byte-order-mark (BOM) being placed at the beginning of the file which will caues the server-side parser to fail.  You can see this in a hex editor; you can correct it by resaving the XML file as ANSI in notepad, or otherwise remove the BOM.
    There is a small how-to for Serviceability SOAP using CURL here:

    Subject: RE: CUCM 6.13 - cURL Issue
    Replied by: Keith Lunn on 07-08-2009 03:23:37 PM
    Hi David - I found my issue! Option -d indicates what to send as POST data.
    I used -d executeSQLQuery.xml. This actually sent to the AXL Web service "executeSQLQuery.xml" instead of the contents of the file executeSQLQuery.xml - thus it was a malformed XML stream - thus the error "Content is not allowed in prolog.".
    The solution is to use this form of the -d option: -d @executeSQLQuery.xml. Using the prefix "@" in front of the filename means to use the contents of the file.
    Corrected cURL Command line:
    curl.exe -k -u user1:pass1 -H "Content-type: text/xml;" -H "SOAPAction: CUCMB ver=6.1" -d @executeSQLQuery.xml
    I just started using cURL so it's one of those newbie gotchas!