Link to home
Start Free TrialLog in
Avatar of LeadCo
LeadCo

asked on

Parse xml With coldfusion I beleive I am close

Hello Experts The code in the code window is the script i am using to parse the xml however it s not working. i think its close but I am no expert!

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetQuotesResponse xmlns="http://www.awebsite.net"><GetQuotesResult><ErrorMsg /><Valid>true</Valid><Quotes><FaceAmountQuote><Quote><QuoteValues><FaceValue>100000</FaceValue><ClientPremium>91.66</ClientPremium><FamilyPremium>99.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>90000</FaceValue><ClientPremium>82.66</ClientPremium><FamilyPremium>90.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>80000</FaceValue><ClientPremium>73.66</ClientPremium><FamilyPremium>81.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>70000</FaceValue><ClientPremium>64.66</ClientPremium><FamilyPremium>72.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>60000</FaceValue><ClientPremium>55.66</ClientPremium><FamilyPremium>63.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>50000</FaceValue><ClientPremium>46.66</ClientPremium><FamilyPremium>54.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>40000</FaceValue><ClientPremium>37.66</ClientPremium><FamilyPremium>45.36</FamilyPremium></QuoteValues><QuoteValues><FaceValue>30000</FaceValue><ClientPremium>28.66</ClientPremium><FamilyPremium>36.36</FamilyPremium></QuoteValues></Quote></FaceAmountQuote><MoneyPurchaseQuote><Quote><QuoteValues><FaceValue>98156</FaceValue><ClientPremium>90</ClientPremium><FamilyPremium>97.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>92600</FaceValue><ClientPremium>85</ClientPremium><FamilyPremium>92.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>87044</FaceValue><ClientPremium>80</ClientPremium><FamilyPremium>87.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>81489</FaceValue><ClientPremium>75</ClientPremium><FamilyPremium>82.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>75933</FaceValue><ClientPremium>70</ClientPremium><FamilyPremium>77.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>70378</FaceValue><ClientPremium>65</ClientPremium><FamilyPremium>72.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>64822</FaceValue><ClientPremium>60</ClientPremium><FamilyPremium>67.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>59267</FaceValue><ClientPremium>55</ClientPremium><FamilyPremium>62.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>53711</FaceValue><ClientPremium>50</ClientPremium><FamilyPremium>57.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>48156</FaceValue><ClientPremium>45</ClientPremium><FamilyPremium>52.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>42600</FaceValue><ClientPremium>40</ClientPremium><FamilyPremium>47.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>37044</FaceValue><ClientPremium>35</ClientPremium><FamilyPremium>42.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>31489</FaceValue><ClientPremium>30</ClientPremium><FamilyPremium>37.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>25933</FaceValue><ClientPremium>25</ClientPremium><FamilyPremium>32.7</FamilyPremium></QuoteValues><QuoteValues><FaceValue>20378</FaceValue><ClientPremium>20</ClientPremium><FamilyPremium>27.7</FamilyPremium></QuoteValues></Quote></MoneyPurchaseQuote></Quotes><SpouseFace>10000</SpouseFace><ChildrenFace>0</ChildrenFace><BenefitDescription>&amp;lt;p&amp;gt;A Ten-Year renewable and convertible term life insurance policy with critical condition accelerated benefit rider.&amp;nbsp;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;LifeStyle Protector will pay as a lump sum, the percentage of your term life insurance benefit if you are first diagnosed with one of the following:&amp;lt;/p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;Cancer (Life Threatening) 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Heart Attack 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Stroke 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Renal Failure 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Major Organ Transplant 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Terminal Illness 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Total Disability* (Sickness or Accident) 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Major Heart Surgery 25%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;HIV From a Blood Transfusion 25%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Angioplasty 10%&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;p&amp;gt;Death from any cause is a 100% benefit.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;(&amp;lt;i&amp;gt;Except suicide during the first two years&amp;lt;/i&amp;gt;.)&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Pays in addition to any other insurance you have!&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;* 10% of the policy face amount every 5 years if you receive Social Security Disability Benefits, and the remaining 50% of the policy face amount at the end of 5 years if you are still receiving Social Security Disability Benefits for a total pay of 100%.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Same exclusion and exceptions apply. Benefits may differ or not be available in some states. Your agent will explain the benefits available in your state.&amp;lt;/p&amp;gt;</BenefitDescription><QRequest><RequestTransactionID>1411</RequestTransactionID><RequestState>AL</RequestState><RequestClientAge>38</RequestClientAge><RequestClientTobacco>false</RequestClientTobacco><RequestSpouseAge>38</RequestSpouseAge><RequestSpouseTobacco>false</RequestSpouseTobacco><RequestModal>Monthly</RequestModal><RequestFamilyStatus>SpouseOnly</RequestFamilyStatus></QRequest></GetQuotesResult></GetQuotesResponse></soap:Body></soap:Envelope>




