Class: WsdlMapper::SvcDescParsing::PortTypeParser

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

Constant Summary

Constant Summary

Constants inherited from ParserBase

WsdlMapper::SvcDescParsing::ParserBase::Soap, WsdlMapper::SvcDescParsing::ParserBase::SoapEnc, WsdlMapper::SvcDescParsing::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) determine_type(sequence)



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 45

def determine_type(sequence)
  case sequence[0, 2]
  when [INPUT]
    :one_way
  when [INPUT, OUTPUT]
    :request_response
  when [OUTPUT, INPUT]
    :solicit_response
  when [OUTPUT]
    :notification
  end
end

- (Object) parse(node)



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

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

  port_type = PortType.new name

  each_element node do |child|
    parse_port_type_child child, port_type
  end

  @base.description.add_port_type port_type
end

- (Object) parse_operation(node, port_type)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 30

def parse_operation(node, port_type)
  name = parse_name_in_attribute 'name', node

  operation = PortType::Operation.new name

  sequence = []
  each_element node do |child|
    sequence << parse_operation_child(child, operation)
  end
  sequence.compact!
  operation.type = determine_type sequence

  port_type.add_operation operation
end

- (Object) parse_operation_child(node, operation)



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 58

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

- (Object) parse_operation_fault(node, operation)



93
94
95
96
97
98
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 93

def parse_operation_fault(node, operation)
  name = parse_name_in_attribute 'name', node
  fault = PortType::InputOutput.new name
  fault.message_name = parse_name_in_attribute 'message', node
  operation.add_fault fault
end

- (Object) parse_operation_input(node, operation)



79
80
81
82
83
84
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 79

def parse_operation_input(node, operation)
  name = parse_name_in_attribute 'name', node
  input = PortType::InputOutput.new name
  input.message_name = parse_name_in_attribute 'message', node
  operation.input = input
end

- (Object) parse_operation_output(node, operation)



86
87
88
89
90
91
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 86

def parse_operation_output(node, operation)
  name = parse_name_in_attribute 'name', node
  output = PortType::InputOutput.new name
  output.message_name = parse_name_in_attribute 'message', node
  operation.output = output
end

- (Object) parse_port_type_child(node, port_type)



19
20
21
22
23
24
25
26
27
28
# File 'lib/wsdl_mapper/svc_desc_parsing/port_type_parser.rb', line 19

def parse_port_type_child(node, port_type)
  case get_name(node)
  when OPERATION
    parse_operation node, port_type
  when DOCUMENTATION
    @base.parse_documentation node, operation
  else
    log_msg node, :unknown
  end
end