soaspec 0.2.33 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +15 -15
- data/.gitlab-ci.yml +62 -62
- data/.rspec +3 -3
- data/.rubocop.yml +2 -2
- data/CODE_OF_CONDUCT.md +74 -74
- data/ChangeLog +643 -632
- data/Dockerfile +7 -7
- data/Gemfile +8 -8
- data/LICENSE.txt +21 -21
- data/README.md +253 -231
- data/Rakefile +52 -52
- data/Todo.md +16 -16
- data/exe/soaspec +140 -138
- data/exe/xml_to_yaml_file +43 -43
- data/lib/soaspec.rb +118 -106
- data/lib/soaspec/baseline.rb +82 -22
- data/lib/soaspec/core_ext/hash.rb +44 -44
- data/lib/soaspec/cucumber/generic_steps.rb +94 -94
- data/lib/soaspec/demo.rb +6 -6
- data/lib/soaspec/errors.rb +24 -24
- data/lib/soaspec/exchange/exchange.rb +131 -129
- data/lib/soaspec/exchange/exchange_extractor.rb +105 -90
- data/lib/soaspec/exchange/exchange_properties.rb +28 -28
- data/lib/soaspec/exchange/exchange_repeater.rb +21 -21
- data/lib/soaspec/exchange/request_builder.rb +108 -70
- data/lib/soaspec/exchange/variable_storer.rb +24 -24
- data/lib/soaspec/exchange_handlers/exchange_handler.rb +98 -98
- data/lib/soaspec/exchange_handlers/exchange_handler_defaults.rb +61 -61
- data/lib/soaspec/exchange_handlers/handler_accessors.rb +132 -132
- data/lib/soaspec/exchange_handlers/request/rest_request.rb +77 -59
- data/lib/soaspec/exchange_handlers/request/soap_request.rb +41 -41
- data/lib/soaspec/exchange_handlers/response_extractor.rb +84 -84
- data/lib/soaspec/exchange_handlers/rest_exchanger_factory.rb +111 -111
- data/lib/soaspec/exchange_handlers/rest_handler.rb +307 -307
- data/lib/soaspec/exchange_handlers/rest_methods.rb +65 -65
- data/lib/soaspec/exchange_handlers/rest_parameters.rb +112 -112
- data/lib/soaspec/exchange_handlers/rest_parameters_defaults.rb +42 -42
- data/lib/soaspec/exchange_handlers/soap_handler.rb +241 -241
- data/lib/soaspec/exe_helpers.rb +94 -94
- data/lib/soaspec/generate_server.rb +48 -48
- data/lib/soaspec/generator/.rspec.erb +5 -5
- data/lib/soaspec/generator/.travis.yml.erb +5 -5
- data/lib/soaspec/generator/Gemfile.erb +8 -8
- data/lib/soaspec/generator/README.md.erb +29 -29
- data/lib/soaspec/generator/Rakefile.erb +20 -19
- data/lib/soaspec/generator/config/data/default.yml.erb +2 -2
- data/lib/soaspec/generator/css/bootstrap.css +6833 -6833
- data/lib/soaspec/generator/features/support/env.rb.erb +3 -3
- data/lib/soaspec/generator/generate_exchange.html.erb +47 -47
- data/lib/soaspec/generator/lib/blz_service.rb.erb +26 -26
- data/lib/soaspec/generator/lib/dynamic_class_content.rb.erb +12 -12
- data/lib/soaspec/generator/lib/new_rest_service.rb.erb +56 -56
- data/lib/soaspec/generator/lib/new_soap_service.rb.erb +29 -29
- data/lib/soaspec/generator/lib/package_service.rb.erb +2 -2
- data/lib/soaspec/generator/lib/shared_example.rb.erb +8 -8
- data/lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb +12 -12
- data/lib/soaspec/generator/spec/rest_spec.rb.erb +9 -9
- data/lib/soaspec/generator/spec/soap_spec.rb.erb +51 -51
- data/lib/soaspec/generator/spec/spec_helper.rb.erb +23 -23
- data/lib/soaspec/generator/template/soap_template.xml +6 -6
- data/lib/soaspec/indifferent_hash.rb +9 -9
- data/lib/soaspec/interpreter.rb +70 -70
- data/lib/soaspec/matchers.rb +136 -140
- data/lib/soaspec/o_auth2.rb +142 -142
- data/lib/soaspec/soaspec_shared_examples.rb +26 -26
- data/lib/soaspec/spec_logger.rb +143 -143
- data/lib/soaspec/template_reader.rb +30 -30
- data/lib/soaspec/test_server/bank.wsdl +90 -90
- data/lib/soaspec/test_server/get_bank.rb +166 -166
- data/lib/soaspec/test_server/id_manager.rb +41 -41
- data/lib/soaspec/test_server/invoices.rb +29 -29
- data/lib/soaspec/test_server/namespace.xml +14 -14
- data/lib/soaspec/test_server/note.xml +5 -5
- data/lib/soaspec/test_server/puppy_service.rb +21 -21
- data/lib/soaspec/test_server/test_attribute.rb +14 -14
- data/lib/soaspec/test_server/test_namespace.rb +14 -14
- data/lib/soaspec/version.rb +6 -6
- data/lib/soaspec/virtual_server.rb +193 -190
- data/lib/soaspec/wait.rb +43 -43
- data/lib/soaspec/wsdl_generator.rb +215 -215
- data/soaspec.gemspec +58 -58
- data/test.wsdl +116 -116
- data/test.xml +10 -10
- data/test_wsdl.rb +43 -43
- metadata +3 -3
@@ -1,30 +1,30 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'erb'
|
4
|
-
|
5
|
-
module Soaspec
|
6
|
-
# Handles reading templates for tests
|
7
|
-
class TemplateReader
|
8
|
-
# Name of file where template is stored
|
9
|
-
attr_accessor :template_name
|
10
|
-
|
11
|
-
# @return [String] Path to where template file is stored
|
12
|
-
def file_location
|
13
|
-
File.join(*Soaspec.template_folder, template_name)
|
14
|
-
end
|
15
|
-
|
16
|
-
# @param [String] template_name File where template is stored
|
17
|
-
# @return [String] Body of template after determining test_values
|
18
|
-
def render_body(template_name, binding)
|
19
|
-
self.template_name = template_name
|
20
|
-
unless File.exist? file_location
|
21
|
-
raise "Cannot see file at #{file_location}. "\
|
22
|
-
"Global folder is '#{Soaspec.template_folder}' and filename is '#{template_name}'"
|
23
|
-
end
|
24
|
-
request_body = File.read file_location
|
25
|
-
raise "Template at #{file_location} not parsed correctly" if request_body.strip.empty?
|
26
|
-
|
27
|
-
ERB.new(request_body).result(binding)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
module Soaspec
|
6
|
+
# Handles reading templates for tests
|
7
|
+
class TemplateReader
|
8
|
+
# Name of file where template is stored
|
9
|
+
attr_accessor :template_name
|
10
|
+
|
11
|
+
# @return [String] Path to where template file is stored
|
12
|
+
def file_location
|
13
|
+
File.join(*Soaspec.template_folder, template_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param [String] template_name File where template is stored
|
17
|
+
# @return [String] Body of template after determining test_values
|
18
|
+
def render_body(template_name, binding)
|
19
|
+
self.template_name = template_name
|
20
|
+
unless File.exist? file_location
|
21
|
+
raise "Cannot see file at #{file_location}. "\
|
22
|
+
"Global folder is '#{Soaspec.template_folder}' and filename is '#{template_name}'"
|
23
|
+
end
|
24
|
+
request_body = File.read file_location
|
25
|
+
raise "Template at #{file_location} not parsed correctly" if request_body.strip.empty?
|
26
|
+
|
27
|
+
ERB.new(request_body).result(binding)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,91 +1,91 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://thomas-bayer.com/blz/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://thomas-bayer.com/blz/">
|
3
|
-
<wsdl:documentation>BLZService</wsdl:documentation>
|
4
|
-
<wsdl:types>
|
5
|
-
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://thomas-bayer.com/blz/">
|
6
|
-
<xsd:element name="getBank" type="tns:getBankType"/>
|
7
|
-
<xsd:element name="getBankResponse" type="tns:getBankResponseType"/>
|
8
|
-
<xsd:complexType name="getBankType">
|
9
|
-
<xsd:sequence>
|
10
|
-
<xsd:element name="blz" type="xsd:string"/>
|
11
|
-
</xsd:sequence>
|
12
|
-
</xsd:complexType>
|
13
|
-
<xsd:complexType name="getBankResponseType">
|
14
|
-
<xsd:sequence>
|
15
|
-
<xsd:element name="details" type="tns:detailsType"/>
|
16
|
-
</xsd:sequence>
|
17
|
-
</xsd:complexType>
|
18
|
-
<xsd:complexType name="detailsType">
|
19
|
-
<xsd:sequence>
|
20
|
-
<xsd:element minOccurs="0" name="bezeichnung" type="xsd:string"/>
|
21
|
-
<xsd:element minOccurs="0" name="bic" type="xsd:string"/>
|
22
|
-
<xsd:element maxOccurs="unbounded" minOccurs="0" name="ort" type="xsd:string"/>
|
23
|
-
<xsd:element minOccurs="0" name="plz" type="xsd:string"/>
|
24
|
-
</xsd:sequence>
|
25
|
-
</xsd:complexType>
|
26
|
-
</xsd:schema>
|
27
|
-
</wsdl:types>
|
28
|
-
<wsdl:message name="getBank">
|
29
|
-
<wsdl:part name="parameters" element="tns:getBank"/>
|
30
|
-
</wsdl:message>
|
31
|
-
<wsdl:message name="getBankResponse">
|
32
|
-
<wsdl:part name="parameters" element="tns:getBankResponse"/>
|
33
|
-
</wsdl:message>
|
34
|
-
<wsdl:portType name="BLZServicePortType">
|
35
|
-
<wsdl:operation name="getBank">
|
36
|
-
<wsdl:input message="tns:getBank"/>
|
37
|
-
<!--<wsdl:output message="tns:getBankResponse" wsaw:Action="http://thomas-bayer.com/blz/BLZService/getBankResponse"/>-->
|
38
|
-
<wsdl:output message="tns:getBankResponse" wsaw:Action="http://localhost:4567/BLZService/getBankResponse"/>
|
39
|
-
</wsdl:operation>
|
40
|
-
</wsdl:portType>
|
41
|
-
<wsdl:binding name="BLZServiceSOAP11Binding" type="tns:BLZServicePortType">
|
42
|
-
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
43
|
-
<wsdl:operation name="getBank">
|
44
|
-
<soap:operation style="document" soapAction=""/>
|
45
|
-
<wsdl:input>
|
46
|
-
<soap:body use="literal"/>
|
47
|
-
</wsdl:input>
|
48
|
-
<wsdl:output>
|
49
|
-
<soap:body use="literal"/>
|
50
|
-
</wsdl:output>
|
51
|
-
</wsdl:operation>
|
52
|
-
</wsdl:binding>
|
53
|
-
<wsdl:binding name="BLZServiceSOAP12Binding" type="tns:BLZServicePortType">
|
54
|
-
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
55
|
-
<wsdl:operation name="getBank">
|
56
|
-
<soap12:operation style="document" soapAction=""/>
|
57
|
-
<wsdl:input>
|
58
|
-
<soap12:body use="literal"/>
|
59
|
-
</wsdl:input>
|
60
|
-
<wsdl:output>
|
61
|
-
<soap12:body use="literal"/>
|
62
|
-
</wsdl:output>
|
63
|
-
</wsdl:operation>
|
64
|
-
</wsdl:binding>
|
65
|
-
<wsdl:binding name="BLZServiceHttpBinding" type="tns:BLZServicePortType">
|
66
|
-
<http:binding verb="POST"/>
|
67
|
-
<wsdl:operation name="getBank">
|
68
|
-
<http:operation location="BLZService/getBank"/>
|
69
|
-
<wsdl:input>
|
70
|
-
<mime:content part="getBank" type="text/xml"/>
|
71
|
-
</wsdl:input>
|
72
|
-
<wsdl:output>
|
73
|
-
<mime:content part="getBank" type="text/xml"/>
|
74
|
-
</wsdl:output>
|
75
|
-
</wsdl:operation>
|
76
|
-
</wsdl:binding>
|
77
|
-
<wsdl:service name="BLZService">
|
78
|
-
<wsdl:port name="BLZServiceSOAP11port_http" binding="tns:BLZServiceSOAP11Binding">
|
79
|
-
<!-- <soap:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/> -->
|
80
|
-
<soap:address location="http://localhost:4999/BLZService"/>
|
81
|
-
</wsdl:port>
|
82
|
-
<wsdl:port name="BLZServiceSOAP12port_http" binding="tns:BLZServiceSOAP12Binding">
|
83
|
-
<!--<soap12:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/>-->
|
84
|
-
<soap12:address location="http://localhost:4999/BLZService"/>
|
85
|
-
</wsdl:port>
|
86
|
-
<wsdl:port name="BLZServiceHttpport" binding="tns:BLZServiceHttpBinding">
|
87
|
-
<!--<http:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/>-->
|
88
|
-
<soap:address location="http://localhost:4999/BLZService"/>
|
89
|
-
</wsdl:port>
|
90
|
-
</wsdl:service>
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://thomas-bayer.com/blz/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://thomas-bayer.com/blz/">
|
3
|
+
<wsdl:documentation>BLZService</wsdl:documentation>
|
4
|
+
<wsdl:types>
|
5
|
+
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://thomas-bayer.com/blz/">
|
6
|
+
<xsd:element name="getBank" type="tns:getBankType"/>
|
7
|
+
<xsd:element name="getBankResponse" type="tns:getBankResponseType"/>
|
8
|
+
<xsd:complexType name="getBankType">
|
9
|
+
<xsd:sequence>
|
10
|
+
<xsd:element name="blz" type="xsd:string"/>
|
11
|
+
</xsd:sequence>
|
12
|
+
</xsd:complexType>
|
13
|
+
<xsd:complexType name="getBankResponseType">
|
14
|
+
<xsd:sequence>
|
15
|
+
<xsd:element name="details" type="tns:detailsType"/>
|
16
|
+
</xsd:sequence>
|
17
|
+
</xsd:complexType>
|
18
|
+
<xsd:complexType name="detailsType">
|
19
|
+
<xsd:sequence>
|
20
|
+
<xsd:element minOccurs="0" name="bezeichnung" type="xsd:string"/>
|
21
|
+
<xsd:element minOccurs="0" name="bic" type="xsd:string"/>
|
22
|
+
<xsd:element maxOccurs="unbounded" minOccurs="0" name="ort" type="xsd:string"/>
|
23
|
+
<xsd:element minOccurs="0" name="plz" type="xsd:string"/>
|
24
|
+
</xsd:sequence>
|
25
|
+
</xsd:complexType>
|
26
|
+
</xsd:schema>
|
27
|
+
</wsdl:types>
|
28
|
+
<wsdl:message name="getBank">
|
29
|
+
<wsdl:part name="parameters" element="tns:getBank"/>
|
30
|
+
</wsdl:message>
|
31
|
+
<wsdl:message name="getBankResponse">
|
32
|
+
<wsdl:part name="parameters" element="tns:getBankResponse"/>
|
33
|
+
</wsdl:message>
|
34
|
+
<wsdl:portType name="BLZServicePortType">
|
35
|
+
<wsdl:operation name="getBank">
|
36
|
+
<wsdl:input message="tns:getBank"/>
|
37
|
+
<!--<wsdl:output message="tns:getBankResponse" wsaw:Action="http://thomas-bayer.com/blz/BLZService/getBankResponse"/>-->
|
38
|
+
<wsdl:output message="tns:getBankResponse" wsaw:Action="http://localhost:4567/BLZService/getBankResponse"/>
|
39
|
+
</wsdl:operation>
|
40
|
+
</wsdl:portType>
|
41
|
+
<wsdl:binding name="BLZServiceSOAP11Binding" type="tns:BLZServicePortType">
|
42
|
+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
43
|
+
<wsdl:operation name="getBank">
|
44
|
+
<soap:operation style="document" soapAction=""/>
|
45
|
+
<wsdl:input>
|
46
|
+
<soap:body use="literal"/>
|
47
|
+
</wsdl:input>
|
48
|
+
<wsdl:output>
|
49
|
+
<soap:body use="literal"/>
|
50
|
+
</wsdl:output>
|
51
|
+
</wsdl:operation>
|
52
|
+
</wsdl:binding>
|
53
|
+
<wsdl:binding name="BLZServiceSOAP12Binding" type="tns:BLZServicePortType">
|
54
|
+
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
55
|
+
<wsdl:operation name="getBank">
|
56
|
+
<soap12:operation style="document" soapAction=""/>
|
57
|
+
<wsdl:input>
|
58
|
+
<soap12:body use="literal"/>
|
59
|
+
</wsdl:input>
|
60
|
+
<wsdl:output>
|
61
|
+
<soap12:body use="literal"/>
|
62
|
+
</wsdl:output>
|
63
|
+
</wsdl:operation>
|
64
|
+
</wsdl:binding>
|
65
|
+
<wsdl:binding name="BLZServiceHttpBinding" type="tns:BLZServicePortType">
|
66
|
+
<http:binding verb="POST"/>
|
67
|
+
<wsdl:operation name="getBank">
|
68
|
+
<http:operation location="BLZService/getBank"/>
|
69
|
+
<wsdl:input>
|
70
|
+
<mime:content part="getBank" type="text/xml"/>
|
71
|
+
</wsdl:input>
|
72
|
+
<wsdl:output>
|
73
|
+
<mime:content part="getBank" type="text/xml"/>
|
74
|
+
</wsdl:output>
|
75
|
+
</wsdl:operation>
|
76
|
+
</wsdl:binding>
|
77
|
+
<wsdl:service name="BLZService">
|
78
|
+
<wsdl:port name="BLZServiceSOAP11port_http" binding="tns:BLZServiceSOAP11Binding">
|
79
|
+
<!-- <soap:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/> -->
|
80
|
+
<soap:address location="http://localhost:4999/BLZService"/>
|
81
|
+
</wsdl:port>
|
82
|
+
<wsdl:port name="BLZServiceSOAP12port_http" binding="tns:BLZServiceSOAP12Binding">
|
83
|
+
<!--<soap12:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/>-->
|
84
|
+
<soap12:address location="http://localhost:4999/BLZService"/>
|
85
|
+
</wsdl:port>
|
86
|
+
<wsdl:port name="BLZServiceHttpport" binding="tns:BLZServiceHttpBinding">
|
87
|
+
<!--<http:address location="http://www.thomas-bayer.com/axis2/services/BLZService"/>-->
|
88
|
+
<soap:address location="http://localhost:4999/BLZService"/>
|
89
|
+
</wsdl:port>
|
90
|
+
</wsdl:service>
|
91
91
|
</wsdl:definitions>
|
@@ -1,166 +1,166 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'erb'
|
4
|
-
|
5
|
-
module Soaspec
|
6
|
-
module TestServer
|
7
|
-
# Representing a GetBank SOAP service
|
8
|
-
class GetBank
|
9
|
-
class << self
|
10
|
-
# This is retrieved by Savon
|
11
|
-
# @return [String] WSDL of mock web service
|
12
|
-
def test_wsdl
|
13
|
-
ERB.new(File.read(File.join(File.dirname(__FILE__), 'bank.wsdl'))).result(binding)
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return [String] XML of success SOAP Response
|
17
|
-
def success_response_template
|
18
|
-
<<-EOF
|
19
|
-
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
20
|
-
<soapenv:Body>
|
21
|
-
<ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
|
22
|
-
<ns1:details unique_id="50">
|
23
|
-
<ns1:bezeichnung lang="German"><%= @title %></ns1:bezeichnung>
|
24
|
-
<ns1:bic>DEUTDEMMXXX <%= soap_action %></ns1:bic>
|
25
|
-
<ns1:ort>München</ns1:ort>
|
26
|
-
<% if @multiple_ort %>
|
27
|
-
<ns1:ort>Wellington</ns1:ort>
|
28
|
-
<ns1:ort>Tokyo</ns1:ort>
|
29
|
-
<% end %>
|
30
|
-
<ns1:plz><%= @bank_name %></ns1:plz>
|
31
|
-
</ns1:details>
|
32
|
-
</ns1:getBankResponse>
|
33
|
-
</soapenv:Body>
|
34
|
-
</soapenv:Envelope>
|
35
|
-
EOF
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return [String] XML of failure SOAP Response simulating bank not found
|
39
|
-
def bank_not_found
|
40
|
-
<<-EOF
|
41
|
-
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
42
|
-
<soapenv:Body>
|
43
|
-
<soapenv:Fault>
|
44
|
-
<soapenv:Code>
|
45
|
-
<soapenv:Value>soapenv:Receiver</soapenv:Value>
|
46
|
-
</soapenv:Code>
|
47
|
-
<soapenv:Reason>
|
48
|
-
<soapenv:Text xml:lang="en-US">Keine Bank zur BLZ <%= @bank_name %> gefunden!</soapenv:Text>
|
49
|
-
</soapenv:Reason>
|
50
|
-
<soapenv:Detail>
|
51
|
-
<Exception>org.apache.axis2.AxisFault: Keine Bank zur BLZ test string gefunden!
|
52
|
-
at com.thomas_bayer.blz.BLZService.getBank(BLZService.java:41)
|
53
|
-
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:49)
|
54
|
-
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
|
55
|
-
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
|
56
|
-
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
|
57
|
-
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
|
58
|
-
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
|
59
|
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
|
60
|
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
|
61
|
-
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
|
62
|
-
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
|
63
|
-
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
|
64
|
-
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
|
65
|
-
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
|
66
|
-
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
|
67
|
-
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
|
68
|
-
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
|
69
|
-
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
|
70
|
-
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
|
71
|
-
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
|
72
|
-
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
|
73
|
-
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
|
74
|
-
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
|
75
|
-
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
|
76
|
-
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
|
77
|
-
at java.lang.Thread.run(Thread.java:745)
|
78
|
-
</Exception>
|
79
|
-
</soapenv:Detail>
|
80
|
-
</soapenv:Fault>
|
81
|
-
</soapenv:Body>
|
82
|
-
</soapenv:Envelope>
|
83
|
-
EOF
|
84
|
-
end
|
85
|
-
|
86
|
-
def error_response_template
|
87
|
-
<<-EOF
|
88
|
-
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
89
|
-
<soapenv:Body>
|
90
|
-
<soapenv:Fault>
|
91
|
-
<soapenv:Code>
|
92
|
-
<soapenv:Value>soapenv:Receiver</soapenv:Value>
|
93
|
-
</soapenv:Code>
|
94
|
-
<soapenv:Reason>
|
95
|
-
<soapenv:Text xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected subelement getBank</soapenv:Text>
|
96
|
-
</soapenv:Reason>
|
97
|
-
<soapenv:Detail>
|
98
|
-
<Exception>org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
99
|
-
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
|
100
|
-
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:124)
|
101
|
-
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:43)
|
102
|
-
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
|
103
|
-
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
|
104
|
-
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
|
105
|
-
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
|
106
|
-
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
|
107
|
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
|
108
|
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
|
109
|
-
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
|
110
|
-
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
|
111
|
-
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
|
112
|
-
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
|
113
|
-
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
|
114
|
-
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
|
115
|
-
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
|
116
|
-
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
|
117
|
-
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
|
118
|
-
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
|
119
|
-
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
|
120
|
-
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
|
121
|
-
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
|
122
|
-
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
|
123
|
-
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
|
124
|
-
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
|
125
|
-
at java.lang.Thread.run(Thread.java:745)
|
126
|
-
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
127
|
-
at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:423)
|
128
|
-
at com.thomas_bayer.adb.GetBank$Factory.parse(GetBank.java:304)
|
129
|
-
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:117)
|
130
|
-
... 25 more
|
131
|
-
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
132
|
-
at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:410)
|
133
|
-
... 27 more
|
134
|
-
</Exception>
|
135
|
-
</soapenv:Detail>
|
136
|
-
</soapenv:Fault>
|
137
|
-
</soapenv:Body>
|
138
|
-
</soapenv:Envelope>
|
139
|
-
EOF
|
140
|
-
end
|
141
|
-
|
142
|
-
# Return a response based upon the SOAP request
|
143
|
-
# @param [String] request XML in request
|
144
|
-
def response_for(request)
|
145
|
-
@title = 'Deutsche Bank'
|
146
|
-
soap_action = request.env['HTTP_SOAPACTION']
|
147
|
-
return 500, 'Not valid SOAP' unless soap_action
|
148
|
-
|
149
|
-
request_body = request.body
|
150
|
-
doc = Nokogiri::XML(request_body)
|
151
|
-
soap_action = soap_action.strip # Used in ERB
|
152
|
-
blz_element = doc.at_xpath('//tns:blz')
|
153
|
-
return 500, error_response_template unless blz_element
|
154
|
-
|
155
|
-
@bank_name = blz_element.inner_text
|
156
|
-
@bank_id = @bank_name.to_i
|
157
|
-
return 500, ERB.new(bank_not_found).result(binding) if @bank_id.zero?
|
158
|
-
|
159
|
-
@title = 'DAB Bank' if @bank_id == 500
|
160
|
-
@multiple_ort = (@bank_id == 20)
|
161
|
-
ERB.new(success_response_template).result(binding)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
module Soaspec
|
6
|
+
module TestServer
|
7
|
+
# Representing a GetBank SOAP service
|
8
|
+
class GetBank
|
9
|
+
class << self
|
10
|
+
# This is retrieved by Savon
|
11
|
+
# @return [String] WSDL of mock web service
|
12
|
+
def test_wsdl
|
13
|
+
ERB.new(File.read(File.join(File.dirname(__FILE__), 'bank.wsdl'))).result(binding)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String] XML of success SOAP Response
|
17
|
+
def success_response_template
|
18
|
+
<<-EOF
|
19
|
+
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
20
|
+
<soapenv:Body>
|
21
|
+
<ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
|
22
|
+
<ns1:details unique_id="50">
|
23
|
+
<ns1:bezeichnung lang="German"><%= @title %></ns1:bezeichnung>
|
24
|
+
<ns1:bic>DEUTDEMMXXX <%= soap_action %></ns1:bic>
|
25
|
+
<ns1:ort>München</ns1:ort>
|
26
|
+
<% if @multiple_ort %>
|
27
|
+
<ns1:ort>Wellington</ns1:ort>
|
28
|
+
<ns1:ort>Tokyo</ns1:ort>
|
29
|
+
<% end %>
|
30
|
+
<ns1:plz><%= @bank_name %></ns1:plz>
|
31
|
+
</ns1:details>
|
32
|
+
</ns1:getBankResponse>
|
33
|
+
</soapenv:Body>
|
34
|
+
</soapenv:Envelope>
|
35
|
+
EOF
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String] XML of failure SOAP Response simulating bank not found
|
39
|
+
def bank_not_found
|
40
|
+
<<-EOF
|
41
|
+
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
42
|
+
<soapenv:Body>
|
43
|
+
<soapenv:Fault>
|
44
|
+
<soapenv:Code>
|
45
|
+
<soapenv:Value>soapenv:Receiver</soapenv:Value>
|
46
|
+
</soapenv:Code>
|
47
|
+
<soapenv:Reason>
|
48
|
+
<soapenv:Text xml:lang="en-US">Keine Bank zur BLZ <%= @bank_name %> gefunden!</soapenv:Text>
|
49
|
+
</soapenv:Reason>
|
50
|
+
<soapenv:Detail>
|
51
|
+
<Exception>org.apache.axis2.AxisFault: Keine Bank zur BLZ test string gefunden!
|
52
|
+
at com.thomas_bayer.blz.BLZService.getBank(BLZService.java:41)
|
53
|
+
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:49)
|
54
|
+
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
|
55
|
+
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
|
56
|
+
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
|
57
|
+
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
|
58
|
+
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
|
59
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
|
60
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
|
61
|
+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
|
62
|
+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
|
63
|
+
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
|
64
|
+
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
|
65
|
+
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
|
66
|
+
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
|
67
|
+
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
|
68
|
+
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
|
69
|
+
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
|
70
|
+
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
|
71
|
+
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
|
72
|
+
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
|
73
|
+
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
|
74
|
+
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
|
75
|
+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
|
76
|
+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
|
77
|
+
at java.lang.Thread.run(Thread.java:745)
|
78
|
+
</Exception>
|
79
|
+
</soapenv:Detail>
|
80
|
+
</soapenv:Fault>
|
81
|
+
</soapenv:Body>
|
82
|
+
</soapenv:Envelope>
|
83
|
+
EOF
|
84
|
+
end
|
85
|
+
|
86
|
+
def error_response_template
|
87
|
+
<<-EOF
|
88
|
+
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
|
89
|
+
<soapenv:Body>
|
90
|
+
<soapenv:Fault>
|
91
|
+
<soapenv:Code>
|
92
|
+
<soapenv:Value>soapenv:Receiver</soapenv:Value>
|
93
|
+
</soapenv:Code>
|
94
|
+
<soapenv:Reason>
|
95
|
+
<soapenv:Text xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected subelement getBank</soapenv:Text>
|
96
|
+
</soapenv:Reason>
|
97
|
+
<soapenv:Detail>
|
98
|
+
<Exception>org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
99
|
+
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
|
100
|
+
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:124)
|
101
|
+
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:43)
|
102
|
+
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
|
103
|
+
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
|
104
|
+
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
|
105
|
+
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
|
106
|
+
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
|
107
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
|
108
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
|
109
|
+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
|
110
|
+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
|
111
|
+
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
|
112
|
+
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
|
113
|
+
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
|
114
|
+
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
|
115
|
+
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
|
116
|
+
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
|
117
|
+
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
|
118
|
+
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
|
119
|
+
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
|
120
|
+
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
|
121
|
+
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
|
122
|
+
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
|
123
|
+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
|
124
|
+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
|
125
|
+
at java.lang.Thread.run(Thread.java:745)
|
126
|
+
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
127
|
+
at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:423)
|
128
|
+
at com.thomas_bayer.adb.GetBank$Factory.parse(GetBank.java:304)
|
129
|
+
at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:117)
|
130
|
+
... 25 more
|
131
|
+
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
|
132
|
+
at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:410)
|
133
|
+
... 27 more
|
134
|
+
</Exception>
|
135
|
+
</soapenv:Detail>
|
136
|
+
</soapenv:Fault>
|
137
|
+
</soapenv:Body>
|
138
|
+
</soapenv:Envelope>
|
139
|
+
EOF
|
140
|
+
end
|
141
|
+
|
142
|
+
# Return a response based upon the SOAP request
|
143
|
+
# @param [String] request XML in request
|
144
|
+
def response_for(request)
|
145
|
+
@title = 'Deutsche Bank'
|
146
|
+
soap_action = request.env['HTTP_SOAPACTION']
|
147
|
+
return 500, 'Not valid SOAP' unless soap_action
|
148
|
+
|
149
|
+
request_body = request.body
|
150
|
+
doc = Nokogiri::XML(request_body)
|
151
|
+
soap_action = soap_action.strip # Used in ERB
|
152
|
+
blz_element = doc.at_xpath('//tns:blz')
|
153
|
+
return 500, error_response_template unless blz_element
|
154
|
+
|
155
|
+
@bank_name = blz_element.inner_text
|
156
|
+
@bank_id = @bank_name.to_i
|
157
|
+
return 500, ERB.new(bank_not_found).result(binding) if @bank_id.zero?
|
158
|
+
|
159
|
+
@title = 'DAB Bank' if @bank_id == 500
|
160
|
+
@multiple_ort = (@bank_id == 20)
|
161
|
+
ERB.new(success_response_template).result(binding)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|