I can’t for the life of me figure out why this doesn’t work
!
<!--- json Service
--->
<cfcomponent output="false">
<cfset variables.liveDataSource =
"merctraindsn">
<cffunction name="regions"
access="remote" returnformat="json"
output="false">
<cfargument
name="callback" type="string"
required="false"/>
<cfset
data = getRegions()>
<!---
serialize --->
<cfscript>
data
= QueryToStruct(data);
</cfscript>
<cfset data = serializeJSON(data)>
<!---
wrap --->
<cfif
structKeyExists(arguments, "callback")>
<cfset data =
arguments.callback & "(" & data & ")">
</cfif>
<cfreturn
data>
</cffunction>
</cfcomponent>
<!--- Consume json
Service --->
<cfinvoke webservice="http://localhost/apiTest.cfc"
method="regions" returnvariable="data" >
<cfinvokeargument
name="callback" value="1">
</cfinvoke>
<!--- Test to make sure you have JSON data. --->
<cfif !IsJSON(data)>
<h3>The URL
you requested does not provide valid JSON</h3>
<cfdump
var="#data#">
<!--- If the data is in JSON format, deserialize it.
--->
<cfelse>
<cfset
cfData=DeserializeJSON(data)>
<cfset itemQuery = arrayToQuery(cfData,
"id,name")>
<cfdump
var="#itemQuery#">
</cfif>
I get this:
Unable to parse WSDL as an XML document.
Parsing error: Fatal Error: URI=null Line=357: The element type "meta" must be
terminated by the matching end-tag "".
It is recommended that you use a web browser to retrieve and examine the
requested WSDL document to ensure it is correct.
I’m just totally stumped and I’d be so appreciative for any
little help !
--
--
To post to this group, send email to [email protected]
For more options and to unsubscribe, visit this group at
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
New (July 2012): We've moved to GitHub:
https://github.com/Mach-II/Mach-II-Framework