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

root/trunk/test/wsdl/test_fault.rb

Revision 1673, 1.5 kB (checked in by nahi, 3 years ago)

updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1 require 'test/unit'
2 require 'soap/processor'
3 require 'soap/mapping'
4 require 'soap/rpc/element'
5 require 'wsdl/parser'
6
7
8 module WSDL
9
10
11 class TestFault < Test::Unit::TestCase
12   def setup
13     @xml =<<__EOX__
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">
18   <env:Body>
19     <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
20         env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
21       <faultcode>Server</faultcode>
22       <faultstring>faultstring</faultstring>
23       <faultactor>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"/>
28       </detail>
29     </env:Fault>
30     <cause id="id123" xsi:type="xsd:int">5</cause>
31   </env:Body>
32 </env:Envelope>
33 __EOX__
34   end
35
36   def test_by_wsdl
37     rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes
38     opt = {}
39     opt[:default_encodingstyle] = ::SOAP::EncodingNamespace
40     header, body = ::SOAP::Processor.unmarshal(@xml, opt)
41     fault = ::SOAP::Mapping.soap2obj(body.response)
42     assert_equal("Server", fault.faultcode)
43     assert_equal("faultstring", fault.faultstring)
44     assert_equal("faultactor", fault.faultactor)
45     assert_equal(5, fault.detail.cause)
46   end
47 end
48
49
50 end
Note: See TracBrowser for help on using the browser.