diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-30 04:33:02 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-30 04:33:02 +0000 |
commit | d268bf305e926b5418d843098e35462cf97df662 (patch) | |
tree | 4268267cc8e52a533e4c78490ce6c2009971f972 /test/wsdl/test_fault.rb | |
parent | 165d101eed53d09aa614d93557b077305a52006b (diff) |
* lib/soap/encodingstyle/soapHandler.rb: refactoring - Simplifying
Conditional Expressions.
* lib/wsdl/soap/definitions.rb: refactoring - Move Method.
* test/xsd/{test_noencoding.rb,noencoding.xml}: new files. test for
encoding unspecified XML file parsing.
* test/wsdl/{test_fault.rb,map,datetime}: new files. test of
SOAPFault, dateTime and Apache's Map.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/wsdl/test_fault.rb')
-rw-r--r-- | test/wsdl/test_fault.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/wsdl/test_fault.rb b/test/wsdl/test_fault.rb new file mode 100644 index 0000000000..ec414528ee --- /dev/null +++ b/test/wsdl/test_fault.rb @@ -0,0 +1,51 @@ +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__ +<?xml version="1.0" encoding="utf-8" ?> +<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <env:Body> + <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" + env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <faultcode xsi:type="xsd:string">Server</faultcode> + <faultstring xsi:type="xsd:string">faultstring</faultstring> + <faultactor xsi:type="xsd:string">faultactor</faultactor> + <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom" + xsi:type="n2:SOAPException"> + <excn_type_name xsi:type="xsd:string">type</excn_type_name> + <cause href="#id123"/> + </detail> + </env:Fault> + <cause id="id123" xsi:type="xsd:int">5</cause> + </env:Body> +</env:Envelope> +__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 |