Reputation: 350
I have written a very basic CFC with a single "remote" function in it.
I have set the responsetype of the function to "XML" and the responseformat to "WDDX".
Inside the function I am using the standard xml functions in coldfusion XmlNew / XmlElemNew / ArrayAppend etc to generate the return XML.
Using cffile or cflog and dumping the XML to a file/log would result in something like the following:
<rootnode>
<item>This is item 1</item>
<item>This is item 2</item>
<item>This is item 3</item>
</rootnode>
Likewise when I use SOAP-UI to consume the webservice it works no problem.
However I now need to use CDATA tags on the contents as we have some strange characters in it.
So I simply thought it would be a case of switching from XMLText to XMLCData when filling in the nodes.
I made the switch and it all worked to the files / logs, but in SOAP-UI it just causes all the nodes to blank and ending up like the following:
<rootnode>
<item/>
<item/>
<item/>
</rootnode>
I have even tried converting the whole creation process of the XML using the CFXML tag. I.e
<cfxml variable="xmlObj">
<rootnode>
<cfloop query="getdata">
<item><cfoutput>#getData.Symptom#</cfoutput></item>
</cfloop>
</rootnode>
</cfxml>
The above works but again as soon as I wrap the middle line of the above code inside a CData the problem occurs again.
Likewise I have written the following test CFM page
<cfset DataManager = createObject("component","com.DataManager")>
<cfset ret = DataManager.GetItems(1)>
<cfinvoke webservice="http://localhost:8500/mysite/com/DataManager.cfc?wsdl" method="GetItems" language="1" returnVariable="ret2">
<cfdump var="#ret#">
<cfdump var="#ret2#">
With the above the cfdump of "ret1" shows the text as expected. The cfdump of "ret2" has the issue as described.
Any help would be greatly appreciated.
I'm getting to a point of re-writing the whole thing to return JSON instead!
Upvotes: 0
Views: 363
Reputation: 350
Right I finally managed to fix the issue purely by dumb luck.
In ColdFusion 10 support was added for both Axis1 and Axis2.
In prior versions of ColdFusion only Axis1 was supported.
The default in ColdFusion 10 is Axis2
There is a setting that can be added to your CFC to override this and revert back to Axis1 called wsversion (see below example)
<cfcomponent output="false" wsversion="1">
Reverting back to Axis1 seems to have fixed the problem and I now see the CDATA tags coming through in SOAP-UI
So although the above solves the issue, it does not explain why it causes issues with Axis2
Upvotes: 2