2 require 'soap/processor'
4 require 'soap/rpc/element'
11 class TestFault < Test::Unit::TestCase
14 <?xml version="1.0" encoding="utf-8" ?>
15 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
16 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
17 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
19 <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
20 env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
21 <faultcode xsi:type="xsd:string">Server</faultcode>
22 <faultstring xsi:type="xsd:string">faultstring</faultstring>
23 <faultactor xsi:type="xsd:string">faultactor</faultactor>
24 <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom"
25 xsi:type="n2:SOAPException">
26 <excn_type_name xsi:type="xsd:string">type</excn_type_name>
27 <cause href="#id123"/>
30 <cause id="id123" xsi:type="xsd:int">5</cause>
37 rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes
39 opt[:default_encodingstyle] = ::SOAP::EncodingNamespace
40 opt[:decode_typemap] = rpc_decode_typemap
41 header, body = ::SOAP::Processor.unmarshal(@xml, opt)
42 fault = ::SOAP::Mapping.soap2obj(body.response)
43 assert_equal("Server", fault.faultcode)
44 assert_equal("faultstring", fault.faultstring)
45 assert_equal(URI.parse("faultactor"), fault.faultactor)
46 assert_equal(5, fault.detail.cause)