soap4r-ng 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/bin/wsdl2ruby.rb +140 -0
- data/bin/xsd2ruby.rb +92 -0
- data/lib/soap/attachment.rb +109 -0
- data/lib/soap/attrproxy.rb +35 -0
- data/lib/soap/baseData.rb +1095 -0
- data/lib/soap/element.rb +278 -0
- data/lib/soap/encodingstyle/aspDotNetHandler.rb +208 -0
- data/lib/soap/encodingstyle/handler.rb +121 -0
- data/lib/soap/encodingstyle/literalHandler.rb +196 -0
- data/lib/soap/encodingstyle/soapHandler.rb +560 -0
- data/lib/soap/filter.rb +14 -0
- data/lib/soap/filter/filterchain.rb +52 -0
- data/lib/soap/filter/handler.rb +32 -0
- data/lib/soap/filter/streamhandler.rb +30 -0
- data/lib/soap/generator.rb +299 -0
- data/lib/soap/header/handler.rb +62 -0
- data/lib/soap/header/handlerset.rb +71 -0
- data/lib/soap/header/mappinghandler.rb +48 -0
- data/lib/soap/header/simplehandler.rb +45 -0
- data/lib/soap/httpconfigloader.rb +140 -0
- data/lib/soap/mapping.rb +13 -0
- data/lib/soap/mapping/encodedregistry.rb +541 -0
- data/lib/soap/mapping/factory.rb +389 -0
- data/lib/soap/mapping/literalregistry.rb +392 -0
- data/lib/soap/mapping/mapping.rb +577 -0
- data/lib/soap/mapping/registry.rb +296 -0
- data/lib/soap/mapping/rubytypeFactory.rb +446 -0
- data/lib/soap/mapping/schemadefinition.rb +171 -0
- data/lib/soap/mapping/typeMap.rb +107 -0
- data/lib/soap/mapping/wsdlencodedregistry.rb +212 -0
- data/lib/soap/mapping/wsdlliteralregistry.rb +249 -0
- data/lib/soap/marshal.rb +60 -0
- data/lib/soap/mimemessage.rb +243 -0
- data/lib/soap/nestedexception.rb +43 -0
- data/lib/soap/netHttpClient.rb +242 -0
- data/lib/soap/ns.rb +39 -0
- data/lib/soap/parser.rb +253 -0
- data/lib/soap/processor.rb +67 -0
- data/lib/soap/property.rb +330 -0
- data/lib/soap/proxy.rb +15 -0
- data/lib/soap/rpc/cgistub.rb +249 -0
- data/lib/soap/rpc/driver.rb +222 -0
- data/lib/soap/rpc/element.rb +375 -0
- data/lib/soap/rpc/httpserver.rb +144 -0
- data/lib/soap/rpc/methodDef.rb +69 -0
- data/lib/soap/rpc/proxy.rb +573 -0
- data/lib/soap/rpc/router.rb +663 -0
- data/lib/soap/rpc/rpc.rb +26 -0
- data/lib/soap/rpc/soaplet.rb +201 -0
- data/lib/soap/rpc/standaloneServer.rb +44 -0
- data/lib/soap/soap.rb +154 -0
- data/lib/soap/streamHandler.rb +302 -0
- data/lib/soap/version.rb +9 -0
- data/lib/soap/wsdlDriver.rb +165 -0
- data/lib/wsdl/binding.rb +66 -0
- data/lib/wsdl/data.rb +65 -0
- data/lib/wsdl/definitions.rb +237 -0
- data/lib/wsdl/documentation.rb +33 -0
- data/lib/wsdl/import.rb +81 -0
- data/lib/wsdl/importer.rb +39 -0
- data/lib/wsdl/info.rb +51 -0
- data/lib/wsdl/message.rb +55 -0
- data/lib/wsdl/operation.rb +152 -0
- data/lib/wsdl/operationBinding.rb +241 -0
- data/lib/wsdl/param.rb +94 -0
- data/lib/wsdl/parser.rb +180 -0
- data/lib/wsdl/part.rb +53 -0
- data/lib/wsdl/port.rb +67 -0
- data/lib/wsdl/portType.rb +76 -0
- data/lib/wsdl/service.rb +62 -0
- data/lib/wsdl/soap/address.rb +41 -0
- data/lib/wsdl/soap/binding.rb +50 -0
- data/lib/wsdl/soap/body.rb +59 -0
- data/lib/wsdl/soap/cgiStubCreator.rb +93 -0
- data/lib/wsdl/soap/classDefCreator.rb +434 -0
- data/lib/wsdl/soap/classDefCreatorSupport.rb +241 -0
- data/lib/wsdl/soap/classNameCreator.rb +55 -0
- data/lib/wsdl/soap/clientSkeltonCreator.rb +107 -0
- data/lib/wsdl/soap/complexType.rb +174 -0
- data/lib/wsdl/soap/data.rb +43 -0
- data/lib/wsdl/soap/definitions.rb +201 -0
- data/lib/wsdl/soap/driverCreator.rb +121 -0
- data/lib/wsdl/soap/element.rb +34 -0
- data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +74 -0
- data/lib/wsdl/soap/fault.rb +57 -0
- data/lib/wsdl/soap/header.rb +87 -0
- data/lib/wsdl/soap/headerfault.rb +57 -0
- data/lib/wsdl/soap/literalMappingRegistryCreator.rb +116 -0
- data/lib/wsdl/soap/mappingRegistryCreator.rb +59 -0
- data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +377 -0
- data/lib/wsdl/soap/methodDefCreator.rb +200 -0
- data/lib/wsdl/soap/operation.rb +113 -0
- data/lib/wsdl/soap/servantSkeltonCreator.rb +92 -0
- data/lib/wsdl/soap/servletStubCreator.rb +105 -0
- data/lib/wsdl/soap/standaloneServerStubCreator.rb +101 -0
- data/lib/wsdl/soap/wsdl2ruby.rb +227 -0
- data/lib/wsdl/types.rb +45 -0
- data/lib/wsdl/wsdl.rb +25 -0
- data/lib/wsdl/xmlSchema/all.rb +25 -0
- data/lib/wsdl/xmlSchema/annotation.rb +35 -0
- data/lib/wsdl/xmlSchema/any.rb +62 -0
- data/lib/wsdl/xmlSchema/anyAttribute.rb +49 -0
- data/lib/wsdl/xmlSchema/attribute.rb +105 -0
- data/lib/wsdl/xmlSchema/attributeGroup.rb +69 -0
- data/lib/wsdl/xmlSchema/choice.rb +59 -0
- data/lib/wsdl/xmlSchema/complexContent.rb +98 -0
- data/lib/wsdl/xmlSchema/complexExtension.rb +120 -0
- data/lib/wsdl/xmlSchema/complexRestriction.rb +105 -0
- data/lib/wsdl/xmlSchema/complexType.rb +194 -0
- data/lib/wsdl/xmlSchema/content.rb +96 -0
- data/lib/wsdl/xmlSchema/data.rb +117 -0
- data/lib/wsdl/xmlSchema/element.rb +154 -0
- data/lib/wsdl/xmlSchema/enumeration.rb +37 -0
- data/lib/wsdl/xmlSchema/fractiondigits.rb +38 -0
- data/lib/wsdl/xmlSchema/group.rb +101 -0
- data/lib/wsdl/xmlSchema/import.rb +53 -0
- data/lib/wsdl/xmlSchema/importHandler.rb +45 -0
- data/lib/wsdl/xmlSchema/importer.rb +103 -0
- data/lib/wsdl/xmlSchema/include.rb +48 -0
- data/lib/wsdl/xmlSchema/length.rb +38 -0
- data/lib/wsdl/xmlSchema/list.rb +49 -0
- data/lib/wsdl/xmlSchema/maxexclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/maxinclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/maxlength.rb +38 -0
- data/lib/wsdl/xmlSchema/minexclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/mininclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/minlength.rb +38 -0
- data/lib/wsdl/xmlSchema/parser.rb +168 -0
- data/lib/wsdl/xmlSchema/pattern.rb +37 -0
- data/lib/wsdl/xmlSchema/ref.rb +34 -0
- data/lib/wsdl/xmlSchema/schema.rb +179 -0
- data/lib/wsdl/xmlSchema/sequence.rb +55 -0
- data/lib/wsdl/xmlSchema/simpleContent.rb +70 -0
- data/lib/wsdl/xmlSchema/simpleExtension.rb +63 -0
- data/lib/wsdl/xmlSchema/simpleRestriction.rb +133 -0
- data/lib/wsdl/xmlSchema/simpleType.rb +88 -0
- data/lib/wsdl/xmlSchema/totaldigits.rb +38 -0
- data/lib/wsdl/xmlSchema/union.rb +36 -0
- data/lib/wsdl/xmlSchema/unique.rb +35 -0
- data/lib/wsdl/xmlSchema/whitespace.rb +38 -0
- data/lib/wsdl/xmlSchema/xsd2ruby.rb +177 -0
- data/lib/xsd/charset.rb +190 -0
- data/lib/xsd/codegen.rb +13 -0
- data/lib/xsd/codegen/classdef.rb +209 -0
- data/lib/xsd/codegen/commentdef.rb +35 -0
- data/lib/xsd/codegen/gensupport.rb +277 -0
- data/lib/xsd/codegen/methoddef.rb +71 -0
- data/lib/xsd/codegen/moduledef.rb +209 -0
- data/lib/xsd/datatypes.rb +1465 -0
- data/lib/xsd/datatypes1999.rb +21 -0
- data/lib/xsd/iconvcharset.rb +33 -0
- data/lib/xsd/mapping.rb +69 -0
- data/lib/xsd/namedelements.rb +133 -0
- data/lib/xsd/ns.rb +183 -0
- data/lib/xsd/qname.rb +80 -0
- data/lib/xsd/xmlparser.rb +81 -0
- data/lib/xsd/xmlparser/libxmlparser.rb +135 -0
- data/lib/xsd/xmlparser/nokogiriparser.rb +58 -0
- data/lib/xsd/xmlparser/ogaparser.rb +63 -0
- data/lib/xsd/xmlparser/oxparser.rb +101 -0
- data/lib/xsd/xmlparser/parser.rb +101 -0
- data/lib/xsd/xmlparser/rexmlparser.rb +58 -0
- metadata +236 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - Creating standalone server stub code from WSDL.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'wsdl/info'
|
11
|
+
require 'wsdl/soap/mappingRegistryCreator'
|
12
|
+
require 'wsdl/soap/methodDefCreator'
|
13
|
+
require 'wsdl/soap/classDefCreatorSupport'
|
14
|
+
|
15
|
+
|
16
|
+
module WSDL
|
17
|
+
module SOAP
|
18
|
+
|
19
|
+
|
20
|
+
class StandaloneServerStubCreator
|
21
|
+
include ClassDefCreatorSupport
|
22
|
+
|
23
|
+
attr_reader :definitions
|
24
|
+
|
25
|
+
def initialize(definitions, name_creator, modulepath = nil)
|
26
|
+
@definitions = definitions
|
27
|
+
@name_creator = name_creator
|
28
|
+
@modulepath = modulepath
|
29
|
+
end
|
30
|
+
|
31
|
+
def dump(service_name)
|
32
|
+
warn("- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored.")
|
33
|
+
warn("- Standalone server stub ignores port location defined in WSDL. Location is http://localhost:10080/ by default. Generated client from WSDL must be configured to point this endpoint manually.")
|
34
|
+
services = @definitions.service(service_name)
|
35
|
+
unless services
|
36
|
+
raise RuntimeError.new("service not defined: #{service_name}")
|
37
|
+
end
|
38
|
+
ports = services.ports
|
39
|
+
if ports.empty?
|
40
|
+
raise RuntimeError.new("ports not found for #{service_name}")
|
41
|
+
end
|
42
|
+
port = ports[0]
|
43
|
+
if port.porttype.nil?
|
44
|
+
raise RuntimeError.new("porttype not found for #{port}")
|
45
|
+
end
|
46
|
+
dump_porttype(port.porttype)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def dump_porttype(porttype)
|
52
|
+
class_name = mapped_class_name(porttype.name, @modulepath)
|
53
|
+
defined_const = {}
|
54
|
+
methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
|
55
|
+
wsdl_name = @definitions.name ? @definitions.name.name : 'default'
|
56
|
+
mrname = safeconstname(wsdl_name + 'MappingRegistry')
|
57
|
+
c1 = XSD::CodeGen::ClassDef.new(class_name)
|
58
|
+
c1.def_require("soap/rpc/standaloneServer")
|
59
|
+
c1.def_code <<-EOD
|
60
|
+
Methods = [
|
61
|
+
#{methoddef.gsub(/^/, " ")}
|
62
|
+
]
|
63
|
+
EOD
|
64
|
+
defined_const.each do |ns, tag|
|
65
|
+
c1.def_const(tag, dq(ns))
|
66
|
+
end
|
67
|
+
c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
|
68
|
+
"::SOAP::RPC::StandaloneServer")
|
69
|
+
c2.def_method("initialize", "*arg") do
|
70
|
+
<<-EOD
|
71
|
+
super(*arg)
|
72
|
+
servant = #{class_name}.new
|
73
|
+
#{class_name}::Methods.each do |definitions|
|
74
|
+
opt = definitions.last
|
75
|
+
if opt[:request_style] == :document
|
76
|
+
@router.add_document_operation(servant, *definitions)
|
77
|
+
else
|
78
|
+
@router.add_rpc_operation(servant, *definitions)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
self.mapping_registry = #{mrname}::EncodedRegistry
|
82
|
+
self.literal_mapping_registry = #{mrname}::LiteralRegistry
|
83
|
+
EOD
|
84
|
+
end
|
85
|
+
c1.dump + "\n" + c2.dump + format(<<-EOD)
|
86
|
+
|
87
|
+
if $0 == __FILE__
|
88
|
+
# Change listen port.
|
89
|
+
server = #{class_name}App.new('app', nil, '0.0.0.0', 10080)
|
90
|
+
trap(:INT) do
|
91
|
+
server.shutdown
|
92
|
+
end
|
93
|
+
server.start
|
94
|
+
end
|
95
|
+
EOD
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - WSDL to ruby mapping library.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'logger'
|
11
|
+
require 'logger-application' unless defined?(Logger::Application)
|
12
|
+
require 'xsd/qname'
|
13
|
+
require 'wsdl/importer'
|
14
|
+
require 'wsdl/soap/classDefCreator'
|
15
|
+
require 'wsdl/soap/servantSkeltonCreator'
|
16
|
+
require 'wsdl/soap/driverCreator'
|
17
|
+
require 'wsdl/soap/clientSkeltonCreator'
|
18
|
+
require 'wsdl/soap/standaloneServerStubCreator'
|
19
|
+
require 'wsdl/soap/servletStubCreator'
|
20
|
+
require 'wsdl/soap/cgiStubCreator'
|
21
|
+
require 'wsdl/soap/classNameCreator'
|
22
|
+
|
23
|
+
|
24
|
+
module WSDL
|
25
|
+
module SOAP
|
26
|
+
|
27
|
+
|
28
|
+
class WSDL2Ruby
|
29
|
+
attr_accessor :location
|
30
|
+
attr_reader :opt
|
31
|
+
attr_accessor :logger
|
32
|
+
attr_accessor :basedir
|
33
|
+
|
34
|
+
def run
|
35
|
+
unless @location
|
36
|
+
raise RuntimeError, "WSDL location not given"
|
37
|
+
end
|
38
|
+
@wsdl = import(@location)
|
39
|
+
if @opt['classdef']
|
40
|
+
@name = @opt['classdef']
|
41
|
+
else
|
42
|
+
@name = @wsdl.name ? @wsdl.name.name : 'default'
|
43
|
+
end
|
44
|
+
create_file
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def initialize
|
50
|
+
@modulepath = nil
|
51
|
+
@location = nil
|
52
|
+
@opt = {}
|
53
|
+
@logger = Logger.new(STDERR)
|
54
|
+
@basedir = nil
|
55
|
+
@wsdl = nil
|
56
|
+
@name = nil
|
57
|
+
@classdef_filename = nil
|
58
|
+
@mr_filename = nil
|
59
|
+
@name_creator = ClassNameCreator.new
|
60
|
+
end
|
61
|
+
|
62
|
+
def create_file
|
63
|
+
@modulepath = @opt['module_path']
|
64
|
+
create_classdef if @opt.key?('classdef')
|
65
|
+
create_mapping_registry if @opt.key?('mapping_registry')
|
66
|
+
create_servant_skelton(@opt['servant_skelton']) if @opt.key?('servant_skelton')
|
67
|
+
create_cgi_stub(@opt['cgi_stub']) if @opt.key?('cgi_stub')
|
68
|
+
create_standalone_server_stub(@opt['standalone_server_stub']) if @opt.key?('standalone_server_stub')
|
69
|
+
create_servlet_stub(@opt['servlet_stub']) if @opt.key?('servlet_stub')
|
70
|
+
create_driver(@opt['driver'], @opt['drivername_postfix'] || '') if @opt.key?('driver')
|
71
|
+
create_client_skelton(@opt['client_skelton']) if @opt.key?('client_skelton')
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_classdef
|
75
|
+
@logger.info { "Creating class definition." }
|
76
|
+
@classdef_filename = @name + '.rb'
|
77
|
+
check_file(@classdef_filename) or return
|
78
|
+
write_file(@classdef_filename) do |f|
|
79
|
+
f.puts "# encoding: UTF-8"
|
80
|
+
f << WSDL::SOAP::ClassDefCreator.new(@wsdl, @name_creator, @modulepath).dump
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_mapping_registry
|
85
|
+
@logger.info { "Creating mapping registry definition." }
|
86
|
+
@mr_filename = @name + 'MappingRegistry.rb'
|
87
|
+
check_file(@mr_filename) or return
|
88
|
+
write_file(@mr_filename) do |f|
|
89
|
+
f.puts "# encoding: UTF-8"
|
90
|
+
f << "require '#{@classdef_filename}'\n" if @classdef_filename
|
91
|
+
f << WSDL::SOAP::MappingRegistryCreator.new(@wsdl, @name_creator, @modulepath).dump
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def create_client_skelton(servicename)
|
96
|
+
return if @wsdl.services.empty?
|
97
|
+
@logger.info { "Creating client skelton." }
|
98
|
+
servicename ||= @wsdl.services[0].name.name
|
99
|
+
@client_skelton_filename = servicename + 'Client.rb'
|
100
|
+
check_file(@client_skelton_filename) or return
|
101
|
+
write_file(@client_skelton_filename) do |f|
|
102
|
+
f << shbang << "\n"
|
103
|
+
f.puts "# encoding: UTF-8"
|
104
|
+
f << "require '#{@driver_filename}'\n\n" if @driver_filename
|
105
|
+
f << WSDL::SOAP::ClientSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def create_servant_skelton(porttypename)
|
110
|
+
@logger.info { "Creating servant skelton." }
|
111
|
+
@servant_skelton_filename = (porttypename || @name + 'Servant') + '.rb'
|
112
|
+
check_file(@servant_skelton_filename) or return
|
113
|
+
write_file(@servant_skelton_filename) do |f|
|
114
|
+
f.puts "# encoding: UTF-8"
|
115
|
+
f << "require '#{@classdef_filename}'\n\n" if @classdef_filename
|
116
|
+
f << WSDL::SOAP::ServantSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(porttypename))
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def create_cgi_stub(servicename)
|
121
|
+
@logger.info { "Creating CGI stub." }
|
122
|
+
servicename ||= @wsdl.services[0].name.name
|
123
|
+
@cgi_stubFilename = servicename + '.cgi'
|
124
|
+
check_file(@cgi_stubFilename) or return
|
125
|
+
write_file(@cgi_stubFilename) do |f|
|
126
|
+
f << shbang << "\n"
|
127
|
+
f.puts "# encoding: UTF-8"
|
128
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
129
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
130
|
+
f << WSDL::SOAP::CGIStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def create_standalone_server_stub(servicename)
|
135
|
+
@logger.info { "Creating standalone stub." }
|
136
|
+
servicename ||= @wsdl.services[0].name.name
|
137
|
+
@standalone_server_stub_filename = servicename + '.rb'
|
138
|
+
check_file(@standalone_server_stub_filename) or return
|
139
|
+
write_file(@standalone_server_stub_filename) do |f|
|
140
|
+
f << shbang << "\n"
|
141
|
+
f.puts "# encoding: UTF-8"
|
142
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
143
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
144
|
+
f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def create_servlet_stub(servicename)
|
149
|
+
@logger.info { "Creating servlet stub." }
|
150
|
+
servicename ||= @wsdl.services[0].name.name
|
151
|
+
@servlet_stub_filename = servicename + 'Servlet.rb'
|
152
|
+
check_file(@servlet_stub_filename) or return
|
153
|
+
write_file(@servlet_stub_filename) do |f|
|
154
|
+
f << shbang << "\n"
|
155
|
+
f.puts "# encoding: UTF-8"
|
156
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
157
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
158
|
+
f << WSDL::SOAP::ServletStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def create_driver(porttypename, drivername_postfix)
|
163
|
+
@logger.info { "Creating driver." }
|
164
|
+
@driver_filename = (porttypename || @name) + 'Driver.rb'
|
165
|
+
creator = WSDL::SOAP::DriverCreator.new(@wsdl, @name_creator, @modulepath)
|
166
|
+
creator.drivername_postfix = drivername_postfix
|
167
|
+
check_file(@driver_filename) or return
|
168
|
+
write_file(@driver_filename) do |f|
|
169
|
+
f.puts "# encoding: UTF-8"
|
170
|
+
f << "require '#{@classdef_filename}'\n" if @classdef_filename
|
171
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
172
|
+
f << creator.dump(create_name(porttypename))
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def write_file(filename)
|
177
|
+
if @basedir
|
178
|
+
filename = File.join(basedir, filename)
|
179
|
+
end
|
180
|
+
File.open(filename, "w") do |f|
|
181
|
+
yield f
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def check_file(filename)
|
186
|
+
if @basedir
|
187
|
+
filename = File.join(basedir, filename)
|
188
|
+
end
|
189
|
+
if FileTest.exist?(filename)
|
190
|
+
if @opt.key?('force')
|
191
|
+
@logger.warn {
|
192
|
+
"File '#{filename}' exists but overrides it."
|
193
|
+
}
|
194
|
+
true
|
195
|
+
else
|
196
|
+
@logger.warn {
|
197
|
+
"File '#{filename}' exists. #{$0} did not override it."
|
198
|
+
}
|
199
|
+
false
|
200
|
+
end
|
201
|
+
else
|
202
|
+
@logger.info { "Creates file '#{filename}'." }
|
203
|
+
true
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def shbang
|
208
|
+
"#!/usr/bin/env ruby"
|
209
|
+
end
|
210
|
+
|
211
|
+
def create_name(name)
|
212
|
+
name ? XSD::QName.new(@wsdl.targetnamespace, name) : nil
|
213
|
+
end
|
214
|
+
|
215
|
+
def import(location)
|
216
|
+
WSDL::Importer.import(location)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
if __FILE__ == $0
|
226
|
+
warn("WARNING: #{File.expand_path(__FILE__)} is a library file used by bin/wsdl2ruby.rb. Find bin/wsdl2ruby.rb from tarball version of soap4r or install soap4r via gem.")
|
227
|
+
end
|
data/lib/wsdl/types.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - WSDL types definition.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'wsdl/info'
|
11
|
+
|
12
|
+
|
13
|
+
module WSDL
|
14
|
+
|
15
|
+
|
16
|
+
class Types < Info
|
17
|
+
attr_reader :schemas
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
super
|
21
|
+
@schemas = []
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse_element(element)
|
25
|
+
case element
|
26
|
+
when SchemaName
|
27
|
+
o = XMLSchema::Schema.new
|
28
|
+
o.location = parent.location
|
29
|
+
@schemas << o
|
30
|
+
o
|
31
|
+
when DocumentationName
|
32
|
+
o = Documentation.new
|
33
|
+
o
|
34
|
+
else
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def parse_attr(attr, value)
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
end
|
data/lib/wsdl/wsdl.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - Base definitions.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'xsd/qname'
|
11
|
+
require 'soap/nestedexception'
|
12
|
+
|
13
|
+
|
14
|
+
module WSDL
|
15
|
+
|
16
|
+
|
17
|
+
Version = '0.0.2'
|
18
|
+
|
19
|
+
Namespace = 'http://schemas.xmlsoap.org/wsdl/'
|
20
|
+
SOAPBindingNamespace ='http://schemas.xmlsoap.org/wsdl/soap/'
|
21
|
+
|
22
|
+
class Error < StandardError; include ::SOAP::NestedException; end
|
23
|
+
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - XMLSchema complexType definition for WSDL.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'wsdl/xmlSchema/content'
|
11
|
+
|
12
|
+
|
13
|
+
module WSDL
|
14
|
+
module XMLSchema
|
15
|
+
|
16
|
+
|
17
|
+
class All < Content
|
18
|
+
def initialize
|
19
|
+
super()
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# WSDL4R - WSDL SOAP documentation element.
|
3
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
4
|
+
|
5
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
6
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
7
|
+
# either the dual license version in 2003, or any later version.
|
8
|
+
|
9
|
+
|
10
|
+
require 'wsdl/info'
|
11
|
+
|
12
|
+
|
13
|
+
module WSDL
|
14
|
+
module XMLSchema
|
15
|
+
|
16
|
+
|
17
|
+
class Annotation < Info
|
18
|
+
def initialize
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_element(element)
|
23
|
+
# Accepts any element.
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_attr(attr, value)
|
28
|
+
# Accepts any attribute.
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|