2011-09-24 56 views
2

我在我的RoR应用程序中使用了Savon。在Savon中分析日期和时间时丢失xml数据

这是我的电话到服务:

client = Savon::Client.new(MY_SOAP_CLIENT) 

response = client.request :wsdl, :get_history do 
    soap.body = "<startDate>2011-09-23</startDate><endDate>2011-09-24</endDate><userId>3</userId>" 
end 

而且我得到XML中的下一个响应:

<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"> 
<soapenv:Body xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"> 
<resMessage xmlns=\"http://xxx-xxx.xxx.edu/xxx/\"> 
    <result>date=2011-09-23?amount=13.00?time=08:50:38?user=a00123?type=transfer</result> 
    <result>date=2011-09-23?amount=3.00?time=08:51:27?user=a0?type=transfer</result> 
    <result>date=2011-09-23?amount=20.00?time=09:49:00?user=a0?type=transfer</result> 
</resMessage></soapenv:Body></soapenv:Envelope> 

但是,主要的问题是,当我打电话response.to_hash我只得到日期对象部分:

=> [星期五,2011年9月23日,星期二,2011年9月23日,星期二,2011年9月23日]

这对日期很好,但结果的其他部分缺失:数量,时间,用户和类型。另外,如果我叫response.body我一直得到了相同的结果:

=> {:res_message => {:结果=>【周五,23 2011年9月,星期五,2011年9月23日,星期五, 23 2011年9月, 2011年9月23日,星期五,2011年9月23日星期五], :@ xmlns =>“http://xxx-xxx.xxx.edu/xxx/”}, :“@ xmlns:soapenv”=>“http: //schemas.xmlsoap.org/soap/envelope/“}

我没有找到这个位置也不是萨翁问题

由于该解决方案提前

回答