Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #105 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

private method `hour' called for Date (not DateTime) mapping

Reported by: nahi Assigned to: nahi
Priority: normal Milestone: 1.5.4
Component: soap4r Version: 1.5
Keywords: Cc:

Description

前田です。

DateオブジェクトをSOAPで扱おうとすると、

$ ruby-cvs -v -I lib -r date -r soap/mapping -e 'p
SOAP::Mapping.obj2soap(Date.today).to_s'
ruby 1.9.0 (2005-05-11) [i686-linux]
/home/shugo/src/ruby/lib/xsd/datatypes.rb:611:in `_to_s': private method
`hour' called for #<Date: 4907003/2,0,2299161> (NoMethodError)
       from /home/shugo/src/ruby/lib/xsd/datatypes.rb:149:in `to_s'
       from -e:1

のようなエラーになるのですが、これはバグでしょうか。
上の例はtrunkのHEADですが、1.8でも同様です。

soap/mapping/registry.rbの205行目の

  204      [::DateTime,     ::SOAP::SOAPDateTime,   DateTimeFactory],
  205      [::Date,         ::SOAP::SOAPDateTime,   DateTimeFactory],
  206      [::Date,         ::SOAP::SOAPDate,       DateTimeFactory],

という部分があやしいと思ってコメントアウトしてみると、今度は、

$ ruby-cvs -v -I lib -r date -r soap/mapping -e 'p
SOAP::Mapping.obj2soap(Date.today).to_s'
ruby 1.9.0 (2005-05-11) [i686-linux]
/home/shugo/src/ruby/lib/xsd/datatypes.rb:557:in `add_tz': private
method `offset' called for #<Date: 4907003/2,0,2299161> (NoMethodError)
       from /home/shugo/src/ruby/lib/xsd/datatypes.rb:702:in `_to_s'
       from /home/shugo/src/ruby/lib/xsd/datatypes.rb:149:in `to_s'
       from -e:1

のようなエラーでした:(

Change History

05/11/05 22:05:03 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1545]) add tests for #105. closes #105.

05/12/05 02:41:23 changed by nahi

  • status changed from closed to reopened.
  • resolution deleted.
 [::Date,          ::SOAP::SOAPDateTime,   DateTimeFactory],

の方ではなく、

 [::Date,         ::SOAP::SOAPDate,       DateTimeFactory],

の方が削除されているようですが、これはこういうものなんです?
あと、SOAPBaseMapの方にも同じような部分がありますが、問題ない
でしょうか。

それから、内部的にはDateTimeで持つとのことですが、

$ ruby -r date -r soap/mapping -e 'xd =
SOAP::Mapping.obj2soap(Date.today); p xd.class; d =
SOAP::Mapping.soap2obj(xd); p d.class'
SOAP::SOAPDate
DateTime

のように、SOAP::SOAPDate -> DateTimeになるのは意図的ということ
でしょうか。
このためか、Railsでxsd:dateな値を受け取るとDateTimeに変換されて
しまうのですが、これはRails側で対処するべきなんですかね。

05/12/05 10:15:22 changed by nahi

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [1548]) add tests for #105 and fixed another bug Date.year < 0 handling. closes #105.

05/29/06 10:37:35 changed by kkkkoaaa

Keep a good job up! http://quick-adult-links.com