wsdl_validator 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wsdl_validator/version.rb +1 -1
- data/lib/wsdl_validator/wsdl_validator.rb +22 -6
- data/wsdl_validator.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2ec12d204a349daf90dc9839b67b986079dd304
|
4
|
+
data.tar.gz: 2aa63bbe06189c30fe0edcf05ffa87cb2ae27b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdad29cc37bf6f4b7d90f2a76a56df60be4b786678aec21374df1bbf1ccf258dc5dbd9b13a2fae62d085f28687645db05c8fd14f0b003110283b7085566f2b6d
|
7
|
+
data.tar.gz: 4733883570c6f93f93d730fbd755d13467acfe7b74c498e81153b0e2e4784eb939c0b8dab12a7a675b750a71ef5d035ad4beae2ec14563bb42c3fc47ecc87250
|
@@ -17,9 +17,12 @@ class WsdlValidator
|
|
17
17
|
self.doc = Wasabi.document wsdl_url
|
18
18
|
self.show_schemas = parse_wsdl_schemas
|
19
19
|
self.schemas = Nokogiri::XML::Schema(show_schemas)
|
20
|
-
rescue Wasabi::Resolver::HTTPError =>
|
21
|
-
raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if
|
22
|
-
raise
|
20
|
+
rescue Wasabi::Resolver::HTTPError => resolver
|
21
|
+
raise WsdlValidator::Error, "Unauthorized for basic auth #{basic_auth}" if resolver.response.code == 401
|
22
|
+
raise resolver
|
23
|
+
rescue Nokogiri::XML::SyntaxError => syntax_error
|
24
|
+
puts "Error for " + show_schemas
|
25
|
+
raise syntax_error
|
23
26
|
end
|
24
27
|
|
25
28
|
# Gets the namespaces from the SOAP Envelope & Body element, adds them to the root element underneath the body
|
@@ -70,18 +73,31 @@ class WsdlValidator
|
|
70
73
|
end
|
71
74
|
|
72
75
|
# Join all the schemas within the WSDL, importing schemas if necessary
|
73
|
-
# @return [String]
|
76
|
+
# @return [String] Schema XML contained within WSDL
|
74
77
|
def parse_wsdl_schemas
|
75
78
|
doc.parser.schemas.collect do |schema|
|
76
79
|
imports = schema.children.select { |child| child.name == 'import' }
|
77
80
|
imported_xsds = imports.collect do |import|
|
78
81
|
extract_schema_for(import)
|
79
82
|
end.join
|
80
|
-
|
81
|
-
|
83
|
+
if imported_xsds.empty?
|
84
|
+
add_global_namespace_to(schema)
|
85
|
+
else
|
86
|
+
imported_schemas = Nokogiri::XML(imported_xsds).children
|
87
|
+
updated_set = imported_schemas.collect { |imported_schema| add_global_namespace_to(imported_schema) }
|
88
|
+
updated_set.join
|
89
|
+
end.to_s
|
82
90
|
end.join
|
83
91
|
end
|
84
92
|
|
93
|
+
# Add namespaces from wsdl document to each schema
|
94
|
+
# Sometimes schemas are defined there and referenced within the types
|
95
|
+
# @return [String] String representing XML with global schemas added
|
96
|
+
def add_global_namespace_to(schema)
|
97
|
+
doc.parser.document.collect_namespaces.each { |namespace, value| schema[namespace] = value }
|
98
|
+
schema.to_s
|
99
|
+
end
|
100
|
+
|
85
101
|
# Makes a GET request returning the xsd from the defined location
|
86
102
|
# @return [String] Schema from location defined in 'schemaLocation' attribute
|
87
103
|
def extract_schema_for(import)
|
data/wsdl_validator.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
spec.add_development_dependency 'savon'
|
32
33
|
spec.add_development_dependency 'simplecov'
|
33
34
|
spec.add_development_dependency 'sinatra'
|
34
35
|
spec.add_development_dependency 'sinatra-basic-auth'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wsdl_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpi
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: savon
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|