soaspec 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +15 -15
  3. data/.gitlab-ci.yml +48 -48
  4. data/.rspec +3 -3
  5. data/.rubocop.yml +2 -2
  6. data/CODE_OF_CONDUCT.md +74 -74
  7. data/ChangeLog +408 -404
  8. data/Gemfile +6 -6
  9. data/LICENSE.txt +21 -21
  10. data/README.md +113 -113
  11. data/Rakefile +24 -24
  12. data/Todo.md +6 -6
  13. data/exe/soaspec +109 -109
  14. data/exe/soaspec-virtual-server +156 -156
  15. data/exe/xml_to_yaml_file +60 -60
  16. data/lib/soaspec.rb +107 -103
  17. data/lib/soaspec/core_ext/hash.rb +83 -83
  18. data/lib/soaspec/exchange.rb +235 -235
  19. data/lib/soaspec/exchange_handlers/exchange_handler.rb +103 -103
  20. data/lib/soaspec/exchange_handlers/handler_accessors.rb +106 -106
  21. data/lib/soaspec/exchange_handlers/rest_accessors.rb +54 -92
  22. data/lib/soaspec/exchange_handlers/rest_handler.rb +318 -314
  23. data/lib/soaspec/exchange_handlers/rest_methods.rb +44 -44
  24. data/lib/soaspec/exchange_handlers/soap_handler.rb +236 -236
  25. data/lib/soaspec/exe_helpers.rb +60 -60
  26. data/lib/soaspec/generator/.rspec.erb +5 -5
  27. data/lib/soaspec/generator/.travis.yml.erb +5 -5
  28. data/lib/soaspec/generator/Gemfile.erb +8 -8
  29. data/lib/soaspec/generator/README.md.erb +29 -29
  30. data/lib/soaspec/generator/Rakefile.erb +19 -19
  31. data/lib/soaspec/generator/config/data/default.yml.erb +1 -1
  32. data/lib/soaspec/generator/lib/blz_service.rb.erb +26 -26
  33. data/lib/soaspec/generator/lib/dynamic_class_content.rb.erb +12 -12
  34. data/lib/soaspec/generator/lib/shared_example.rb.erb +8 -8
  35. data/lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb +12 -12
  36. data/lib/soaspec/generator/spec/soap_spec.rb.erb +51 -51
  37. data/lib/soaspec/generator/spec/spec_helper.rb.erb +20 -20
  38. data/lib/soaspec/generator/template/soap_template.xml +6 -6
  39. data/lib/soaspec/interpreter.rb +40 -40
  40. data/lib/soaspec/matchers.rb +65 -65
  41. data/lib/soaspec/not_found_errors.rb +13 -13
  42. data/lib/soaspec/o_auth2.rb +65 -0
  43. data/lib/soaspec/soaspec_shared_examples.rb +24 -24
  44. data/lib/soaspec/spec_logger.rb +34 -27
  45. data/lib/soaspec/test_server/bank.wsdl +90 -90
  46. data/lib/soaspec/test_server/get_bank.rb +160 -160
  47. data/lib/soaspec/test_server/id_manager.rb +31 -31
  48. data/lib/soaspec/test_server/invoices.rb +27 -27
  49. data/lib/soaspec/test_server/namespace.xml +14 -14
  50. data/lib/soaspec/test_server/note.xml +5 -5
  51. data/lib/soaspec/test_server/puppy_service.rb +20 -20
  52. data/lib/soaspec/test_server/test_attribute.rb +13 -13
  53. data/lib/soaspec/test_server/test_namespace.rb +12 -12
  54. data/lib/soaspec/version.rb +2 -2
  55. data/lib/soaspec/wsdl_generator.rb +144 -144
  56. data/soaspec.gemspec +46 -46
  57. data/test.wsdl +116 -116
  58. data/test.xml +10 -10
  59. data/test_wsdl.rb +43 -43
  60. metadata +4 -3
