sekken 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +11 -0
- data/.yardopts +6 -0
- data/CONTRIBUTING.md +46 -0
- data/Gemfile +27 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +21 -0
- data/donate.png +0 -0
- data/lib/sekken.rb +75 -0
- data/lib/sekken/envelope.rb +92 -0
- data/lib/sekken/errors.rb +9 -0
- data/lib/sekken/example_message.rb +41 -0
- data/lib/sekken/httpclient.rb +35 -0
- data/lib/sekken/importer.rb +77 -0
- data/lib/sekken/message.rb +135 -0
- data/lib/sekken/operation.rb +100 -0
- data/lib/sekken/resolver.rb +20 -0
- data/lib/sekken/response.rb +50 -0
- data/lib/sekken/version.rb +5 -0
- data/lib/sekken/wsdl.rb +86 -0
- data/lib/sekken/wsdl/binding.rb +64 -0
- data/lib/sekken/wsdl/binding_operation.rb +85 -0
- data/lib/sekken/wsdl/document.rb +83 -0
- data/lib/sekken/wsdl/document_collection.rb +61 -0
- data/lib/sekken/wsdl/input_output.rb +84 -0
- data/lib/sekken/wsdl/message.rb +38 -0
- data/lib/sekken/wsdl/operation.rb +47 -0
- data/lib/sekken/wsdl/port.rb +29 -0
- data/lib/sekken/wsdl/port_type.rb +38 -0
- data/lib/sekken/wsdl/port_type_operation.rb +42 -0
- data/lib/sekken/wsdl/service.rb +55 -0
- data/lib/sekken/xml/attribute.rb +13 -0
- data/lib/sekken/xml/element.rb +82 -0
- data/lib/sekken/xml/element_builder.rb +220 -0
- data/lib/sekken/xs/schema.rb +57 -0
- data/lib/sekken/xs/schema_collection.rb +49 -0
- data/lib/sekken/xs/types.rb +272 -0
- data/sekken.gemspec +42 -0
- data/spec/fixtures/response/another_soap_fault.xml +14 -0
- data/spec/fixtures/response/authentication.xml +14 -0
- data/spec/fixtures/response/header.xml +13 -0
- data/spec/fixtures/response/list.xml +18 -0
- data/spec/fixtures/response/multi_ref.xml +39 -0
- data/spec/fixtures/response/soap_fault.xml +8 -0
- data/spec/fixtures/response/soap_fault12.xml +18 -0
- data/spec/fixtures/response/taxcloud.xml +1 -0
- data/spec/fixtures/wsdl/amazon.wsdl +1920 -0
- data/spec/fixtures/wsdl/arrays_with_attributes.wsdl +117 -0
- data/spec/fixtures/wsdl/authentication.wsdl +63 -0
- data/spec/fixtures/wsdl/awse.wsdl +1510 -0
- data/spec/fixtures/wsdl/betfair.wsdl +2981 -0
- data/spec/fixtures/wsdl/blz_service.wsdl +88 -0
- data/spec/fixtures/wsdl/bookt/bookt.wsdl +11 -0
- data/spec/fixtures/wsdl/bookt/bookt0.xsd +433 -0
- data/spec/fixtures/wsdl/bookt/bookt1.xsd +42 -0
- data/spec/fixtures/wsdl/bookt/bookt10.xsd +38 -0
- data/spec/fixtures/wsdl/bookt/bookt11.xsd +17 -0
- data/spec/fixtures/wsdl/bookt/bookt12.xsd +18 -0
- data/spec/fixtures/wsdl/bookt/bookt13.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt14.xsd +27 -0
- data/spec/fixtures/wsdl/bookt/bookt15.xsd +28 -0
- data/spec/fixtures/wsdl/bookt/bookt2.wsdl +243 -0
- data/spec/fixtures/wsdl/bookt/bookt2.xsd +81 -0
- data/spec/fixtures/wsdl/bookt/bookt3.wsdl +286 -0
- data/spec/fixtures/wsdl/bookt/bookt3.xsd +61 -0
- data/spec/fixtures/wsdl/bookt/bookt4.xsd +35 -0
- data/spec/fixtures/wsdl/bookt/bookt5.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt6.xsd +26 -0
- data/spec/fixtures/wsdl/bookt/bookt7.xsd +18 -0
- data/spec/fixtures/wsdl/bookt/bookt8.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt9.xsd +29 -0
- data/spec/fixtures/wsdl/bronto.wsdl +3285 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange.wsdl +104 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange0.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange1.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange2.wsdl +119 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange2.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange3.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange4.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange5.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange6.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange7.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange8.xsd +1 -0
- data/spec/fixtures/wsdl/crowd.wsdl +2437 -0
- data/spec/fixtures/wsdl/data_exchange.wsdl +98 -0
- data/spec/fixtures/wsdl/document_literal_wrapped.wsdl +153 -0
- data/spec/fixtures/wsdl/economic.wsdl +65660 -0
- data/spec/fixtures/wsdl/edialog.wsdl +13148 -0
- data/spec/fixtures/wsdl/email_verification.wsdl +394 -0
- data/spec/fixtures/wsdl/equifax.wsdl +794 -0
- data/spec/fixtures/wsdl/geotrust.wsdl +156 -0
- data/spec/fixtures/wsdl/interhome.wsdl +2137 -0
- data/spec/fixtures/wsdl/iws.wsdl +695 -0
- data/spec/fixtures/wsdl/jetairways.wsdl +156 -0
- data/spec/fixtures/wsdl/jira.wsdl +3890 -0
- data/spec/fixtures/wsdl/juniper.wsdl +215 -0
- data/spec/fixtures/wsdl/namespaced_actions.wsdl +307 -0
- data/spec/fixtures/wsdl/oracle.wsdl +3629 -0
- data/spec/fixtures/wsdl/ratp.wsdl +955 -0
- data/spec/fixtures/wsdl/rio2/rio2.wsdl +74 -0
- data/spec/fixtures/wsdl/rio2/rio2_0.wsdl +55 -0
- data/spec/fixtures/wsdl/rio2/rio2_0.xsd +58 -0
- data/spec/fixtures/wsdl/rio2/rio2_1.xsd +41 -0
- data/spec/fixtures/wsdl/rio2/rio2_2.xsd +222 -0
- data/spec/fixtures/wsdl/rio2/rio2_3.xsd +10 -0
- data/spec/fixtures/wsdl/rpc_literal.wsdl +105 -0
- data/spec/fixtures/wsdl/spyne.wsdl +70 -0
- data/spec/fixtures/wsdl/stockquote.wsdl +124 -0
- data/spec/fixtures/wsdl/taxcloud.wsdl +934 -0
- data/spec/fixtures/wsdl/team_software/team_software.wsdl +542 -0
- data/spec/fixtures/wsdl/team_software/team_software0.xsd +448 -0
- data/spec/fixtures/wsdl/team_software/team_software1.xsd +41 -0
- data/spec/fixtures/wsdl/team_software/team_software2.xsd +258 -0
- data/spec/fixtures/wsdl/team_software/team_software3.xsd +14 -0
- data/spec/fixtures/wsdl/telefonkatalogen.wsdl +45 -0
- data/spec/fixtures/wsdl/temperature.wsdl +136 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth.wsdl +157 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth1.xsd +210 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth2.xsd +549 -0
- data/spec/fixtures/wsdl/xignite.wsdl +3470 -0
- data/spec/fixtures/wsdl/yahoo.wsdl +2425 -0
- data/spec/fixtures/wsdl/zanox_export_service.xml +520 -0
- data/spec/integration/amazon_spec.rb +51 -0
- data/spec/integration/authentication_spec.rb +38 -0
- data/spec/integration/awse_spec.rb +95 -0
- data/spec/integration/betfair_spec.rb +179 -0
- data/spec/integration/blz_service_spec.rb +46 -0
- data/spec/integration/bookt_spec.rb +59 -0
- data/spec/integration/bronto_spec.rb +178 -0
- data/spec/integration/bydexchange_spec.rb +40 -0
- data/spec/integration/crowd_spec.rb +44 -0
- data/spec/integration/data_exchange_spec.rb +27 -0
- data/spec/integration/document_literal_spec.rb +104 -0
- data/spec/integration/economic_spec.rb +64 -0
- data/spec/integration/email_verification_spec.rb +82 -0
- data/spec/integration/equifax_spec.rb +216 -0
- data/spec/integration/geotrust_spec.rb +17 -0
- data/spec/integration/interhome_spec.rb +156 -0
- data/spec/integration/iws_spec.rb +27 -0
- data/spec/integration/jetairways_spec.rb +142 -0
- data/spec/integration/jira_spec.rb +27 -0
- data/spec/integration/juniper_spec.rb +20 -0
- data/spec/integration/namespaced_actions_spec.rb +37 -0
- data/spec/integration/oracle_spec.rb +61 -0
- data/spec/integration/ratp_spec.rb +178 -0
- data/spec/integration/rio2_spec.rb +56 -0
- data/spec/integration/rpc_literal_spec.rb +101 -0
- data/spec/integration/spyne_spec.rb +60 -0
- data/spec/integration/stockquote_spec.rb +46 -0
- data/spec/integration/taxcloud_spec.rb +45 -0
- data/spec/integration/team_software_spec.rb +51 -0
- data/spec/integration/telefonkatalogen_spec.rb +42 -0
- data/spec/integration/temperature_spec.rb +71 -0
- data/spec/integration/wasmuth_spec.rb +47 -0
- data/spec/integration/xignite_spec.rb +112 -0
- data/spec/integration/yahoo_spec.rb +116 -0
- data/spec/sekken/httpclient_spec.rb +41 -0
- data/spec/sekken/operation/build_spec.rb +308 -0
- data/spec/sekken/operation/document_literal_spec.rb +53 -0
- data/spec/sekken/operation/example_body_spec.rb +95 -0
- data/spec/sekken/operation/rpc_literal_spec.rb +50 -0
- data/spec/sekken/operation_spec.rb +169 -0
- data/spec/sekken/resolver_spec.rb +38 -0
- data/spec/sekken/response_spec.rb +17 -0
- data/spec/sekken/wsdl/document_spec.rb +191 -0
- data/spec/sekken/wsdl_spec.rb +46 -0
- data/spec/sekken/xs/complex_type_spec.rb +197 -0
- data/spec/sekken/xs/element_spec.rb +82 -0
- data/spec/sekken/xs/simple_type_spec.rb +39 -0
- data/spec/sekken_spec.rb +128 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/fixture.rb +19 -0
- data/spec/support/http_mock.rb +43 -0
- metadata +344 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'sekken/wsdl/binding_operation'
|
2
|
+
|
3
|
+
class Sekken
|
4
|
+
class WSDL
|
5
|
+
class Binding
|
6
|
+
|
7
|
+
def initialize(binding_node)
|
8
|
+
@binding_node = binding_node
|
9
|
+
|
10
|
+
@name = binding_node['name']
|
11
|
+
@port_type = binding_node['type']
|
12
|
+
|
13
|
+
if soap_node = find_soap_node
|
14
|
+
@style = soap_node['style'] || 'document'
|
15
|
+
@transport = soap_node['transport']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :name, :port_type, :style, :transport
|
20
|
+
|
21
|
+
def fetch_port_type(documents)
|
22
|
+
port_type_local = @port_type.split(':').last
|
23
|
+
|
24
|
+
documents.port_types.fetch(port_type_local) {
|
25
|
+
raise "Unable to find portType #{port_type_local.inspect} for binding #{@name.inspect}"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def operations
|
30
|
+
@operations ||= operations!
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def operations!
|
36
|
+
operations = {}
|
37
|
+
|
38
|
+
@binding_node.element_children.each do |operation_node|
|
39
|
+
next unless operation_node.name == 'operation'
|
40
|
+
|
41
|
+
operation_name = operation_node['name']
|
42
|
+
operation = BindingOperation.new(operation_node, :style => @style)
|
43
|
+
|
44
|
+
operations[operation_name] = operation
|
45
|
+
end
|
46
|
+
|
47
|
+
operations
|
48
|
+
end
|
49
|
+
|
50
|
+
def find_soap_node
|
51
|
+
@binding_node.element_children.find { |node|
|
52
|
+
namespace = node.namespace.href
|
53
|
+
|
54
|
+
soap_1_1 = namespace == Sekken::NS_SOAP_1_1
|
55
|
+
soap_1_2 = namespace == Sekken::NS_SOAP_1_2
|
56
|
+
binding = node.name == 'binding'
|
57
|
+
|
58
|
+
(soap_1_1 || soap_1_2) && binding
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class Sekken
|
2
|
+
class WSDL
|
3
|
+
class BindingOperation
|
4
|
+
|
5
|
+
def initialize(operation_node, defaults = {})
|
6
|
+
@operation_node = operation_node
|
7
|
+
|
8
|
+
if soap_operation_node = find_soap_operation_node
|
9
|
+
namespace = soap_operation_node.first
|
10
|
+
node = soap_operation_node.last
|
11
|
+
|
12
|
+
@soap_namespace = namespace
|
13
|
+
@soap_action = node['soapAction']
|
14
|
+
@style = node['style'] || defaults[:style]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :soap_action, :style, :soap_namespace
|
19
|
+
|
20
|
+
def name
|
21
|
+
@operation_node['name']
|
22
|
+
end
|
23
|
+
|
24
|
+
# TODO: maybe use proper classes to clean this up.
|
25
|
+
def input_headers
|
26
|
+
return @input_headers if @input_headers
|
27
|
+
input_headers = []
|
28
|
+
|
29
|
+
if header_nodes = find_input_child_nodes('header')
|
30
|
+
header_nodes.each do |header_node|
|
31
|
+
input_headers << {
|
32
|
+
encoding_style: header_node['encodingStyle'],
|
33
|
+
namespace: header_node['namespace'],
|
34
|
+
use: header_node['use'],
|
35
|
+
message: header_node['message'],
|
36
|
+
part: header_node['part']
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
@input_headers = input_headers
|
42
|
+
end
|
43
|
+
|
44
|
+
# TODO: maybe use proper classes to clean this up.
|
45
|
+
def input_body
|
46
|
+
return @input_body if @input_body
|
47
|
+
input_body = {}
|
48
|
+
|
49
|
+
if body_node = find_input_child_nodes('body').first
|
50
|
+
input_body = {
|
51
|
+
encoding_style: body_node['encodingStyle'],
|
52
|
+
namespace: body_node['namespace'],
|
53
|
+
use: body_node['use']
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
@input_body = input_body
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def find_input_child_nodes(child_name)
|
63
|
+
input_node = @operation_node.element_children.find { |node| node.name == 'input' }
|
64
|
+
return unless input_node
|
65
|
+
|
66
|
+
input_node.element_children.select { |node| node.name == child_name }
|
67
|
+
end
|
68
|
+
|
69
|
+
def find_soap_operation_node
|
70
|
+
@operation_node.element_children.each do |node|
|
71
|
+
namespace = node.namespace.href
|
72
|
+
|
73
|
+
soap_1_1 = namespace == Sekken::NS_SOAP_1_1
|
74
|
+
soap_1_2 = namespace == Sekken::NS_SOAP_1_2
|
75
|
+
operation = node.name == 'operation'
|
76
|
+
|
77
|
+
return [namespace, node] if (soap_1_1 || soap_1_2) && operation
|
78
|
+
end
|
79
|
+
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'sekken/xs/schema'
|
2
|
+
require 'sekken/wsdl/message'
|
3
|
+
require 'sekken/wsdl/port_type'
|
4
|
+
require 'sekken/wsdl/binding'
|
5
|
+
require 'sekken/wsdl/service'
|
6
|
+
|
7
|
+
class Sekken
|
8
|
+
class WSDL
|
9
|
+
class Document
|
10
|
+
|
11
|
+
def initialize(document, schemas)
|
12
|
+
@document = document
|
13
|
+
@schemas = schemas
|
14
|
+
|
15
|
+
@messages, @bindings, @port_types, @services = {}, {}, {}, {}
|
16
|
+
|
17
|
+
collect_sections(
|
18
|
+
'message' => { :collection => @messages, :container => Message },
|
19
|
+
'binding' => { :collection => @bindings, :container => Binding },
|
20
|
+
'portType' => { :collection => @port_types, :container => PortType },
|
21
|
+
'service' => { :collection => @services, :container => Service }
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_reader :messages, :port_types, :bindings, :services
|
26
|
+
|
27
|
+
def service_name
|
28
|
+
@document.root['name']
|
29
|
+
end
|
30
|
+
|
31
|
+
def target_namespace
|
32
|
+
@document.root['targetNamespace']
|
33
|
+
end
|
34
|
+
|
35
|
+
def schemas
|
36
|
+
schema_nodes.map { |node| XS::Schema.new(node, @schemas) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def imports
|
40
|
+
imports = []
|
41
|
+
|
42
|
+
@document.root.xpath('wsdl:import', 'wsdl' => Sekken::NS_WSDL).each do |node|
|
43
|
+
location = node['location']
|
44
|
+
imports << location if location
|
45
|
+
end
|
46
|
+
|
47
|
+
imports
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def collect_sections(mapping)
|
53
|
+
section_types = mapping.keys
|
54
|
+
|
55
|
+
@document.root.element_children.each do |node|
|
56
|
+
section_type = node.name
|
57
|
+
next unless section_types.include? section_type
|
58
|
+
|
59
|
+
node_name = node['name']
|
60
|
+
type_mapping = mapping.fetch(section_type)
|
61
|
+
|
62
|
+
collection = type_mapping[:collection]
|
63
|
+
container = type_mapping[:container]
|
64
|
+
|
65
|
+
collection[node_name] = container.new(node)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def schema_nodes
|
70
|
+
@schema_nodes ||= schema_nodes! || []
|
71
|
+
end
|
72
|
+
|
73
|
+
def schema_nodes!
|
74
|
+
root = @document.root
|
75
|
+
return [root] if root.name == 'schema'
|
76
|
+
|
77
|
+
types = root.at_xpath('wsdl:types', 'wsdl' => Sekken::NS_WSDL)
|
78
|
+
types.element_children if types
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
class Sekken
|
4
|
+
class WSDL
|
5
|
+
class DocumentCollection
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@documents = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def <<(document)
|
13
|
+
@documents << document
|
14
|
+
end
|
15
|
+
|
16
|
+
def each(&block)
|
17
|
+
@documents.each(&block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def service_name
|
21
|
+
@service_name ||= first.service_name
|
22
|
+
end
|
23
|
+
|
24
|
+
def messages
|
25
|
+
@messages ||= collect_sections { |document| document.messages }
|
26
|
+
end
|
27
|
+
|
28
|
+
def port_types
|
29
|
+
@port_types ||= collect_sections { |document| document.port_types }
|
30
|
+
end
|
31
|
+
|
32
|
+
def bindings
|
33
|
+
@bindings ||= collect_sections { |document| document.bindings }
|
34
|
+
end
|
35
|
+
|
36
|
+
def services
|
37
|
+
@services ||= collect_sections { |document| document.services }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Public: Returns a port by service and port name.
|
41
|
+
def service_port(service_name, port_name)
|
42
|
+
service = services.fetch(service_name)
|
43
|
+
service.ports.fetch(port_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def collect_sections
|
49
|
+
result = {}
|
50
|
+
|
51
|
+
each do |document|
|
52
|
+
sections = yield document
|
53
|
+
result.merge! sections
|
54
|
+
end
|
55
|
+
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class Sekken
|
2
|
+
class WSDL
|
3
|
+
|
4
|
+
class Input
|
5
|
+
|
6
|
+
def initialize(binding_operation, port_type_operation, wsdl)
|
7
|
+
@binding_operation = binding_operation
|
8
|
+
@port_type_operation = port_type_operation
|
9
|
+
@wsdl = wsdl
|
10
|
+
|
11
|
+
build_parts
|
12
|
+
end
|
13
|
+
|
14
|
+
# Public: Returns the header part Elements.
|
15
|
+
attr_reader :header_parts
|
16
|
+
|
17
|
+
# Public: Returns the body part Elements.
|
18
|
+
attr_reader :body_parts
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def build_parts
|
23
|
+
body_parts = collect_body_parts
|
24
|
+
header_parts = collect_header_parts
|
25
|
+
|
26
|
+
# remove explicit header parts from the body parts
|
27
|
+
header_part_names = header_parts.map { |part| part[:name] }
|
28
|
+
body_parts.reject! { |part| header_part_names.include? part[:name] }
|
29
|
+
|
30
|
+
@header_parts = XML::ElementBuilder.new(@wsdl.schemas).build(header_parts)
|
31
|
+
@body_parts = XML::ElementBuilder.new(@wsdl.schemas).build(body_parts)
|
32
|
+
end
|
33
|
+
|
34
|
+
def collect_body_parts
|
35
|
+
find_message(message_name).parts
|
36
|
+
end
|
37
|
+
|
38
|
+
def message_name
|
39
|
+
@port_type_operation.input[:message]
|
40
|
+
end
|
41
|
+
|
42
|
+
def collect_header_parts
|
43
|
+
parts = []
|
44
|
+
|
45
|
+
headers.each do |header|
|
46
|
+
next unless header[:message] && header[:part]
|
47
|
+
message_parts = find_message(header[:message]).parts
|
48
|
+
|
49
|
+
# only add the single header part from the message
|
50
|
+
parts << message_parts.find { |part| part[:name] == header[:part] }
|
51
|
+
end
|
52
|
+
|
53
|
+
parts
|
54
|
+
end
|
55
|
+
|
56
|
+
def headers
|
57
|
+
@binding_operation.input_headers
|
58
|
+
end
|
59
|
+
|
60
|
+
def find_message(qname)
|
61
|
+
local = qname.split(':').last
|
62
|
+
|
63
|
+
@wsdl.documents.messages[local] or
|
64
|
+
raise "Unable to find message #{qname.inspect}"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
class Output < Input
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def message_name
|
74
|
+
@port_type_operation.output[:message]
|
75
|
+
end
|
76
|
+
|
77
|
+
def headers
|
78
|
+
@binding_operation.output_headers
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Sekken
|
2
|
+
class WSDL
|
3
|
+
class Message
|
4
|
+
|
5
|
+
def initialize(message_node)
|
6
|
+
@message_node = message_node
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
@message_node['name']
|
11
|
+
end
|
12
|
+
|
13
|
+
def parts
|
14
|
+
@parts ||= parts!
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def parts!
|
20
|
+
parts = []
|
21
|
+
|
22
|
+
@message_node.element_children.each do |part|
|
23
|
+
next unless part.name == 'part'
|
24
|
+
|
25
|
+
parts << {
|
26
|
+
:name => part['name'],
|
27
|
+
:type => part['type'],
|
28
|
+
:element => part['element'],
|
29
|
+
:namespaces => part.namespaces
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
parts
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'sekken/wsdl/input_output'
|
2
|
+
require 'sekken/xml/element_builder'
|
3
|
+
|
4
|
+
class Sekken
|
5
|
+
class WSDL
|
6
|
+
class Operation
|
7
|
+
|
8
|
+
def initialize(name, endpoint, binding_operation, port_type_operation, wsdl)
|
9
|
+
@name = name
|
10
|
+
@endpoint = endpoint
|
11
|
+
@binding_operation = binding_operation
|
12
|
+
@port_type_operation = port_type_operation
|
13
|
+
@wsdl = wsdl
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :name, :endpoint, :binding_operation, :port_type_operation
|
17
|
+
|
18
|
+
def soap_action
|
19
|
+
@binding_operation.soap_action
|
20
|
+
end
|
21
|
+
|
22
|
+
def soap_version
|
23
|
+
case @binding_operation.soap_namespace
|
24
|
+
when Sekken::NS_SOAP_1_1 then '1.1'
|
25
|
+
when Sekken::NS_SOAP_1_2 then '1.2'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def input
|
30
|
+
@input ||= Input.new(@binding_operation, @port_type_operation, @wsdl)
|
31
|
+
end
|
32
|
+
|
33
|
+
def output
|
34
|
+
@output ||= Output.new(@binding_operation, @port_type_operation, @wsdl)
|
35
|
+
end
|
36
|
+
|
37
|
+
def input_style
|
38
|
+
"#{@binding_operation.style}/#{@binding_operation.input_body[:use]}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def output_style
|
42
|
+
"#{@binding_operation.style}/#{@binding_operation.output[:body][:use]}"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|