With ColdFusion 9, I've created a component to work as a SOAP web service for a WinForm app I'm working on. When I call a remote function that returns a custom component via SOAP, none of the data is returned. I have a work around were I serializing to Json string in another method and deserializing in the client application. I would like to avoid this step. Is there an argument in the component / function I'm missing, or is this a bug in CF9?
I have yet to try other versions of ColdFusion. I have ran the same code on Railo and I get the data as intended.
When I view the method via a web browser I see the data returned in the selected returnformat.
Browser Returns:
{"stringField":"Test Value","dateField":"September, 29 2014 15:35:16"}
SoapUI Returns:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getComplexDataObjResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://complexdataservice">
<getComplexDataObjReturn xsi:type="ns1:ComplexData">
<dateField xsi:type="xsd:dateTime" xsi:nil="true"/>
<stringField xsi:type="xsd:string" xsi:nil="true"/>
</getComplexDataObjReturn>
</ns1:getComplexDataObjResponse>
</soapenv:Body>
</soapenv:Envelope>
testService.cfc
<cfcomponent output="false">
<cffunction name="getComplexData" access="remote" output="false" returntype="String" hint="temporary workaround">
<cfreturn serializejson(getComplexDataObj()) />
</cffunction>
<cffunction name="getComplexDataObj" access="remote" output="false" returnformat="json" returntype="complexData">
<cfreturn new complexData("Test Value", Now()) />
</cffunction>
</cfcomponent>
complexData.cfc
<cfcomponent output="false">
<cfproperty name="stringField" type="string" />
<cfproperty name="dateField" type="date" />
<cffunction name="init" access="public" output="false">
<cfargument name="Field1" required="true" type="string">
<cfargument name="Field2" required="true" type="date">
<cfset stringField = arguments.Field1>
<cfset dateField = arguments.Field2>
<cfreturn />
</cffunction>
</cfcomponent>
In Railo I get:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getComplexDataObjResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://complexDataService">
<getComplexDataObjReturn href="#id0"/>
</ns1:getComplexDataObjResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:complexDataService.complexData" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://rpc.xml.coldfusion">
<dateField xsi:type="xsd:dateTime">2014-09-29T20:06:26.420Z</dateField>
<stringField xsi:type="xsd:string">Test Value</stringField>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>