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

Ticket #466 (new defect)

Opened 9 months ago

Error loading Marshaled data

Reported by: user Assigned to: nahi
Priority: normal Milestone: 1.5.9
Component: soap4r Version: 1.5
Keywords: marshal Cc:

Description

I'm coding a client application connecting to SOAP server similar to Google AdWords?. Instead of retrieving data each time from the server i decided to marshal it to a file and load at development time. I created a complex object that contains arrays of nested objects retrieved using soap4r v1.5.8. I got error when loaded marshaled data.

   File.open("campaigns", "w+") do |f|
     Marshal.dump(@campaigns, f)
   end

   File.open("campaigns") do |f|  
      @campaigns = Marshal.load(f)  # Error is raised here
   end

Error message:

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

RAILS_ROOT: D:/Dima/Work/Edvantis/20070525_DDL/MetaAPI/rails
Application Trace | Framework Trace | Full Trace

C:/ruby/lib/ruby/1.8/soap/mapping/mapping.rb:371:in `safemethodname'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:109:in `__define_attr_accessor'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:92:in `__add_xmlele_value'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:163:in `__import'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:162:in `each'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:162:in `__import'
C:/ruby/lib/ruby/1.8/soap/mapping/registry.rb:100:in `marshal_load'

Marshaled data file is attached.

When i commented a couple of lines in the mapping.rb file error is gone.

  def self.safemethodname(name)
    #Thread.current[:SOAPMapping][:SafeMethodName][name] ||=
    #  XSD::CodeGen::GenSupport.safemethodname(name)
    name
  end

Currently i can't dive deeper in code but i can help with testing or providing additional info. Thanks, Dima Samodurov.

Attachments

campaigns (8.7 kB) - added by user on 03/21/08 08:49:34.
marshaled data sample

Change History

03/21/08 08:49:34 changed by user

  • attachment campaigns added.

marshaled data sample