wasabi 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/Rakefile +2 -6
- data/lib/wasabi/document.rb +24 -2
- data/lib/wasabi/parser.rb +42 -74
- data/lib/wasabi/version.rb +1 -1
- data/lib/wasabi/xpath_helper.rb +30 -0
- data/spec/fixtures/symbolic_endpoint.xml +190 -0
- data/spec/wasabi/document_spec.rb +41 -0
- data/spec/wasabi/parser/symbolic_endpoint_spec.rb +19 -0
- metadata +22 -15
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 2.1.0 (2012-02-17)
|
2
|
+
|
3
|
+
* Improvement: The value of elementFormDefault can now be manually specified/overwritten.
|
4
|
+
|
5
|
+
* Improvement: [issue 2](https://github.com/rubiii/wasabi/issues/2) - Allow symbolic endpoints
|
6
|
+
like "http://server:port".
|
7
|
+
|
1
8
|
## 2.0.0 (2011-07-07)
|
2
9
|
|
3
10
|
* Feature: Wasabi can now parse type definitions and namespaces.
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
require
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
1
|
+
require "bundler/gem_tasks"
|
4
2
|
require "rspec/core/rake_task"
|
5
3
|
|
6
|
-
RSpec::Core::RakeTask.new
|
7
|
-
t.rspec_opts = %w(-c)
|
8
|
-
end
|
4
|
+
RSpec::Core::RakeTask.new
|
9
5
|
|
10
6
|
task :default => :spec
|
11
7
|
task :test => :spec
|
data/lib/wasabi/document.rb
CHANGED
@@ -8,6 +8,17 @@ module Wasabi
|
|
8
8
|
# Represents a WSDL document.
|
9
9
|
class Document
|
10
10
|
|
11
|
+
ELEMENT_FORM_DEFAULTS = [:unqualified, :qualified]
|
12
|
+
|
13
|
+
# Validates if a given +value+ is a valid elementFormDefault value.
|
14
|
+
# Raises an +ArgumentError+ if the value is not valid.
|
15
|
+
def self.validate_element_form_default!(value)
|
16
|
+
return if ELEMENT_FORM_DEFAULTS.include?(value)
|
17
|
+
|
18
|
+
raise ArgumentError, "Invalid value for elementFormDefault: #{value}\n" +
|
19
|
+
"Must be one of: #{ELEMENT_FORM_DEFAULTS.inspect}"
|
20
|
+
end
|
21
|
+
|
11
22
|
# Accepts a WSDL +document+ to parse.
|
12
23
|
def initialize(document = nil)
|
13
24
|
self.document = document
|
@@ -38,7 +49,13 @@ module Wasabi
|
|
38
49
|
|
39
50
|
# Returns the value of elementFormDefault.
|
40
51
|
def element_form_default
|
41
|
-
@element_form_default ||= parser.element_form_default
|
52
|
+
@element_form_default ||= xml? ? parser.element_form_default : :unqualified
|
53
|
+
end
|
54
|
+
|
55
|
+
# Sets the elementFormDefault value.
|
56
|
+
def element_form_default=(value)
|
57
|
+
self.class.validate_element_form_default!(value)
|
58
|
+
@element_form_default = value
|
42
59
|
end
|
43
60
|
|
44
61
|
# Returns a list of available SOAP actions.
|
@@ -98,6 +115,11 @@ module Wasabi
|
|
98
115
|
@xml ||= document
|
99
116
|
end
|
100
117
|
|
118
|
+
# Returns whether there is a WSDL document to parse.
|
119
|
+
def xml?
|
120
|
+
xml.kind_of?(String)
|
121
|
+
end
|
122
|
+
|
101
123
|
# Parses the WSDL document and returns the <tt>Wasabi::Parser</tt>.
|
102
124
|
def parser
|
103
125
|
@parser ||= guard_parse && parse
|
@@ -107,7 +129,7 @@ module Wasabi
|
|
107
129
|
|
108
130
|
# Raises an error if the WSDL document is missing.
|
109
131
|
def guard_parse
|
110
|
-
return true if xml
|
132
|
+
return true if xml?
|
111
133
|
raise ArgumentError, "Wasabi needs a WSDL document"
|
112
134
|
end
|
113
135
|
|
data/lib/wasabi/parser.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "uri"
|
2
|
+
require "wasabi/xpath_helper"
|
2
3
|
require "wasabi/core_ext/object"
|
3
4
|
require "wasabi/core_ext/string"
|
4
5
|
|
@@ -8,32 +9,36 @@ module Wasabi
|
|
8
9
|
#
|
9
10
|
# Parses WSDL documents and remembers their important parts.
|
10
11
|
class Parser
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
include XPathHelper
|
13
|
+
|
14
|
+
def initialize(document)
|
15
|
+
self.document = document
|
16
|
+
self.operations = {}
|
17
|
+
self.namespaces = {}
|
18
|
+
self.types = {}
|
19
|
+
self.element_form_default = :unqualified
|
18
20
|
end
|
19
21
|
|
22
|
+
# Returns the Nokogiri document.
|
23
|
+
attr_accessor :document
|
24
|
+
|
20
25
|
# Returns the target namespace.
|
21
|
-
|
26
|
+
attr_accessor :namespace
|
22
27
|
|
23
28
|
# Returns a map from namespace identifier to namespace URI.
|
24
|
-
|
29
|
+
attr_accessor :namespaces
|
25
30
|
|
26
31
|
# Returns the SOAP operations.
|
27
|
-
|
32
|
+
attr_accessor :operations
|
28
33
|
|
29
34
|
# Returns a map from a type name to a Hash with type information.
|
30
|
-
|
35
|
+
attr_accessor :types
|
31
36
|
|
32
37
|
# Returns the SOAP endpoint.
|
33
|
-
|
38
|
+
attr_accessor :endpoint
|
34
39
|
|
35
40
|
# Returns the elementFormDefault value.
|
36
|
-
|
41
|
+
attr_accessor :element_form_default
|
37
42
|
|
38
43
|
def parse
|
39
44
|
parse_namespaces
|
@@ -43,101 +48,64 @@ module Wasabi
|
|
43
48
|
end
|
44
49
|
|
45
50
|
def parse_namespaces
|
46
|
-
element_form_default =
|
47
|
-
"s0:definitions/s0:types/xs:schema/@elementFormDefault",
|
48
|
-
"s0" => "http://schemas.xmlsoap.org/wsdl/",
|
49
|
-
"xs" => "http://www.w3.org/2001/XMLSchema")
|
51
|
+
element_form_default = at_xpath("wsdl:definitions/wsdl:types/xs:schema/@elementFormDefault")
|
50
52
|
@element_form_default = element_form_default.to_s.to_sym if element_form_default
|
51
53
|
|
52
|
-
namespace =
|
53
|
-
"s0:definitions/@targetNamespace",
|
54
|
-
"s0" => "http://schemas.xmlsoap.org/wsdl/")
|
54
|
+
namespace = at_xpath("wsdl:definitions/@targetNamespace")
|
55
55
|
@namespace = namespace.to_s if namespace
|
56
56
|
|
57
|
-
@namespaces = @document.collect_namespaces.
|
58
|
-
result.merge(key.gsub(/xmlns:/,
|
59
|
-
end
|
57
|
+
@namespaces = @document.collect_namespaces.
|
58
|
+
inject({}) { |result, (key, value)| result.merge(key.gsub(/xmlns:/, "") => value) }
|
60
59
|
end
|
61
60
|
|
62
61
|
def parse_endpoint
|
63
|
-
endpoint =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
@endpoint = URI(URI.escape(endpoint.to_s)) if endpoint
|
62
|
+
endpoint = at_xpath("wsdl:definitions/wsdl:service//soap11:address/@location")
|
63
|
+
endpoint ||= at_xpath("wsdl:definitions/wsdl:service//soap12:address/@location")
|
64
|
+
|
65
|
+
begin
|
66
|
+
@endpoint = URI(URI.escape(endpoint.to_s)) if endpoint
|
67
|
+
rescue URI::InvalidURIError
|
68
|
+
@endpoint = nil
|
69
|
+
end
|
73
70
|
end
|
74
71
|
|
75
72
|
def parse_operations
|
76
|
-
operations =
|
77
|
-
"s0:definitions/s0:binding/s0:operation",
|
78
|
-
"s0" => "http://schemas.xmlsoap.org/wsdl/")
|
73
|
+
operations = xpath("wsdl:definitions/wsdl:binding/wsdl:operation")
|
79
74
|
operations.each do |operation|
|
80
75
|
name = operation.attribute("name").to_s
|
81
76
|
|
82
|
-
soap_action =
|
83
|
-
|
84
|
-
)
|
85
|
-
soap_action ||= operation.at_xpath(".//soap12:operation/@soapAction",
|
86
|
-
"soap12" => "http://schemas.xmlsoap.org/wsdl/soap12/"
|
87
|
-
)
|
77
|
+
soap_action = at_xpath(operation, ".//soap11:operation/@soapAction")
|
78
|
+
soap_action ||= at_xpath(operation, ".//soap12:operation/@soapAction")
|
88
79
|
|
89
80
|
if soap_action
|
90
81
|
soap_action = soap_action.to_s
|
91
|
-
|
92
82
|
action = soap_action.blank? ? name : soap_action
|
93
83
|
input = name.blank? ? action.split("/").last : name
|
94
|
-
|
95
|
-
@operations[input.snakecase.to_sym] =
|
96
|
-
{ :action => action, :input => input }
|
84
|
+
@operations[input.snakecase.to_sym] = { :action => action, :input => input }
|
97
85
|
elsif !@operations[name.snakecase.to_sym]
|
98
|
-
@operations[name.snakecase.to_sym] =
|
99
|
-
{ :action => name, :input => name }
|
86
|
+
@operations[name.snakecase.to_sym] = { :action => name, :input => name }
|
100
87
|
end
|
101
88
|
end
|
102
89
|
end
|
103
90
|
|
104
91
|
def parse_types
|
105
|
-
@
|
106
|
-
"
|
107
|
-
"s0" => "http://schemas.xmlsoap.org/wsdl/",
|
108
|
-
"xs" => "http://www.w3.org/2001/XMLSchema"
|
109
|
-
).each do |type|
|
110
|
-
process_type(type.at_xpath('./xs:complexType',
|
111
|
-
"xs" => "http://www.w3.org/2001/XMLSchema"
|
112
|
-
), type.attribute('name').to_s)
|
113
|
-
end
|
92
|
+
xpath("wsdl:definitions/wsdl:types/xs:schema/xs:element[@name]").
|
93
|
+
each { |type| process_type(at_xpath(type, "./xs:complexType"), type.attribute("name").to_s) }
|
114
94
|
|
115
|
-
@
|
116
|
-
"
|
117
|
-
"s0" => "http://schemas.xmlsoap.org/wsdl/",
|
118
|
-
"xs" => "http://www.w3.org/2001/XMLSchema"
|
119
|
-
).each do |type|
|
120
|
-
process_type(type, type.attribute('name').to_s)
|
121
|
-
end
|
95
|
+
xpath("wsdl:definitions/wsdl:types/xs:schema/xs:complexType[@name]").
|
96
|
+
each { |type| process_type(type, type.attribute("name").to_s) }
|
122
97
|
end
|
123
98
|
|
124
99
|
def process_type(type, name)
|
125
100
|
return unless type
|
126
101
|
@types[name] ||= { :namespace => find_namespace(type) }
|
127
102
|
|
128
|
-
|
129
|
-
"
|
130
|
-
).each do |inner_element|
|
131
|
-
@types[name][inner_element.attribute('name').to_s] = {
|
132
|
-
:type => inner_element.attribute('type').to_s
|
133
|
-
}
|
134
|
-
end
|
103
|
+
xpath(type, "./xs:sequence/xs:element").
|
104
|
+
each { |inner| @types[name][inner.attribute("name").to_s] = { :type => inner.attribute("type").to_s } }
|
135
105
|
end
|
136
106
|
|
137
107
|
def find_namespace(type)
|
138
|
-
schema_namespace =
|
139
|
-
"xs" => "http://www.w3.org/2001/XMLSchema"
|
140
|
-
)
|
108
|
+
schema_namespace = at_xpath(type, "ancestor::xs:schema/@targetNamespace")
|
141
109
|
schema_namespace ? schema_namespace.to_s : @namespace
|
142
110
|
end
|
143
111
|
|
data/lib/wasabi/version.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Wasabi
|
2
|
+
module XPathHelper
|
3
|
+
|
4
|
+
NAMESPACES = {
|
5
|
+
"xs" => "http://www.w3.org/2001/XMLSchema",
|
6
|
+
"wsdl" => "http://schemas.xmlsoap.org/wsdl/",
|
7
|
+
"soap11" => "http://schemas.xmlsoap.org/wsdl/soap/",
|
8
|
+
"soap12" => "http://schemas.xmlsoap.org/wsdl/soap12/"
|
9
|
+
}
|
10
|
+
|
11
|
+
def xpath(*args)
|
12
|
+
node, xpath = extract_xpath_args(args)
|
13
|
+
node.xpath(xpath, NAMESPACES)
|
14
|
+
end
|
15
|
+
|
16
|
+
def at_xpath(*args)
|
17
|
+
node, xpath = extract_xpath_args(args)
|
18
|
+
node.at_xpath(xpath, NAMESPACES)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def extract_xpath_args(args)
|
24
|
+
xpath, target = args.reverse
|
25
|
+
target ||= document if respond_to?(:document)
|
26
|
+
[target, xpath]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
<!--This WSDL was generated by the webservice framework generator Version 1.8.14 on 2011-08-10T13:34:02.156+0200-->
|
2
|
+
<wsdl:definitions targetNamespace="http://webservices.partner.example.de" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservices.partner.example.de" xmlns:intf="http://webservices.partner.example.de" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns2="http://model.webservices.partner.example.de" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
3
|
+
<wsdl:types>
|
4
|
+
<schema targetNamespace="http://model.webservices.partner.example.de" xmlns="http://www.w3.org/2001/XMLSchema">
|
5
|
+
<complexType name="DtTqEbUser">
|
6
|
+
<sequence>
|
7
|
+
<element name="simulate" nillable="true" type="xsd:boolean"/>
|
8
|
+
<element name="mandant" nillable="true">
|
9
|
+
<simpleType>
|
10
|
+
<restriction base="xsd:string">
|
11
|
+
<maxLength value="5"/>
|
12
|
+
</restriction>
|
13
|
+
</simpleType>
|
14
|
+
</element>
|
15
|
+
<element name="racfUser" nillable="true">
|
16
|
+
<simpleType>
|
17
|
+
<restriction base="xsd:string">
|
18
|
+
<maxLength value="8"/>
|
19
|
+
</restriction>
|
20
|
+
</simpleType>
|
21
|
+
</element>
|
22
|
+
<element name="caller" nillable="true">
|
23
|
+
<simpleType>
|
24
|
+
<restriction base="xsd:string">
|
25
|
+
<maxLength value="32"/>
|
26
|
+
</restriction>
|
27
|
+
</simpleType>
|
28
|
+
</element>
|
29
|
+
<element name="realUser" nillable="true">
|
30
|
+
<simpleType>
|
31
|
+
<restriction base="xsd:string">
|
32
|
+
<maxLength value="32"/>
|
33
|
+
</restriction>
|
34
|
+
</simpleType>
|
35
|
+
</element>
|
36
|
+
<element fixed="PA8526" name="module" type="xsd:string"/>
|
37
|
+
</sequence>
|
38
|
+
</complexType>
|
39
|
+
<complexType name="Message">
|
40
|
+
<sequence>
|
41
|
+
<element name="fehlerklasse" nillable="true">
|
42
|
+
<simpleType>
|
43
|
+
<restriction base="xsd:string">
|
44
|
+
<maxLength value="2"/>
|
45
|
+
</restriction>
|
46
|
+
</simpleType>
|
47
|
+
</element>
|
48
|
+
<element name="fehlerart" nillable="true">
|
49
|
+
<simpleType>
|
50
|
+
<restriction base="xsd:string">
|
51
|
+
<maxLength value="7"/>
|
52
|
+
</restriction>
|
53
|
+
</simpleType>
|
54
|
+
</element>
|
55
|
+
<element name="fehlermeldung" nillable="true">
|
56
|
+
<simpleType>
|
57
|
+
<restriction base="xsd:string">
|
58
|
+
<maxLength value="200"/>
|
59
|
+
</restriction>
|
60
|
+
</simpleType>
|
61
|
+
</element>
|
62
|
+
<element name="extraFehlertext" nillable="true">
|
63
|
+
<simpleType>
|
64
|
+
<restriction base="xsd:string">
|
65
|
+
<maxLength value="200"/>
|
66
|
+
</restriction>
|
67
|
+
</simpleType>
|
68
|
+
</element>
|
69
|
+
</sequence>
|
70
|
+
</complexType>
|
71
|
+
<complexType name="ArrayOfMessage">
|
72
|
+
<sequence>
|
73
|
+
<element maxOccurs="unbounded" minOccurs="0" name="message" nillable="true" type="tns2:Message"/>
|
74
|
+
</sequence>
|
75
|
+
</complexType>
|
76
|
+
<complexType name="Returnobject">
|
77
|
+
<sequence>
|
78
|
+
<element name="messages" nillable="true" type="tns2:ArrayOfMessage"/>
|
79
|
+
<element name="returncode" nillable="true">
|
80
|
+
<simpleType>
|
81
|
+
<restriction base="xsd:string">
|
82
|
+
<maxLength value="30"/>
|
83
|
+
</restriction>
|
84
|
+
</simpleType>
|
85
|
+
</element>
|
86
|
+
</sequence>
|
87
|
+
</complexType>
|
88
|
+
<complexType name="ArrayOfDtPaStBezRollenStruktur">
|
89
|
+
<sequence>
|
90
|
+
<element maxOccurs="unbounded" minOccurs="0" name="DtPaStBezRollenStrukturArray" nillable="true" type="tns2:DtPaStBezRollenStruktur"/>
|
91
|
+
</sequence>
|
92
|
+
</complexType>
|
93
|
+
<complexType name="DtPaStBezRollenStruktur">
|
94
|
+
<sequence>
|
95
|
+
<element name="paCode" nillable="true">
|
96
|
+
<simpleType>
|
97
|
+
<restriction base="xsd:int">
|
98
|
+
<xsd:minInclusive value="0000"/>
|
99
|
+
<xsd:maxExclusive value="32767"/>
|
100
|
+
</restriction>
|
101
|
+
</simpleType>
|
102
|
+
</element>
|
103
|
+
<element name="kurzbezeichnung" nillable="true">
|
104
|
+
<simpleType>
|
105
|
+
<restriction base="xsd:string">
|
106
|
+
<maxLength value="15"/>
|
107
|
+
</restriction>
|
108
|
+
</simpleType>
|
109
|
+
</element>
|
110
|
+
<element name="bezeichnung" nillable="true">
|
111
|
+
<simpleType>
|
112
|
+
<restriction base="xsd:string">
|
113
|
+
<maxLength value="60"/>
|
114
|
+
</restriction>
|
115
|
+
</simpleType>
|
116
|
+
</element>
|
117
|
+
<element name="codeInvers" nillable="true">
|
118
|
+
<simpleType>
|
119
|
+
<restriction base="xsd:int">
|
120
|
+
<xsd:minInclusive value="0000"/>
|
121
|
+
<xsd:maxExclusive value="32767"/>
|
122
|
+
</restriction>
|
123
|
+
</simpleType>
|
124
|
+
</element>
|
125
|
+
<element name="partnertypCd" nillable="true">
|
126
|
+
<simpleType>
|
127
|
+
<restriction base="xsd:int">
|
128
|
+
<xsd:minInclusive value="0000"/>
|
129
|
+
<xsd:maxExclusive value="32767"/>
|
130
|
+
</restriction>
|
131
|
+
</simpleType>
|
132
|
+
</element>
|
133
|
+
<element name="sortierfolge" nillable="true">
|
134
|
+
<simpleType>
|
135
|
+
<restriction base="xsd:int">
|
136
|
+
<xsd:minInclusive value="0000"/>
|
137
|
+
<xsd:maxExclusive value="32767"/>
|
138
|
+
</restriction>
|
139
|
+
</simpleType>
|
140
|
+
</element>
|
141
|
+
<element name="verwendbarkeit" nillable="true">
|
142
|
+
<simpleType>
|
143
|
+
<restriction base="xsd:string">
|
144
|
+
<maxLength value="1"/>
|
145
|
+
</restriction>
|
146
|
+
</simpleType>
|
147
|
+
</element>
|
148
|
+
</sequence>
|
149
|
+
</complexType>
|
150
|
+
<complexType name="ROPtsLiesListe">
|
151
|
+
<complexContent>
|
152
|
+
<extension base="tns2:Returnobject">
|
153
|
+
<sequence>
|
154
|
+
<element name="listenteil" nillable="true" type="tns2:ArrayOfDtPaStBezRollenStruktur"/>
|
155
|
+
</sequence>
|
156
|
+
</extension>
|
157
|
+
</complexContent>
|
158
|
+
</complexType>
|
159
|
+
</schema>
|
160
|
+
</wsdl:types>
|
161
|
+
<wsdl:message name="ptsLiesListeResponse">
|
162
|
+
<wsdl:part name="ROPtsLiesListe" type="tns2:ROPtsLiesListe"/>
|
163
|
+
</wsdl:message>
|
164
|
+
<wsdl:message name="ptsLiesListeRequest">
|
165
|
+
<wsdl:part name="user" type="tns2:DtTqEbUser"/>
|
166
|
+
</wsdl:message>
|
167
|
+
<wsdl:portType name="PaPtsStBezRollen">
|
168
|
+
<wsdl:operation name="ptsLiesListe" parameterOrder="user">
|
169
|
+
<wsdl:input message="intf:ptsLiesListeRequest" name="ptsLiesListeRequest"/>
|
170
|
+
<wsdl:output message="intf:ptsLiesListeResponse" name="ptsLiesListeResponse"/>
|
171
|
+
</wsdl:operation>
|
172
|
+
</wsdl:portType>
|
173
|
+
<wsdl:binding name="webservices.partner.example.deSoapBinding" type="intf:PaPtsStBezRollen">
|
174
|
+
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
175
|
+
<wsdl:operation name="ptsLiesListe">
|
176
|
+
<wsdlsoap:operation soapAction=""/>
|
177
|
+
<wsdl:input name="ptsLiesListeRequest">
|
178
|
+
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
|
179
|
+
</wsdl:input>
|
180
|
+
<wsdl:output name="ptsLiesListeResponse">
|
181
|
+
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
|
182
|
+
</wsdl:output>
|
183
|
+
</wsdl:operation>
|
184
|
+
</wsdl:binding>
|
185
|
+
<wsdl:service name="PaPtsStBezRollenService">
|
186
|
+
<wsdl:port binding="intf:webservices.partner.example.deSoapBinding" name="de.example.partner.webservices">
|
187
|
+
<wsdlsoap:address location="http://server:port/CICS/CWBA/DFHWSDSH/DQ5006"/>
|
188
|
+
</wsdl:port>
|
189
|
+
</wsdl:service>
|
190
|
+
</wsdl:definitions>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wasabi::Document do
|
4
|
+
|
5
|
+
subject { Wasabi::Document.new }
|
6
|
+
|
7
|
+
describe ".validate_element_form_default!" do
|
8
|
+
[:unqualified, :qualified].each do |value|
|
9
|
+
it "does not raise for :#{value}" do
|
10
|
+
expect { Wasabi::Document.validate_element_form_default!(value) }.to_not raise_error
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "raises if given an invalid value" do
|
15
|
+
error_msg = "Invalid value for elementFormDefault: invalid\n" +
|
16
|
+
"Must be one of: [:unqualified, :qualified]"
|
17
|
+
|
18
|
+
expect { Wasabi::Document.validate_element_form_default!(:invalid) }.
|
19
|
+
to raise_error(ArgumentError, error_msg)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#element_form_default" do
|
24
|
+
it "defaults to :unqualified" do
|
25
|
+
subject.element_form_default.should == :unqualified
|
26
|
+
end
|
27
|
+
|
28
|
+
[:unqualified, :qualified].each do |value|
|
29
|
+
it "accepts :#{value}" do
|
30
|
+
subject.element_form_default = value
|
31
|
+
subject.element_form_default.should == value
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it "raises if set to an invalid value" do
|
36
|
+
expect { subject.element_form_default = :invalid }.
|
37
|
+
to raise_error(ArgumentError, /Invalid value for elementFormDefault/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Wasabi::Parser do
|
4
|
+
context "with: symbolic_endpoint.xml" do
|
5
|
+
|
6
|
+
subject do
|
7
|
+
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
+
parser.parse
|
9
|
+
parser
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:xml) { fixture(:symbolic_endpoint) }
|
13
|
+
|
14
|
+
it "allows symbolic endpoints" do
|
15
|
+
subject.endpoint.should be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasabi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-02-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: nokogiri
|
22
21
|
prerelease: false
|
22
|
+
type: :runtime
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
@@ -31,11 +31,11 @@ dependencies:
|
|
31
31
|
- 4
|
32
32
|
- 0
|
33
33
|
version: 1.4.0
|
34
|
-
type: :runtime
|
35
34
|
version_requirements: *id001
|
35
|
+
name: nokogiri
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name: rake
|
38
37
|
prerelease: false
|
38
|
+
type: :development
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
@@ -47,11 +47,11 @@ dependencies:
|
|
47
47
|
- 8
|
48
48
|
- 7
|
49
49
|
version: 0.8.7
|
50
|
-
type: :development
|
51
50
|
version_requirements: *id002
|
51
|
+
name: rake
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
|
-
name: rspec
|
54
53
|
prerelease: false
|
54
|
+
type: :development
|
55
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
@@ -63,11 +63,11 @@ dependencies:
|
|
63
63
|
- 5
|
64
64
|
- 0
|
65
65
|
version: 2.5.0
|
66
|
-
type: :development
|
67
66
|
version_requirements: *id003
|
67
|
+
name: rspec
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name: mocha
|
70
69
|
prerelease: false
|
70
|
+
type: :development
|
71
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
@@ -79,11 +79,11 @@ dependencies:
|
|
79
79
|
- 9
|
80
80
|
- 8
|
81
81
|
version: 0.9.8
|
82
|
-
type: :development
|
83
82
|
version_requirements: *id004
|
83
|
+
name: mocha
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name: autotest
|
86
85
|
prerelease: false
|
86
|
+
type: :development
|
87
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
88
|
none: false
|
89
89
|
requirements:
|
@@ -93,8 +93,8 @@ dependencies:
|
|
93
93
|
segments:
|
94
94
|
- 0
|
95
95
|
version: "0"
|
96
|
-
type: :development
|
97
96
|
version_requirements: *id005
|
97
|
+
name: autotest
|
98
98
|
description: A simple WSDL parser
|
99
99
|
email:
|
100
100
|
- me@rubiii.com
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/wasabi/document.rb
|
120
120
|
- lib/wasabi/parser.rb
|
121
121
|
- lib/wasabi/version.rb
|
122
|
+
- lib/wasabi/xpath_helper.rb
|
122
123
|
- spec/fixtures/authentication.xml
|
123
124
|
- spec/fixtures/geotrust.xml
|
124
125
|
- spec/fixtures/lower_camel.xml
|
@@ -127,6 +128,7 @@ files:
|
|
127
128
|
- spec/fixtures/namespaced_actions.xml
|
128
129
|
- spec/fixtures/no_namespace.xml
|
129
130
|
- spec/fixtures/soap12.xml
|
131
|
+
- spec/fixtures/symbolic_endpoint.xml
|
130
132
|
- spec/fixtures/two_bindings.xml
|
131
133
|
- spec/spec_helper.rb
|
132
134
|
- spec/support/fixture.rb
|
@@ -139,9 +141,11 @@ files:
|
|
139
141
|
- spec/wasabi/document/no_namespace_spec.rb
|
140
142
|
- spec/wasabi/document/soap12_spec.rb
|
141
143
|
- spec/wasabi/document/two_bindings_spec.rb
|
144
|
+
- spec/wasabi/document_spec.rb
|
142
145
|
- spec/wasabi/parser/multiple_namespaces_spec.rb
|
143
146
|
- spec/wasabi/parser/no_namespace_spec.rb
|
144
147
|
- spec/wasabi/parser/no_target_namespace_spec.rb
|
148
|
+
- spec/wasabi/parser/symbolic_endpoint_spec.rb
|
145
149
|
- spec/wasabi/wasabi_spec.rb
|
146
150
|
- wasabi.gemspec
|
147
151
|
homepage: https://github.com/rubiii/wasabi
|
@@ -173,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
177
|
requirements: []
|
174
178
|
|
175
179
|
rubyforge_project: wasabi
|
176
|
-
rubygems_version: 1.8.
|
180
|
+
rubygems_version: 1.8.10
|
177
181
|
signing_key:
|
178
182
|
specification_version: 3
|
179
183
|
summary: A simple WSDL parser
|
@@ -186,6 +190,7 @@ test_files:
|
|
186
190
|
- spec/fixtures/namespaced_actions.xml
|
187
191
|
- spec/fixtures/no_namespace.xml
|
188
192
|
- spec/fixtures/soap12.xml
|
193
|
+
- spec/fixtures/symbolic_endpoint.xml
|
189
194
|
- spec/fixtures/two_bindings.xml
|
190
195
|
- spec/spec_helper.rb
|
191
196
|
- spec/support/fixture.rb
|
@@ -198,7 +203,9 @@ test_files:
|
|
198
203
|
- spec/wasabi/document/no_namespace_spec.rb
|
199
204
|
- spec/wasabi/document/soap12_spec.rb
|
200
205
|
- spec/wasabi/document/two_bindings_spec.rb
|
206
|
+
- spec/wasabi/document_spec.rb
|
201
207
|
- spec/wasabi/parser/multiple_namespaces_spec.rb
|
202
208
|
- spec/wasabi/parser/no_namespace_spec.rb
|
203
209
|
- spec/wasabi/parser/no_target_namespace_spec.rb
|
210
|
+
- spec/wasabi/parser/symbolic_endpoint_spec.rb
|
204
211
|
- spec/wasabi/wasabi_spec.rb
|