require 'test/unit' require 'soap/processor' require 'soap/mapping' require 'soap/rpc/element' require 'wsdl/parser' module WSDL class TestFault < Test::Unit::TestCase def setup @xml =<<__EOX__ Server faultstring faultactor type 5 __EOX__ end def test_by_wsdl rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes opt = {} opt[:default_encodingstyle] = ::SOAP::EncodingNamespace opt[:decode_typemap] = rpc_decode_typemap header, body = ::SOAP::Processor.unmarshal(@xml, opt) fault = ::SOAP::Mapping.soap2obj(body.response) assert_equal("Server", fault.faultcode) assert_equal("faultstring", fault.faultstring) assert_equal(URI.parse("faultactor"), fault.faultactor) assert_equal(5, fault.detail.cause) end end end