-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwsdl.builder
More file actions
79 lines (74 loc) · 2.67 KB
/
Copy pathwsdl.builder
File metadata and controls
79 lines (74 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
xml.instruct!
xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
'xmlns:tns' => settings.namespace,
'xmlns:soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/',
'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
'name' => settings.service,
'targetNamespace' => settings.namespace do
xml.types do
xml.tag! "schema", :targetNamespace => settings.namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do
defined = []
wsdl.each do |operation, formats|
formats[:in] ||= {}
formats[:out] ||= {}
formats[:in].each do |p|
wsdl_type xml, p, defined
end
formats[:out].each do |p|
wsdl_type xml, p, defined
end
end
end
end
xml.portType :name => "#{settings.service}_port" do
wsdl.keys.each do |operation|
xml.operation :name => operation do
xml.input :message => "tns:#{operation}"
response_name = wsdl[operation][:reply_name] || "#{operation}Response"
xml.output :message => "tns:#{response_name}"
end
end
end
xml.binding :name => "#{settings.service}_binding", :type => "tns:#{settings.service}_port" do
xml.tag! "soap:binding", :style => 'document', :transport => 'http://schemas.xmlsoap.org/soap/http'
wsdl.keys.each do |operation|
xml.operation :name => operation do
xml.tag! "soap:operation", :soapAction => operation
xml.input do
xml.tag! "soap:body",
:use => "literal",
:namespace => settings.namespace
end
xml.output do
xml.tag! "soap:body",
:use => "literal",
:namespace => settings.namespace
end
end
end
end
xml.service :name => "service" do
xml.port :name => "#{settings.service}_port", :binding => "tns:#{settings.service}_binding" do
xml.tag! "soap:address", :location => "http://#{request.host_with_port}#{settings.endpoint}"
end
end
wsdl.each do |operation, formats|
xml.message :name => "#{operation}" do
formats[:in] ||= []
formats[:in].each do |p|
xml.part wsdl_occurence(p, false)
#, :name => param.name, :type => param.namespaced_type)
end
end
response_name = wsdl[operation][:reply_name] || "#{operation}Response"
xml.message :name => response_name do
formats[:out] ||= []
formats[:out].each do |p|
xml.part wsdl_occurence(p, false)
#, :name => param.name, :type => param.namespaced_type)
end
end
end
end