1 | # SOAP4R - marshal/unmarshal interface.
|
---|
2 | # Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <[email protected]>.
|
---|
3 |
|
---|
4 | # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
---|
5 | # redistribute it and/or modify it under the same terms of Ruby's license;
|
---|
6 | # either the dual license version in 2003, or any later version.
|
---|
7 |
|
---|
8 |
|
---|
9 | require 'xsd/datatypes'
|
---|
10 | require 'soap/soap'
|
---|
11 | require 'soap/element'
|
---|
12 | require 'soap/parser'
|
---|
13 | require 'soap/generator'
|
---|
14 | require 'soap/encodingstyle/soapHandler'
|
---|
15 | require 'soap/encodingstyle/literalHandler'
|
---|
16 | require 'soap/encodingstyle/aspDotNetHandler'
|
---|
17 |
|
---|
18 |
|
---|
19 | module SOAP
|
---|
20 |
|
---|
21 |
|
---|
22 | module Processor
|
---|
23 | @@default_parser_option = {}
|
---|
24 |
|
---|
25 | class << self
|
---|
26 | public
|
---|
27 |
|
---|
28 | def marshal(env, opt = {}, io = nil)
|
---|
29 | generator = create_generator(opt)
|
---|
30 | marshalled_str = generator.generate(env, io)
|
---|
31 | unless env.external_content.empty?
|
---|
32 | opt[:external_content] = env.external_content
|
---|
33 | end
|
---|
34 | marshalled_str
|
---|
35 | end
|
---|
36 |
|
---|
37 | def unmarshal(stream, opt = {})
|
---|
38 | parser = create_parser(opt)
|
---|
39 | parser.parse(stream)
|
---|
40 | end
|
---|
41 |
|
---|
42 | def default_parser_option=(rhs)
|
---|
43 | @@default_parser_option = rhs
|
---|
44 | end
|
---|
45 |
|
---|
46 | def default_parser_option
|
---|
47 | @@default_parser_option
|
---|
48 | end
|
---|
49 |
|
---|
50 | private
|
---|
51 |
|
---|
52 | def create_generator(opt)
|
---|
53 | SOAPGenerator.new(opt)
|
---|
54 | end
|
---|
55 |
|
---|
56 | def create_parser(opt)
|
---|
57 | if opt.empty?
|
---|
58 | opt = @@default_parser_option
|
---|
59 | end
|
---|
60 | ::SOAP::Parser.new(opt)
|
---|
61 | end
|
---|
62 | end
|
---|
63 | end
|
---|
64 |
|
---|
65 |
|
---|
66 | end
|
---|