使用ColdFusion 9,我創建了一個組件,以用作我正在處理的WinForm應用程序的SOAP Web服務。當我調用通過SOAP返回自定義組件的遠程函數時,不會返回任何數據。我有一個工作,我是序列化到另一種方法JSON字符串和反序列化在客戶端應用程序。我想避免這一步。在我缺少的組件/函數中是否存在一個參數,或者這是CF9中的一個錯誤?soap complexType沒有數據
我還沒有嘗試其他版本的ColdFusion。我在Railo上運行了相同的代碼,並按照預期得到了數據。
當我通過Web瀏覽器查看該方法時,我看到選定的returnformat中返回的數據。
瀏覽器返回:
{"stringField":"Test Value","dateField":"September, 29 2014 15:35:16"}
了SoapUI返回:
<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>
在Railo我得到:
<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>
謝謝你的建議。我現在已經嘗試了兩種WSDL樣式,並且數據仍然缺失。 – Twillen 2014-09-30 12:26:09