@@ -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,161 +1,161 @@
1
-
2
- require 'erb'
3
-
4
- module Soaspec
5
- module TestServer
6
- # Representing a GetBank SOAP service
7
- class GetBank
8
-
9
- class << self
10
-
11
- def test_wsdl
12
- ERB.new(File.read(File.join(File.dirname(__FILE__), 'bank.wsdl'))).result(binding)
13
- end
14
-
15
- def success_response_template
16
- <<-EOF
17
- <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
18
- <soapenv:Body>
19
- <ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
20
- <ns1:details unique_id="50">
21
- <ns1:bezeichnung lang="German"><%= @title %></ns1:bezeichnung>
22
- <ns1:bic>DEUTDEMMXXX <%= soap_action %></ns1:bic>
23
- <ns1:ort>München</ns1:ort>
24
- <% if @multiple_ort %>
25
- <ns1:ort>Wellington</ns1:ort>
26
- <ns1:ort>Tokyo</ns1:ort>
27
- <% end %>
28
- <ns1:plz><%= @bank_name %></ns1:plz>
29
- </ns1:details>
30
- </ns1:getBankResponse>
31
- </soapenv:Body>
32
- </soapenv:Envelope>
33
- EOF
34
- end
35
-
36
- def bank_not_found
37
- <<-EOF
38
- <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
39
- <soapenv:Body>
40
- <soapenv:Fault>
41
- <soapenv:Code>
42
- <soapenv:Value>soapenv:Receiver</soapenv:Value>
43
- </soapenv:Code>
44
- <soapenv:Reason>
45
- <soapenv:Text xml:lang="en-US">Keine Bank zur BLZ <%= @bank_name %> gefunden!</soapenv:Text>
46
- </soapenv:Reason>
47
- <soapenv:Detail>
48
- <Exception>org.apache.axis2.AxisFault: Keine Bank zur BLZ test string gefunden!
49
- at com.thomas_bayer.blz.BLZService.getBank(BLZService.java:41)
50
- at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:49)
51
- at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
52
- at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
53
- at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
54
- at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
55
- at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
56
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
57
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
58
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
59
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
60
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
61
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
62
- at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
63
- at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
64
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
65
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
66
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
67
- at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
68
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
69
- at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
70
- at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
71
- at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
72
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
73
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
74
- at java.lang.Thread.run(Thread.java:745)
75
- </Exception>
76
- </soapenv:Detail>
77
- </soapenv:Fault>
78
- </soapenv:Body>
79
- </soapenv:Envelope>
80
- EOF
81
- end
82
-
83
- def error_response_template
84
- <<-EOF
85
- <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
86
- <soapenv:Body>
87
- <soapenv:Fault>
88
- <soapenv:Code>
89
- <soapenv:Value>soapenv:Receiver</soapenv:Value>
90
- </soapenv:Code>
91
- <soapenv:Reason>
92
- <soapenv:Text xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected subelement getBank</soapenv:Text>
93
- </soapenv:Reason>
94
- <soapenv:Detail>
95
- <Exception>org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
96
- at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
97
- at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:124)
98
- at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:43)
99
- at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
100
- at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
101
- at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
102
- at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
103
- at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
104
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
105
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
106
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
107
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
108
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
109
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
110
- at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
111
- at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
112
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
113
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
114
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
115
- at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
116
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
117
- at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
118
- at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
119
- at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
120
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
121
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
122
- at java.lang.Thread.run(Thread.java:745)
123
- Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
124
- at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:423)
125
- at com.thomas_bayer.adb.GetBank$Factory.parse(GetBank.java:304)
126
- at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:117)
127
- ... 25 more
128
- Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
129
- at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:410)
130
- ... 27 more
131
- </Exception>
132
- </soapenv:Detail>
133
- </soapenv:Fault>
134
- </soapenv:Body>
135
- </soapenv:Envelope>
136
- EOF
137
- end
138
-
139
- # Return a response based upon the SOAP request
140
- # @param [String] request XML in request
141
- def response_for(request)
142
- @title = 'Deutsche Bank'
143
- soap_action = request.env['HTTP_SOAPACTION']
144
- return 500, 'Not valid SOAP' unless soap_action
145
- request_body = request.body
146
- doc = Nokogiri::XML(request_body)
147
- soap_action = soap_action.strip # Used in ERB
148
- blz_element = doc.at_xpath('//tns:blz')
149
- return 500, error_response_template unless blz_element
150
- @bank_name = blz_element.inner_text
151
- @bank_id = @bank_name.to_i
152
- return 500, ERB.new(bank_not_found).result(binding) if @bank_id.zero?
153
- @title = 'DAB Bank' if @bank_id == 500
154
- @multiple_ort = (@bank_id == 20)
155
- ERB.new(success_response_template).result(binding)
156
- end
157
-
158
- end
159
- end
160
- end
1
+
2
+ require 'erb'
3
+
4
+ module Soaspec
5
+ module TestServer
6
+ # Representing a GetBank SOAP service
7
+ class GetBank
8
+
9
+ class << self
10
+
11
+ def test_wsdl
12
+ ERB.new(File.read(File.join(File.dirname(__FILE__), 'bank.wsdl'))).result(binding)
13
+ end
14
+
15
+ def success_response_template
16
+ <<-EOF
17
+ <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
18
+ <soapenv:Body>
19
+ <ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
20
+ <ns1:details unique_id="50">
21
+ <ns1:bezeichnung lang="German"><%= @title %></ns1:bezeichnung>
22
+ <ns1:bic>DEUTDEMMXXX <%= soap_action %></ns1:bic>
23
+ <ns1:ort>München</ns1:ort>
24
+ <% if @multiple_ort %>
25
+ <ns1:ort>Wellington</ns1:ort>
26
+ <ns1:ort>Tokyo</ns1:ort>
27
+ <% end %>
28
+ <ns1:plz><%= @bank_name %></ns1:plz>
29
+ </ns1:details>
30
+ </ns1:getBankResponse>
31
+ </soapenv:Body>
32
+ </soapenv:Envelope>
33
+ EOF
34
+ end
35
+
36
+ def bank_not_found
37
+ <<-EOF
38
+ <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
39
+ <soapenv:Body>
40
+ <soapenv:Fault>
41
+ <soapenv:Code>
42
+ <soapenv:Value>soapenv:Receiver</soapenv:Value>
43
+ </soapenv:Code>
44
+ <soapenv:Reason>
45
+ <soapenv:Text xml:lang="en-US">Keine Bank zur BLZ <%= @bank_name %> gefunden!</soapenv:Text>
46
+ </soapenv:Reason>
47
+ <soapenv:Detail>
48
+ <Exception>org.apache.axis2.AxisFault: Keine Bank zur BLZ test string gefunden!
49
+ at com.thomas_bayer.blz.BLZService.getBank(BLZService.java:41)
50
+ at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:49)
51
+ at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
52
+ at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
53
+ at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
54
+ at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
55
+ at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
56
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
57
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
58
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
59
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
60
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
61
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
62
+ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
63
+ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
64
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
65
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
66
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
67
+ at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
68
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
69
+ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
70
+ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
71
+ at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
72
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
73
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
74
+ at java.lang.Thread.run(Thread.java:745)
75
+ </Exception>
76
+ </soapenv:Detail>
77
+ </soapenv:Fault>
78
+ </soapenv:Body>
79
+ </soapenv:Envelope>
80
+ EOF
81
+ end
82
+
83
+ def error_response_template
84
+ <<-EOF
85
+ <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
86
+ <soapenv:Body>
87
+ <soapenv:Fault>
88
+ <soapenv:Code>
89
+ <soapenv:Value>soapenv:Receiver</soapenv:Value>
90
+ </soapenv:Code>
91
+ <soapenv:Reason>
92
+ <soapenv:Text xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected subelement getBank</soapenv:Text>
93
+ </soapenv:Reason>
94
+ <soapenv:Detail>
95
+ <Exception>org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
96
+ at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
97
+ at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:124)
98
+ at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.invokeBusinessLogic(BLZServiceMessageReceiverInOut.java:43)
99
+ at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
100
+ at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
101
+ at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
102
+ at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
103
+ at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
104
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
105
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
106
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
107
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
108
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
109
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
110
+ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
111
+ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
112
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
113
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
114
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
115
+ at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
116
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
117
+ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
118
+ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
119
+ at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
120
+ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
121
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
122
+ at java.lang.Thread.run(Thread.java:745)
123
+ Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
124
+ at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:423)
125
+ at com.thomas_bayer.adb.GetBank$Factory.parse(GetBank.java:304)
126
+ at com.thomas_bayer.blz.BLZServiceMessageReceiverInOut.fromOM(BLZServiceMessageReceiverInOut.java:117)
127
+ ... 25 more
128
+ Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement getBank
129
+ at com.thomas_bayer.adb.GetBankType$Factory.parse(GetBankType.java:410)
130
+ ... 27 more
131
+ </Exception>
132
+ </soapenv:Detail>
133
+ </soapenv:Fault>
134
+ </soapenv:Body>
135
+ </soapenv:Envelope>
136
+ EOF
137
+ end
138
+
139
+ # Return a response based upon the SOAP request
140
+ # @param [String] request XML in request
141
+ def response_for(request)
142
+ @title = 'Deutsche Bank'
143
+ soap_action = request.env['HTTP_SOAPACTION']
144
+ return 500, 'Not valid SOAP' unless soap_action
145
+ request_body = request.body
146
+ doc = Nokogiri::XML(request_body)
147
+ soap_action = soap_action.strip # Used in ERB
148
+ blz_element = doc.at_xpath('//tns:blz')
149
+ return 500, error_response_template unless blz_element
150
+ @bank_name = blz_element.inner_text
151
+ @bank_id = @bank_name.to_i
152
+ return 500, ERB.new(bank_not_found).result(binding) if @bank_id.zero?
153
+ @title = 'DAB Bank' if @bank_id == 500
154
+ @multiple_ort = (@bank_id == 20)
155
+ ERB.new(success_response_template).result(binding)
156
+ end
157
+
158
+ end
159
+ end
160
+ end
161
161
  end