Calling Webservice removes root element of XML
Hello community,
I am experiencing a problem in context with ColdFusion 10 and webservices.
My webservice creates some XML content, parses it with the XMLParse() function and returns it with returntype="xml".
Testing it with an additional .cfm script (I invoke the webservice with cfinvoke, as you can see below) I noticed that the root element of the xml is missing - so does every child of the document root except the first one.
If I run my test script on a ColdFusion 8 server everything works fine and the xml content is just as expected.
Some information about my local server configuration:
Windows 7
IIS 7
ColdFusion 10
Here is my webservice.cfc
<cfcomponent output="false">
<cffunction name="testFunction"
access="remote"
returntype="xml"
output="false">
<cfset var local = {} />
<cfsavecontent variable="local.string">
<rootElement>
<child>1</child>
<child>2</child>
</rootElement>
</cfsavecontent>
<cfreturn XMLParse(Trim(local.string)) />
</cffunction>
</cfcomponent>
My test script caller.cfm:
| <cfinvoke | webservice="http://localhost/returntype_xml/webservice.cfc?wsdl" |
| refreshwsdl="true" | |
| method="testFunction" | |
| returnvariable="someVariable"> |
</cfinvoke>
<cfoutput>
<pre>#HTMLEditFormat(someVariable)#</pre>
</cfoutput>
<cfdump var="#someVariable#" abort="false">
The generated wsdl (outsourced to pastebin):
and finally the output that my test script (caller.cfm) generates:
<?xml version="1.0" encoding="UTF-8"?>
<child>
1
</child>
As you can see, most of the xml content is missing.
Calling the function directly (/webservice.cfc?method=testFunction) works quite well, thats why I suppose that the webservice call causes the problem.
Does anybody know what the source of the problem might be? Or ist maybe a known bug?
Best regards,
Stefan
