18 Replies Latest reply on Mar 10, 2007 6:34 PM by Balddog

    CFXML error

    Balddog
      Does anyone have a clue why I'm getting this message?

      The tag name "CFXML" is not a properly formed name for a ColdFusion Extension (CFX).

        • 1. Re: CFXML error
          Level 7
          rboudwin wrote:
          > Does anyone have a clue why I'm getting this message?

          which ver of cf?
          • 2. Re: CFXML error
            Balddog Level 1
            Thank you. It was a version problem.

            Is it okay to put <cfoutput> variables/tags within the cfxml tag like I did?
            • 3. Re: CFXML error
              Level 7
              rboudwin wrote:
              > Is it okay to put <cfoutput> variables/tags within the cfxml tag like I did?

              sure.
              • 4. Re: CFXML error
                Balddog Level 1
                I'm getting an error. Any clues?

                "An error occured while Parsing an XML document"
                "The markup in the document following the root element must be well-formed."

                Any ideas? All the code appears to be okay.

                <cfdump var="#xmlString#">

                <!--TEST-->
                <cfhttp URL="https://apitest.authorize.net/xml/v1/request.api" method="post">
                <cfhttpparam name="xmlString" value="#xmlString#" type="xml">
                </cfhttp>
                • 5. Re: CFXML error
                  Balddog Level 1
                  This should be a simple XML submittal to Authorizenet ARB. I haven't been able to find any sample code. It seems like there would be something since it's AUthorizenet.
                  • 6. Re: CFXML error
                    Level 7
                    You didn't show us the XMLstring, I suspect that is the key.
                    • 7. Re: CFXML error
                      Balddog Level 1
                      I got it! It's important to include the header!

                      <ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">

                      I hope this helps someone else. There doesn't seem to be much documentation on it.
                      • 8. Re: CFXML error
                        Balddog Level 1
                        I have NO idea how to parse the XML response from my post. Any help is welcomed. Is there a tag like CFXML?
                        • 9. Re: CFXML error
                          Level 7
                          I have NO idea how to parse the XML response from my post. Any help is
                          welcomed. Is there a tag like CFXML?

                          Other then <cfxml>?

                          Don't parse it, just dump out the XML string and see what it looks like.

                          <cfoutput>#xmlString#</cfoutput> Then view source to see the tags.

                          You can play with the htmlCodeFormat() and xmlFormat() functions for
                          prettiness.
                          • 10. Re: CFXML error
                            Balddog Level 1
                            I'm not sure if I understand XML well enough to communicate this clearly. The initial CFXML that I sent appears to be working without errors. I dump out the XML string and output the string as you suggested. This shows the xml information that is submitted via a cfhttp post. There should be a response from the place that the xml post is sending to with a returned xml response. I'm not sure how to read the returned xml response from authorizenet showing if it was approved or had an error. I've attached my complete code to make it easier to understand.

                            I'm not sure what to do after I submit it to get the response xml back (not what I sent).
                            • 11. Re: CFXML error
                              Balddog Level 1
                              Thanks for your replies. I see why I wasn't "seeing" my response. I was getting an error, "connection failure." I'm beginning to believe it's to do with cfhttp. So . . . this is taking much more time than it should. Anyone else having trouble connecting with cfhttp?
                              • 12. Re: CFXML error
                                Level 7
                                So . . . this is taking much more time than it should. Anyone
                                else having trouble connecting with cfhttp?

                                No, I have used cfhttp just fine. What happens if you go to that URL in
                                a browser?

                                One thing that looks odd to me. You are using <cfxml...>. This creates
                                an XML OBJECT, not a STRING, in the CF memory. You are not going to be
                                able to pass an OBJECT like this through an HTTP Post parameter. You
                                could use the toString() function to convert that object to a string.

                                A better solution my be to use the <cfsavecontent var="xmlString"> tag
                                instead of the <cfxml...> tag. This tag creates a string by default.
                                Other then this, it has a second advantage over the <cfxml...> tag in
                                that you can use different <?xml ... ?> prolog. With the <cfxml...>
                                tag, a standard prolog is used and it can not be easily changed, if one
                                wants to use a different one. Of course, if one wants this string to
                                become an object on the cf server one would use the xmlParse() function.


                                • 13. Re: CFXML error
                                  Balddog Level 1
                                  CFXML and cfsavecontent are unfamiliar territory for me. Thank you for guiding me.

                                  I'm still getting the same error, "Connection failure." I have to think it is something basic that I'm missing.

                                  • 14. Re: CFXML error
                                    Level 7
                                    CFXML and cfsavecontent are unfamiliar territory for me. Thank you for
                                    guiding me.

                                    <cfsavecontent variable="myXML"><cfoutput><?xml version='1.0'
                                    encoding='UTF-8'?>
                                    <XML Code goes here>
                                    </cfsavecontent>

                                    <cfset stringXML = tostring(#myXML#)>

                                    I can see that. You are still incorrectly matching functions.
                                    <CFXML...> creates a ColdFusin XML object. You would use the
                                    toString(xmlOjbect) if you wanted a string representation of that object.

                                    <cfsaveContent ...> Creates a String, xml or otherwise. You would use
                                    xmlParse() of an xml string if you wanted an object.

                                    An experiment for some edification.

                                    <cfxml variable="aVar">
                                    <root>
                                    <node>A</node>
                                    <node>B</node>
                                    </root>
                                    <cfxml>

                                    <cfdump var="#AVar#">

                                    <cfoutput>#toString(aVar)#</cfoutput>

                                    <cfsaveContent variable="bVar">
                                    <root>
                                    <node>A</node>
                                    <node>B</node>
                                    </root>
                                    </cfsaveContent>

                                    <cfoutput>#bVar#</cfoutput>

                                    <cfdump var="#xmlParse(bVar)#">


                                    For the other potential issue, are you sure the CF server can access
                                    that url resource. That there is no firewall, proxy or other security
                                    layer preventing access.

                                    What happens if you put 'https://api.authorize.net/xml/v1/request.api'
                                    in the the location bar of your favorite browser? What happens if you
                                    do this from the CF server? Assuming you have direct access to the CF
                                    server.
                                    • 15. Re: CFXML error
                                      Balddog Level 1
                                      When I put the url in my browser, this is what I get:

                                      <?xml version="1.0" encoding="utf-8" ?>
                                      - <ErrorResponse xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
                                      - <messages>
                                      <resultCode>Error</resultCode>
                                      - <message>
                                      <code>E00002</code>
                                      <text>The content-type specified is not supported.</text>
                                      </message>
                                      </messages>
                                      </ErrorResponse>
                                      • 16. CFXML error
                                        Balddog Level 1
                                        Okay, I see that I was mixing ideas. Thank you for clarifying! (The sample you gave has a simple typo in case anyone else reads this post and tests it - two opening cfxml tags.)

                                        So . . . when I post via http, I want it in a string or as an object? Does that depend on the recipient? I would assume as an object.

                                        I'm also not finding "official" documentation that cfhttpparam has a type "xml." I see it in examples and other posts, but I'm wondering if this could be part of the problem - matching data types.

                                        Interesting. When I apply the correct dump info to my code, I get:
                                        "An error occured while Parsing an XML document"
                                        • 17. Re: CFXML error
                                          Level 7
                                          So . . . when I post via http, I want it in a string or as an object?
                                          Does that depend on the recipient? I would assume as an object.

                                          I'm also not finding "official" documentation that cfhttpparam has a
                                          type "xml." I see it in examples and other posts, but I'm wondering if
                                          this could be part of the problem - matching data types.


                                          Actually the opposite, you would us a string. CFHTTP, is just http
                                          requests - you are doing a fancy form post. The code you provide could
                                          be replaced by a form something like this. You would not expect an
                                          object to work in a form input.

                                          <form action="https://api.authorize.net/sml/v1/request.api" method="post">
                                          <input type="hidden" name="XMLUpload" value="#xmlString#"
                                          </form>

                                          Obviously this would not do anything without some type of action to
                                          generate a submit in the browser.

                                          If you are expecting to use <cfhttp...> you should be using a string,
                                          the string just needs to be a valid representation of XML.

                                          If this is a web service, and you do need to pass in an actual object,
                                          then you need to be using other options, such as createObject(),
                                          <cfobject...> or <cfinvoke...> to access it as an web service to which
                                          you can pass complex objects.
                                          • 18. Re: CFXML error
                                            Balddog Level 1
                                            I ended up using cfsavecontent with a cfhttp. I was getting connection failure errors. After days of researching this, I found documentation regarding a bug. I was finally able to connect to the test site, but I never could connect to the produciton site at Authorize.Net. After a full week of requesting help from the development team, they never responded. We're going a different route because it is too unstable. Thank you for all of your help!

                                            http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_19139

                                            http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=95f66fd8

                                            http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_18198

                                            http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_18172