Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]
Chris Roos wrote:
> I've got some xml that represents a soap fault.  I'd like to create a
> ruby object to represent it.
>
> If I go through the full process of submitting a soap request that
> generates an error then I get a ruby object back.  If I essentially
> replicate what soap/rpc/proxy is doing I get an error.

require 'soap/rpc/router'

# get an exception
e = begin
  raise NotImplementedError.new("hello world")
rescue NotImplementedError
  $!
end

# dump it as an XML
fault = SOAP::RPC::Router.new("dummy").__send__(:fault, e)
env = SOAP::SOAPEnvelope.new(nil, SOAP::SOAPBody.new(fault))
xml = SOAP::Processor.marshal(env)
puts xml

# get an object from SOAPFault
env = SOAP::Processor.unmarshal(xml)
body = env.body
fault = body.root_node
obj = SOAP::Mapping.soap2obj(fault)

p obj.faultcode
p obj.faultstring
p obj.faultactor
p obj.detail

Regards,
// NaHi