Validate RSS feed using cfinvoke and the W3C validation service (soap 1.2)

Posted on 2009-12-16
Medium Priority
Last Modified: 2013-12-24
Hi experts:
I am writing an application for a client to allow them to create RSS feeds.  I would like to integrate the validation of the feeds. Usually to validate, I would go to http://validator.w3.org/feed/ and type in the URL.  I'd like to make this "seamless" for the client by just invoking the service and capturing any errors generated.  I am writing in coldfusion and after looking at the documentation for w3c, I came up with this:

<cfinvoke webservice="http://validator.w3.org/feed/check.cgi" method="post" result="MyReturnVar">
 <cfinvokeargument name="url" value="http://www.mysite.org/MyNews.xml">
 <cfinvokeargument name="output" value="soap12">

I don't know what method to actually use.  Here is a link to the documentation:

When I run this, I get an error:
Could not generate stub objects for web service invocation. Name: http://validator.w3.org/feed/check.cgi. WSDL: http://validator.w3.org/feed/check.cgi. WSDLException (at /html): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.: It is recommended that you use a web browser to retrieve and examine the requested WSDL document for correctness. If the requested WSDL document can't be retrieved or it is dynamically generated, it is likely that the target web service has programming errors.

Any idea what might be gong on and how I can invoke this?

Question by:snix123
  • 2
LVL 27

Accepted Solution

azadisaryev earned 2000 total points
ID: 26068965
w3c's feed validator service is not a webservice per se...
the way to 'invoke' it is not using <cfinvoke>, but with a regular http request using <cfhttp>

here's the code you need:

<cfhttp url="http://validator.w3.org/feed/check.cgi?url=http://www.mysite.org/MyNews.xml&output=soap12" method="get" result="vResult" timeout="360">
<cfif val(vResult.Statuscode) eq 200>
  <cfset vXML = xmlparse(vResult.filecontent)>
  <cfset xmlroot = vXML.xmlRoot['env:Body']['m:feedvalidationresponse']>
  <cfif xmlroot['m:validity'].XmlText>
    <p style="font-weight:bold">Congrats, the feed is valid!</p>
    <p style="font-weight:bold">Sorry, the feed did not validate...</p>
    <cfset arrErrors = xmlroot['m:errors']['m:errorlist'].XmlChildren>
    <cfloop from="1" to="#arraylen(arrErrors)#" index="x">
      <cfoutput>#x#: #arrErrors[x]['text']# (line #arrErrors[x]['line']#, column #arrErrors[x]['column']#)<br></cfoutput>
  <!--- cfhttp call returned an error, i.e. http://validator.w3.org/feed/check.cgi is not available or timed out --->


Author Comment

ID: 26073195
Thank you so much Azadi:
THis works great, but I have to ask how you came up with the solution.  I'm not all that familiar with the XML tags for CF, so I know I have to review that.  Is there a text or website you could recommend?  Thanks!  
LVL 27

Expert Comment

ID: 26073355
cf livedocs is a great place to start: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/index.html

i would suggest going through all the tags and functions, and reading up on those you are not familiar with.
you can also download a free PDF of CFML Reference from here:

and while you are there make sure you download the CF Developers Guide pdf as well:

all the above links are for CF9, but you can get to CF8's livedocs from there.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question