<---  Code i am using I think its close just no cigar --->
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(XMLContent, "/GetQuotesResponse/GetQuotesResult/ErrorMsg/Valid");
</cfscript>
 
<cfset Face1 = #xmlNode[1].Quotes.FaceAmountQuote.Quote.QuoteValues.FaceValue.xmltext#>
<cfset prem1 = #xmlNode[1].Quotes.FaceAmountQuote.Quote.QuoteValues.ClientPremium.xmltext#>
<cfset Fpremium1 = #xmlNode[1].Quotes.FaceAmountQuote.Quote.QuoteValues.FamilyPremium.xmltext#>
 
<cfoutput>
Face= #face1#   Prem= #prem1#  Family prem = #fpremium1#
 
</cfoutput>

Open in new window

Avatar of abel
abel
Flag of Netherlands image

I am not a coldfusion expert, but I do note two things that definitely need tweaking before you get the code working:

  1. the second argument of xmlSearch takes an xpath. You start the xpath with a "/", which means the the search will start at the root node. You need to give it a the full path starting from the root, or use "//" (which means "anywhere" in the document and should only be used if you do not know where the element is).
  2. (this is more important) you use a namespace in the xml SOAP document. This is a good thing, but xmlSearch cannot deal with namespaces, here's a quote from xmlSearch documentation: XMLSearch() works fine until you set a XmlNsURI anywhere in the XML document. You can test this by adding a xmlns="anyURLHere" name attribute in any tag in your XML file. Once this is set, XMLSearch() breaks.
So you need a namespace aware search, which is the best solution, or you need to make your xpath namespace agnostic, which will make your xpath very unreadable. Isn't there something like XmlSearchNs()?
Apparently, ColdFusion is not namespace aware, or at least only partially. That's a pity and a large miss, but rest assured, there are a couple of solutions. One of the solutions I already touched at in my first reply is explained here: http://www.aftergeek.com/2006/08/xmlsearch-xpath-and-xml-namespaces-in.html (making the xpath namespace agnostic).

Here's the copy and paste solution, but quite unreadable (like I predicted). This is not the fault of XPath or XML, but the problem with ColdFusion:

*[local-name() = 'Envelope']/       *[local-name() = 'Body']/       *[local-name() = 'GetQuotesResponse']/       *[local-name() = 'GetQuotesResult']/       *[local-name() = 'ErrorMsg']/       following-sibling::*[local-name() = 'Valid']

This is a the same as this in "real" XPath when the namespaces would be set correctly:

soap:Envelope/        soap:Body/        GetQuotesResponse/       GetQuotesResult/        ErrorMsg/        following-sibling::Valid

note the difference compared to your original statement where you wrote down "Valid" as a child of "ErrorMsg", but in fact, it is on the same level, which is done with "following-sibling::" at the end.

Finally, I'd like you to try one of the following statements (either/or), which is not valid XPath, but according to different posts on ColdFusion is allowed with XmlSearch:

*:Envelope/        *:Body/        *:GetQuotesResponse/       *:GetQuotesResult/        *:ErrorMsg/        following-sibling::*:Valid

or:

:Envelope/        :Body/        :GetQuotesResponse/       :GetQuotesResult/        :ErrorMsg/        following-sibling:::Valid

(that last one seems strange as it would force you to use ":::" in conjunction with following-sibling, but these weird things happen if language makers diverge from the specifications)


Btw, it works much easier if you indent your XML. It's easier for us to read and easier for yourself to understand. Indenting XML is hardly ever a problem with the content as most whitespace is ignorable.
Avatar of LeadCo
LeadCo

ASKER

