2011-09-24 7 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일 (금), 금, 23 구월 2011]

012,351,

날짜에 좋지만 결과의 다른 부분 (양, 시간, 사용자 및 유형)이 누락되었습니다. 내가 response.body를 호출하는 경우 또한 나는이 같은 결과를 점점 계속 :

=> {: res_message => {: 결과 => [금, 2011년 9월 23일, 금, 2011년 9월 23일, 금, 2011년 9월 23일, 2012 년 9 월 23 일 금요일], : @ xmlns => "http://xxx-xxx.xxx.edu/xxx/"}, : "@ xmlns : soapenv"=> "http : 내가 미리

이 여기에도 Savon 문제

감사에 대한 해결책을 찾을 수 없습니다

//schemas.xmlsoap.org/soap/envelope/ "}

h = Hash.from_xml(response.to_xml) 

을하고 당신에게 올바른 해시를 줄 것이다 : 617,451,515,

답변

관련 문제