使用Web服务返回Coldfusion中的Complex对象

时间:2017-04-05 04:46:55

标签: web-services coldfusion coldfusion-9

我们正在使用Argus WS而且我一直在研究如何使用text[-1]方法。

它返回一个复杂的对象类型,我无法访问返回对象中的元素结构。

获取错误

GetUpdatedPricesInDateTimeRange

正在调用Webservice,如下所示:

Element <e.g. element name> is undefined in a Java object of type class org.tempuri.GetUpdatedPricesInDateTimeRangeResponseGetUpdatedPricesInDateTimeRangeResult. 

任何指针都会非常有用。

编辑1 :CFDump返回变量 CFdump

编辑2 :根据Leigh的建议,这对我有用。

XML

<cfinvoke  
webservice="http://www.argusmedia.com/ArgusWSVSTO/ArgusOnline.asmx?wsdl"
method="GetUpdatedPricesInDateTimeRange" 
returnvariable="PricesResponse"> 
  <cfinvokeargument name="authToken" value="#AuthToken#"/>
  <cfinvokeargument name="fromDateTime" value="2017-03-01"/>
  <cfinvokeargument name="toDateTime" value="2017-03-02"/>
  <cfinvokeargument name="startId" value="0"/>
</cfinvoke> 

XML中有名称空间,因此XML搜索的工作原理如下:

PricesResponse.get_any()[2].getAsString()

1 个答案:

答案 0 :(得分:2)

Based on Leigh's comment, get_any() method of the returnvariable can be used to get the underlying XML.

Dump of get_any() returns the array of Message Elements.

MessageElement

getAsString() method of get_any() returns the expected XML string.

<cfdump var="#PricesResponse.get_any()[1].getAsString()#">

Note : The intended XML can be in either of the MessageElement[] array element and not in the first one.

Note 2 : XMLSearch with namespaces in the XML worked as follows:

XmlSearch(XMLDoc,"//*[local-name()='Element_Name']")
相关问题