Commented XML :

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>
<GetQuotesResponse xmlns="http://www.awebsite.net">
<GetQuotesResult>
<ErrorMsg />
<Valid>true</Valid>
<Quotes>
<FaceAmountQuote>
<Quote>
<QuoteValues>
<FaceValue>100000</FaceValue>
<ClientPremium>91.66</ClientPremium>
<FamilyPremium>99.36</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>90000</FaceValue>
<ClientPremium>82.66</ClientPremium>
<FamilyPremium>90.36</FamilyPremium>
</QuoteValues><QuoteValues>
<FaceValue>80000</FaceValue>
<ClientPremium>73.66</ClientPremium>
<FamilyPremium>81.36</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>70000</FaceValue>
<ClientPremium>64.66</ClientPremium>
<FamilyPremium>72.36</FamilyPremium>
</QuoteValues><QuoteValues>
<FaceValue>60000</FaceValue>
<ClientPremium>55.66</ClientPremium>
<FamilyPremium>63.36</FamilyPremium></QuoteValues>
<QuoteValues>
<FaceValue>50000</FaceValue>
<ClientPremium>46.66</ClientPremium>
<FamilyPremium>54.36</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>40000</FaceValue>
<ClientPremium>37.66</ClientPremium>
<FamilyPremium>45.36</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>30000</FaceValue>
<ClientPremium>28.66</ClientPremium>
<FamilyPremium>36.36</FamilyPremium>
</QuoteValues>
</Quote>
</FaceAmountQuote>
<MoneyPurchaseQuote>
<Quote>
<QuoteValues>
<FaceValue>98156</FaceValue>
<ClientPremium>90</ClientPremium>
<FamilyPremium>97.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>92600</FaceValue>
<ClientPremium>85</ClientPremium>
<FamilyPremium>92.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>87044</FaceValue>
<ClientPremium>80</ClientPremium>
<FamilyPremium>87.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>81489</FaceValue>
<ClientPremium>75</ClientPremium>
<FamilyPremium>82.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>75933</FaceValue>
<ClientPremium>70</ClientPremium>
<FamilyPremium>77.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>70378</FaceValue>
<ClientPremium>65</ClientPremium>
<FamilyPremium>72.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>64822</FaceValue>
<ClientPremium>60</ClientPremium>
<FamilyPremium>67.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>59267</FaceValue>
<ClientPremium>55</ClientPremium>
<FamilyPremium>62.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>53711</FaceValue>
<ClientPremium>50</ClientPremium>
<FamilyPremium>57.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>48156</FaceValue>
<ClientPremium>45</ClientPremium>
<FamilyPremium>52.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>42600</FaceValue>
<ClientPremium>40</ClientPremium>
<FamilyPremium>47.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>37044</FaceValue>
<ClientPremium>35</ClientPremium>
<FamilyPremium>42.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>31489</FaceValue>
<ClientPremium>30</ClientPremium>
<FamilyPremium>37.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>25933</FaceValue>
<ClientPremium>25</ClientPremium>
<FamilyPremium>32.7</FamilyPremium>
</QuoteValues>
<QuoteValues>
<FaceValue>20378</FaceValue>
<ClientPremium>20</ClientPremium>
<FamilyPremium>27.7</FamilyPremium>
</QuoteValues>
</Quote>
</MoneyPurchaseQuote></Quotes>
<SpouseFace>10000</SpouseFace>
<ChildrenFace>0</ChildrenFace>
<BenefitDescription>&amp;lt;p&amp;gt;A Ten-Year renewable and convertible term life insurance policy with critical condition accelerated benefit rider.&amp;nbsp;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;LifeStyle Protector will pay as a lump sum, the percentage of your term life insurance benefit if you are first diagnosed with one of the following:&amp;lt;/p&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;Cancer (Life Threatening) 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Heart Attack 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Stroke 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Renal Failure 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Major Organ Transplant 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Terminal Illness 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Total Disability* (Sickness or Accident) 100%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Major Heart Surgery 25%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;HIV From a Blood Transfusion 25%&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;Angioplasty 10%&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;p&amp;gt;Death from any cause is a 100% benefit.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;(&amp;lt;i&amp;gt;Except suicide during the first two years&amp;lt;/i&amp;gt;.)&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Pays in addition to any other insurance you have!&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;* 10% of the policy face amount every 5 years if you receive Social Security Disability Benefits, and the remaining 50% of the policy face amount at the end of 5 years if you are still receiving Social Security Disability Benefits for a total pay of 100%.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Same exclusion and exceptions apply. Benefits may differ or not be available in some states. Your agent will explain the benefits available in your state.&amp;lt;/p&amp;gt;</BenefitDescription>
<QRequest>
<RequestTransactionID>1411</RequestTransactionID>
<RequestState>AL</RequestState>
<RequestClientAge>38</RequestClientAge>
<RequestClientTobacco>false</RequestClientTobacco>
<RequestSpouseAge>38</RequestSpouseAge>
<RequestSpouseTobacco>false</RequestSpouseTobacco>
<RequestModal>Monthly</RequestModal>
<RequestFamilyStatus>SpouseOnly</RequestFamilyStatus>
</QRequest>
</GetQuotesResult>
</GetQuotesResponse>
</soap:Body>
</soap:Envelope>
Avatar of LeadCo

ASKER

abel: I tried to try that way in several ways.  It would not let me use * or : in cfscript.

I tried:
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent,
*:Envelope/
       *:Body/
       *:GetQuotesResponse/
      *:GetQuotesResult/
       *:ErrorMsg/
       following-sibling::*:Valid
</cfscript>

I get this:

Missing argument name.  
When using named parameters to a function, every parameter must have a name.
Avatar of LeadCo

ASKER


