Class: WsdlMapper::SvcDescParsing::BindingParser

Inherits:
ParserBase show all
Defined in:
lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb

Constant Summary

Constant Summary

Constants inherited from ParserBase

ParserBase::Soap, ParserBase::SoapEnc, ParserBase::SoapHttp

Constants included from Wsdl11

Wsdl11::ARRAY_TYPE, Wsdl11::BINDING, Wsdl11::DEFINITIONS, Wsdl11::DOCUMENTATION, Wsdl11::FAULT, Wsdl11::INPUT, Wsdl11::MESSAGE, Wsdl11::NS, Wsdl11::OPERATION, Wsdl11::OUTPUT, Wsdl11::PART, Wsdl11::PORT, Wsdl11::PORT_TYPE, Wsdl11::SERVICE, Wsdl11::TYPES

Constants inherited from Parsing::Base

Parsing::Base::NS_DECL_PREFIX, Parsing::Base::TARGET_NS

Instance Attribute Summary

Attributes included from Parsing::Logging

#log_msgs

Instance Method Summary (collapse)

Methods inherited from Parsing::Base

get_name, #initialize

Methods included from Parsing::Logging

#log_msg

Constructor Details

This class inherits a constructor from WsdlMapper::Parsing::Base

Instance Method Details

- (Object) parse(node)



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 7

def parse(node)
  name = parse_name_in_attribute 'name', node

  binding = Binding.new name
  binding.type_name = parse_name_in_attribute 'type', node

  each_element node do |child|
    parse_binding_child child, binding
  end

  @base.description.add_binding binding
end

- (Object) parse_binding_child(node, binding)



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 20

def parse_binding_child(node, binding)
  case get_name node
  when OPERATION
    parse_binding_operation node, binding
  when Soap::BINDING
    parse_soap_binding node, binding
  when DOCUMENTATION
    @base.parse_documentation node, binding
  else
    log_msg node, :unknown
  end
end

- (Object) parse_binding_operation(node, binding)



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 38

def parse_binding_operation(node, binding)
  name = parse_name_in_attribute 'name', node

  operation = Binding::Operation.new name

  each_element node do |child|
    parse_operation_child child, operation
  end

  binding.add_operation operation
end

- (Object) parse_body(node)



95
96
97
98
99
100
101
102
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 95

def parse_body(node)
  body = Binding::Body.new
  body.use = fetch_attribute_value 'use', node
  body.encoding_styles = fetch_attribute_value('encodingStyle', node, '').split ' '
  body.namespace = fetch_attribute_value 'namespace', node
  body.part_names = fetch_attribute_value('parts', node, '').split(' ').map { |s| parse_name(s, node) }
  body
end

- (Object) parse_fault_child(node, fault)



163
164
165
166
167
168
169
170
171
172
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 163

def parse_fault_child(node, fault)
  case get_name node
  when Soap::FAULT
    parse_soap_fault node, fault
  when DOCUMENTATION
    @base.parse_documentation node, fault
  else
    log_msg node, :unknown
  end
end

- (Object) parse_header(node)



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 104

def parse_header(node)
  header = Binding::Header.new
  header.use = fetch_attribute_value 'use', node
  header.message_name = parse_name_in_attribute 'message', node
  header.part_name = parse_name_in_attribute 'part', node
  header.encoding_styles = fetch_attribute_value('encodingStyle', node, '').split ' '
  header.namespace = fetch_attribute_value 'namespace', node

  each_element node do |child|
    parse_header_child child, header
  end

  header
end

- (Object) parse_header_child(node, header)



119
120
121
122
123
124
125
126
127
128
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 119

def parse_header_child(node, header)
  case get_name node
  when Soap::HEADER_FAULT
    parse_header_fault node, header
  when DOCUMENTATION
    @base.parse_documentation node, header
  else
    log_msg node, :unknown
  end
end

- (Object) parse_header_fault(node, header)



130
131
132
133
134
135
136
137
138
139
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 130

def parse_header_fault(node, header)
  header_fault = Binding::HeaderFault.new
  header_fault.use = fetch_attribute_value 'use', node
  header_fault.message_name = parse_name_in_attribute 'message', node
  header_fault.part_name = parse_name_in_attribute 'part', node
  header_fault.encoding_styles = fetch_attribute_value('encodingStyle', node, '').split ' '
  header_fault.namespace = fetch_attribute_value 'namespace', node

  header.add_header_fault header_fault
end

- (Object) parse_input_output_child(node, in_out)



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 82

def parse_input_output_child(node, in_out)
  case get_name node
  when Soap::HEADER
    in_out.add_header parse_header node
  when Soap::BODY
    in_out.body = parse_body node
  when DOCUMENTATION
    @base.parse_documentation node, in_out
  else
    log_msg node, :unknown
  end
end

- (Object) parse_operation_child(node, operation)



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 50

def parse_operation_child(node, operation)
  case get_name node
  when INPUT
    parse_operation_input node, operation
  when OUTPUT
    parse_operation_output node, operation
  when FAULT
    parse_operation_fault node, operation
  when Soap::OPERATION
    parse_operation_soap_action node, operation
  when DOCUMENTATION
    @base.parse_documentation node, operation
  else
    log_msg node, :unknown
  end
end

- (Object) parse_operation_fault(node, operation)



152
153
154
155
156
157
158
159
160
161
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 152

def parse_operation_fault(node, operation)
  name = parse_name_in_attribute 'name', node
  fault = Binding::Fault.new name

  each_element node do |child|
    parse_fault_child child, fault
  end

  operation.add_fault fault
end

- (Object) parse_operation_input(node, operation)



71
72
73
74
75
76
77
78
79
80
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 71

def parse_operation_input(node, operation)
  name = parse_name_in_attribute 'name', node
  input = Binding::InputOutput.new name

  each_element node do |child|
    parse_input_output_child child, input
  end

  operation.input = input
end

- (Object) parse_operation_output(node, operation)



141
142
143
144
145
146
147
148
149
150
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 141

def parse_operation_output(node, operation)
  name = parse_name_in_attribute 'name', node
  output = Binding::InputOutput.new name

  each_element node do |child|
    parse_input_output_child child, output
  end

  operation.output = output
end

- (Object) parse_operation_soap_action(node, operation)



67
68
69
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 67

def parse_operation_soap_action(node, operation)
  operation.soap_action = fetch_attribute_value 'soapAction', node
end

- (Object) parse_soap_binding(node, binding)



33
34
35
36
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 33

def parse_soap_binding(node, binding)
  binding.style = fetch_attribute_value 'style', node
  binding.transport = fetch_attribute_value 'transport', node
end

- (Object) parse_soap_fault(node, fault)



174
175
176
177
178
179
# File 'lib/wsdl_mapper/svc_desc_parsing/binding_parser.rb', line 174

def parse_soap_fault(node, fault)
  name = parse_name_in_attribute 'name', node
  soap_fault = Binding::SoapFault.new name
  soap_fault.use = fetch_attribute_value 'use', node
  fault.soap_fault = soap_fault
end