This content has been marked as final. Show 18 replies
> Does anyone have a clue why I'm getting this message?
which ver of cf?
Thank you. It was a version problem.
Is it okay to put <cfoutput> variables/tags within the cfxml tag like I did?
> Is it okay to put <cfoutput> variables/tags within the cfxml tag like I did?
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.
<cfhttp URL="https://apitest.authorize.net/xml/v1/request.api" method="post">
<cfhttpparam name="xmlString" value="#xmlString#" type="xml">
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.
You didn't show us the XMLstring, I suspect that is the key.
I got it! It's important to include the header!
I hope this helps someone else. There doesn't seem to be much documentation on it.
I have NO idea how to parse the XML response from my post. Any help is welcomed. Is there a tag like CFXML?
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
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).
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?
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
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.
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.
CFXML and cfsavecontent are unfamiliar territory for me. Thank you for
<cfsavecontent variable="myXML"><cfoutput><?xml version='1.0'
<XML Code goes here>
<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.
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
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">
<text>The content-type specified is not supported.</text>
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"
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#"
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.
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!