With this i get:
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent,
:Envelope/
       :Body/
       :GetQuotesResponse/
      :GetQuotesResult/
       :ErrorMsg/
       following-sibling:::Valid
</cfscript>

When using named parameters to a function, every parameter must have a name.
The CFML compiler was processing:

An expression beginning with xmlSearch, on line 63, column 13.This message is usually caused by a problem in the expressions structure.
A script statement beginning with xmlNode on line 63, column 3.
A cfscript tag beginning on line 60, column 2.

Thanks for trying.
ASKER CERTIFIED SOLUTION
Avatar of abel
abel
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeadCo

ASKER

My code looks like this:
<!---Version 3 --->
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent, "*[local-name() = 'Envelope']/*[local-name() = 'Body']/*[local-name() = 'GetQuotesResponse']/*[local-name() = 'GetQuotesResult']/*[local-name() = 'ErrorMsg']/following-sibling::*[local-name() = 'Valid']");
</cfscript>

An error occured while Parsing an XML document.  
Premature end of file.  
Avatar of LeadCo

ASKER

<!-- version 2 -->
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent, ":Envelope/:Body/:GetQuotesResponse/:GetQuotesResult/:ErrorMsg/following-sibling:::Valid");
</cfscript>


An error occured while Parsing an XML document.  
Premature end of file.  
Avatar of LeadCo

ASKER

<!-- version 1 -->
<!---  Version 1 --->
<cfscript>
  xmlContent = trim(objGet.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent, "*:Envelope/*:Body/*:GetQuotesResponse/*:GetQuotesResult/*:ErrorMsg/following-sibling::*:Valid");
</cfscript>
An error occured while Parsing an XML document.  
Premature end of file.

Thanks for the help.
> An error occured while Parsing an XML document.  
> Premature end of file.  

That's something else: apparently your XML is not well-formed. I'm off now for the night (it's 10.30PM here) but I'll look into it tomorrow. The XML you posted here in your first post, btw, was correct, as I tried the XPath that I gave to you before posting, using your original input.
Please use the same content you posted in here in the first place. The code works with that. If not, can you open it in an XML editor to check it for errors? The "Premature end of file" error is almost always caused by a non-closed tag.
Avatar of LeadCo

ASKER

I am accessing a webservice, I stioll get that premature error. Maybe its how I am setting the variable of the xml.

<cfset strURL = "http://www.awebsite.net/LSPWebService.asmx" />

<cfsavecontent variable="strXML">
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetQuotes xmlns="http://www.awebsite.net">
      <_quoteRequest>
        <RequestTransactionID>1411123</RequestTransactionID>
        <RequestState>AL</RequestState>
        <RequestClientAge>38</RequestClientAge>
        <RequestClientTobacco>false</RequestClientTobacco>
        <RequestSpouseAge>38</RequestSpouseAge>
        <RequestSpouseTobacco>false</RequestSpouseTobacco>
        <RequestModal>Monthly</RequestModal>
        <RequestFamilyStatus>SpouseOnly</RequestFamilyStatus>
      <_quoteRequest>
    </GetQuotes>
  </soap12:Body>
</soap12:Envelope>
</cfsavecontent>
<cfhttp
url="#strURL#"
method="post"
useragent="#CGI.http_user_agent#"
>
<cfhttpparam
type="XML"
value="#strXML.Trim()#"
/>
</cfhttp>
<cfoutput>#cfhttp.FileContent#</cfoutput>


<cfscript>
  xmlContent = trim(cfhttp.FileContent);
  xmlContent = XMLParse(xmlContent);
  xmlNode = xmlSearch(xmlContent, "*[local-name() = 'Envelope']/*[local-name() = 'Body']/*[local-name() = 'GetQuotesResponse']/*[local-name() = 'GetQuotesResult']/*[local-name() = 'ErrorMsg']/following-sibling::*[local-name() = 'Valid']");
</cfscript>
Avatar of LeadCo

ASKER

Thanks for the help.
I somehow missed the notification of that last post of you. I see you accepted my answer, but did you get it solved? I mean, did that error go away?
Avatar of LeadCo

ASKER

I can't seem to get the premature end error to stop it happens everytime i try to XMLParse it.

However you provided me with good answer for the situation my problem probobly lies in the way i am grabbing the xml from their webservice.

<cfhttp
url="#strURL#"
method="post"
useragent="#CGI.http_user_agent#"
result="objGet"
>
<cfhttpparam
type="XML"
value="#strXML.Trim()#"
/>
</cfhttp>

<cfset MyXMLDoc = #xmlParse(objGet.FileContent)# />
Should you really use Trim on the string? Whitespace is not relevant in XML and it doesn't lower the performance.

Can you try to open a local XML file that you know is correct (and don't do anything with it apart from xmlParse), instead of using this http_post method? Then we at least verified that your code is working.