soybean 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +38 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/bin/soybean +22 -0
- data/bin/xsd2ruby +90 -0
- data/lib/soybean.rb +11 -0
- data/lib/soybean/actions/generate_classes.rb +33 -0
- data/soybean.gemspec +236 -0
- data/spec/soybean_spec.rb +5 -0
- data/spec/spec_helper.rb +12 -0
- data/vendor/soap4r/soap/attachment.rb +109 -0
- data/vendor/soap4r/soap/attrproxy.rb +35 -0
- data/vendor/soap4r/soap/base_data.rb +1095 -0
- data/vendor/soap4r/soap/element.rb +278 -0
- data/vendor/soap4r/soap/encodingstyle/asp_dot_net_handler.rb +208 -0
- data/vendor/soap4r/soap/encodingstyle/handler.rb +121 -0
- data/vendor/soap4r/soap/encodingstyle/literal_handler.rb +196 -0
- data/vendor/soap4r/soap/encodingstyle/soap_handler.rb +560 -0
- data/vendor/soap4r/soap/filter.rb +14 -0
- data/vendor/soap4r/soap/filter/filterchain.rb +52 -0
- data/vendor/soap4r/soap/filter/handler.rb +32 -0
- data/vendor/soap4r/soap/filter/streamhandler.rb +30 -0
- data/vendor/soap4r/soap/generator.rb +299 -0
- data/vendor/soap4r/soap/header/handler.rb +62 -0
- data/vendor/soap4r/soap/header/handlerset.rb +71 -0
- data/vendor/soap4r/soap/header/mappinghandler.rb +48 -0
- data/vendor/soap4r/soap/header/simplehandler.rb +45 -0
- data/vendor/soap4r/soap/httpconfigloader.rb +140 -0
- data/vendor/soap4r/soap/mapping.rb +13 -0
- data/vendor/soap4r/soap/mapping/encodedregistry.rb +539 -0
- data/vendor/soap4r/soap/mapping/factory.rb +389 -0
- data/vendor/soap4r/soap/mapping/literalregistry.rb +392 -0
- data/vendor/soap4r/soap/mapping/mapping.rb +577 -0
- data/vendor/soap4r/soap/mapping/registry.rb +296 -0
- data/vendor/soap4r/soap/mapping/rubytype_factory.rb +446 -0
- data/vendor/soap4r/soap/mapping/schemadefinition.rb +171 -0
- data/vendor/soap4r/soap/mapping/type_map.rb +107 -0
- data/vendor/soap4r/soap/mapping/wsdlencodedregistry.rb +212 -0
- data/vendor/soap4r/soap/mapping/wsdlliteralregistry.rb +249 -0
- data/vendor/soap4r/soap/marshal.rb +60 -0
- data/vendor/soap4r/soap/mimemessage.rb +243 -0
- data/vendor/soap4r/soap/nestedexception.rb +43 -0
- data/vendor/soap4r/soap/net_http_client.rb +242 -0
- data/vendor/soap4r/soap/ns.rb +39 -0
- data/vendor/soap4r/soap/parser.rb +253 -0
- data/vendor/soap4r/soap/processor.rb +67 -0
- data/vendor/soap4r/soap/property.rb +340 -0
- data/vendor/soap4r/soap/proxy.rb +15 -0
- data/vendor/soap4r/soap/rpc/cgistub.rb +248 -0
- data/vendor/soap4r/soap/rpc/driver.rb +222 -0
- data/vendor/soap4r/soap/rpc/element.rb +375 -0
- data/vendor/soap4r/soap/rpc/httpserver.rb +143 -0
- data/vendor/soap4r/soap/rpc/method_def.rb +69 -0
- data/vendor/soap4r/soap/rpc/proxy.rb +573 -0
- data/vendor/soap4r/soap/rpc/router.rb +663 -0
- data/vendor/soap4r/soap/rpc/rpc.rb +26 -0
- data/vendor/soap4r/soap/rpc/soaplet.rb +201 -0
- data/vendor/soap4r/soap/rpc/standalone_server.rb +44 -0
- data/vendor/soap4r/soap/soap.rb +154 -0
- data/vendor/soap4r/soap/stream_handler.rb +302 -0
- data/vendor/soap4r/soap/version.rb +9 -0
- data/vendor/soap4r/soap/wsdl_driver.rb +165 -0
- data/vendor/soap4r/wsdl/binding.rb +66 -0
- data/vendor/soap4r/wsdl/data.rb +65 -0
- data/vendor/soap4r/wsdl/definitions.rb +237 -0
- data/vendor/soap4r/wsdl/documentation.rb +33 -0
- data/vendor/soap4r/wsdl/import.rb +81 -0
- data/vendor/soap4r/wsdl/importer.rb +39 -0
- data/vendor/soap4r/wsdl/info.rb +51 -0
- data/vendor/soap4r/wsdl/message.rb +55 -0
- data/vendor/soap4r/wsdl/operation.rb +152 -0
- data/vendor/soap4r/wsdl/operation_binding.rb +241 -0
- data/vendor/soap4r/wsdl/param.rb +94 -0
- data/vendor/soap4r/wsdl/parser.rb +165 -0
- data/vendor/soap4r/wsdl/part.rb +53 -0
- data/vendor/soap4r/wsdl/port.rb +67 -0
- data/vendor/soap4r/wsdl/port_type.rb +76 -0
- data/vendor/soap4r/wsdl/service.rb +62 -0
- data/vendor/soap4r/wsdl/soap/address.rb +41 -0
- data/vendor/soap4r/wsdl/soap/binding.rb +50 -0
- data/vendor/soap4r/wsdl/soap/body.rb +59 -0
- data/vendor/soap4r/wsdl/soap/cgi_stub_creator.rb +93 -0
- data/vendor/soap4r/wsdl/soap/class_def_creator.rb +437 -0
- data/vendor/soap4r/wsdl/soap/class_def_creator_support.rb +241 -0
- data/vendor/soap4r/wsdl/soap/class_name_creator.rb +55 -0
- data/vendor/soap4r/wsdl/soap/client_skelton_creator.rb +107 -0
- data/vendor/soap4r/wsdl/soap/complex_type.rb +174 -0
- data/vendor/soap4r/wsdl/soap/data.rb +43 -0
- data/vendor/soap4r/wsdl/soap/definitions.rb +201 -0
- data/vendor/soap4r/wsdl/soap/driver_creator.rb +121 -0
- data/vendor/soap4r/wsdl/soap/element.rb +34 -0
- data/vendor/soap4r/wsdl/soap/encoded_mapping_registry_creator.rb +74 -0
- data/vendor/soap4r/wsdl/soap/fault.rb +57 -0
- data/vendor/soap4r/wsdl/soap/header.rb +87 -0
- data/vendor/soap4r/wsdl/soap/headerfault.rb +57 -0
- data/vendor/soap4r/wsdl/soap/literal_mapping_registry_creator.rb +116 -0
- data/vendor/soap4r/wsdl/soap/mapping_registry_creator.rb +59 -0
- data/vendor/soap4r/wsdl/soap/mapping_registry_creator_support.rb +377 -0
- data/vendor/soap4r/wsdl/soap/method_def_creator.rb +200 -0
- data/vendor/soap4r/wsdl/soap/operation.rb +113 -0
- data/vendor/soap4r/wsdl/soap/servant_skelton_creator.rb +92 -0
- data/vendor/soap4r/wsdl/soap/servlet_stub_creator.rb +105 -0
- data/vendor/soap4r/wsdl/soap/standalone_server_stub_creator.rb +101 -0
- data/vendor/soap4r/wsdl/soap/wsdl2ruby.rb +226 -0
- data/vendor/soap4r/wsdl/types.rb +45 -0
- data/vendor/soap4r/wsdl/wsdl.rb +25 -0
- data/vendor/soap4r/wsdl/xml_schema/all.rb +25 -0
- data/vendor/soap4r/wsdl/xml_schema/annotation.rb +35 -0
- data/vendor/soap4r/wsdl/xml_schema/any.rb +62 -0
- data/vendor/soap4r/wsdl/xml_schema/any_attribute.rb +49 -0
- data/vendor/soap4r/wsdl/xml_schema/attribute.rb +105 -0
- data/vendor/soap4r/wsdl/xml_schema/attribute_group.rb +69 -0
- data/vendor/soap4r/wsdl/xml_schema/choice.rb +59 -0
- data/vendor/soap4r/wsdl/xml_schema/complex_content.rb +98 -0
- data/vendor/soap4r/wsdl/xml_schema/complex_extension.rb +120 -0
- data/vendor/soap4r/wsdl/xml_schema/complex_restriction.rb +105 -0
- data/vendor/soap4r/wsdl/xml_schema/complex_type.rb +194 -0
- data/vendor/soap4r/wsdl/xml_schema/content.rb +96 -0
- data/vendor/soap4r/wsdl/xml_schema/data.rb +117 -0
- data/vendor/soap4r/wsdl/xml_schema/element.rb +154 -0
- data/vendor/soap4r/wsdl/xml_schema/enumeration.rb +37 -0
- data/vendor/soap4r/wsdl/xml_schema/fractiondigits.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/group.rb +101 -0
- data/vendor/soap4r/wsdl/xml_schema/import.rb +54 -0
- data/vendor/soap4r/wsdl/xml_schema/import_handler.rb +46 -0
- data/vendor/soap4r/wsdl/xml_schema/importer.rb +103 -0
- data/vendor/soap4r/wsdl/xml_schema/include.rb +49 -0
- data/vendor/soap4r/wsdl/xml_schema/length.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/list.rb +49 -0
- data/vendor/soap4r/wsdl/xml_schema/maxexclusive.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/maxinclusive.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/maxlength.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/minexclusive.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/mininclusive.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/minlength.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/parser.rb +168 -0
- data/vendor/soap4r/wsdl/xml_schema/pattern.rb +37 -0
- data/vendor/soap4r/wsdl/xml_schema/ref.rb +34 -0
- data/vendor/soap4r/wsdl/xml_schema/schema.rb +179 -0
- data/vendor/soap4r/wsdl/xml_schema/sequence.rb +55 -0
- data/vendor/soap4r/wsdl/xml_schema/simple_content.rb +70 -0
- data/vendor/soap4r/wsdl/xml_schema/simple_extension.rb +63 -0
- data/vendor/soap4r/wsdl/xml_schema/simple_restriction.rb +133 -0
- data/vendor/soap4r/wsdl/xml_schema/simple_type.rb +88 -0
- data/vendor/soap4r/wsdl/xml_schema/totaldigits.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/union.rb +36 -0
- data/vendor/soap4r/wsdl/xml_schema/unique.rb +35 -0
- data/vendor/soap4r/wsdl/xml_schema/whitespace.rb +38 -0
- data/vendor/soap4r/wsdl/xml_schema/xsd2ruby.rb +176 -0
- data/vendor/soap4r/xsd/charset.rb +190 -0
- data/vendor/soap4r/xsd/codegen.rb +13 -0
- data/vendor/soap4r/xsd/codegen/classdef.rb +209 -0
- data/vendor/soap4r/xsd/codegen/commentdef.rb +35 -0
- data/vendor/soap4r/xsd/codegen/gensupport.rb +277 -0
- data/vendor/soap4r/xsd/codegen/methoddef.rb +71 -0
- data/vendor/soap4r/xsd/codegen/moduledef.rb +209 -0
- data/vendor/soap4r/xsd/datatypes.rb +1466 -0
- data/vendor/soap4r/xsd/datatypes1999.rb +21 -0
- data/vendor/soap4r/xsd/iconvcharset.rb +34 -0
- data/vendor/soap4r/xsd/mapping.rb +69 -0
- data/vendor/soap4r/xsd/namedelements.rb +133 -0
- data/vendor/soap4r/xsd/ns.rb +183 -0
- data/vendor/soap4r/xsd/qname.rb +80 -0
- data/vendor/soap4r/xsd/xmlparser.rb +77 -0
- data/vendor/soap4r/xsd/xmlparser/libxmlparser.rb +116 -0
- data/vendor/soap4r/xsd/xmlparser/parser.rb +101 -0
- data/vendor/soap4r/xsd/xmlparser/rexmlparser.rb +59 -0
- data/vendor/soap4r/xsd/xmlparser/xmlparser.rb +51 -0
- data/vendor/soap4r/xsd/xmlparser/xmlscanner.rb +150 -0
- metadata +316 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
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/mapping_registry_creator'
|
12
|
+
require 'wsdl/soap/method_def_creator'
|
13
|
+
require 'wsdl/soap/class_def_creator_support'
|
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,226 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
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 'xsd/qname'
|
12
|
+
require 'wsdl/importer'
|
13
|
+
require 'wsdl/soap/class_def_creator'
|
14
|
+
require 'wsdl/soap/servant_skelton_creator'
|
15
|
+
require 'wsdl/soap/driver_creator'
|
16
|
+
require 'wsdl/soap/client_skelton_creator'
|
17
|
+
require 'wsdl/soap/standalone_server_stub_creator'
|
18
|
+
require 'wsdl/soap/servlet_stub_creator'
|
19
|
+
require 'wsdl/soap/cgi_stub_creator'
|
20
|
+
require 'wsdl/soap/class_name_creator'
|
21
|
+
|
22
|
+
|
23
|
+
module WSDL
|
24
|
+
module SOAP
|
25
|
+
|
26
|
+
|
27
|
+
class WSDL2Ruby
|
28
|
+
attr_accessor :location
|
29
|
+
attr_reader :opt
|
30
|
+
attr_accessor :logger
|
31
|
+
attr_accessor :basedir
|
32
|
+
|
33
|
+
def run
|
34
|
+
unless @location
|
35
|
+
raise RuntimeError, "WSDL location not given"
|
36
|
+
end
|
37
|
+
@wsdl = import(@location)
|
38
|
+
if @opt['classdef']
|
39
|
+
@name = @opt['classdef']
|
40
|
+
else
|
41
|
+
@name = @wsdl.name ? @wsdl.name.name : 'default'
|
42
|
+
end
|
43
|
+
create_file
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def initialize
|
49
|
+
@modulepath = nil
|
50
|
+
@location = nil
|
51
|
+
@opt = {}
|
52
|
+
@logger = Logger.new(STDERR)
|
53
|
+
@basedir = nil
|
54
|
+
@wsdl = nil
|
55
|
+
@name = nil
|
56
|
+
@classdef_filename = nil
|
57
|
+
@mr_filename = nil
|
58
|
+
@name_creator = ClassNameCreator.new
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_file
|
62
|
+
@modulepath = @opt['module_path']
|
63
|
+
create_classdef if @opt.key?('classdef')
|
64
|
+
create_mapping_registry if @opt.key?('mapping_registry')
|
65
|
+
create_servant_skelton(@opt['servant_skelton']) if @opt.key?('servant_skelton')
|
66
|
+
create_cgi_stub(@opt['cgi_stub']) if @opt.key?('cgi_stub')
|
67
|
+
create_standalone_server_stub(@opt['standalone_server_stub']) if @opt.key?('standalone_server_stub')
|
68
|
+
create_servlet_stub(@opt['servlet_stub']) if @opt.key?('servlet_stub')
|
69
|
+
create_driver(@opt['driver'], @opt['drivername_postfix'] || '') if @opt.key?('driver')
|
70
|
+
create_client_skelton(@opt['client_skelton']) if @opt.key?('client_skelton')
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_classdef
|
74
|
+
@logger.info { "Creating class definition." }
|
75
|
+
@classdef_filename = @name + '.rb'
|
76
|
+
check_file(@classdef_filename) or return
|
77
|
+
write_file(@classdef_filename) do |f|
|
78
|
+
f.puts "# encoding: ASCII-8BIT"
|
79
|
+
f << WSDL::SOAP::ClassDefCreator.new(@wsdl, @name_creator, @modulepath).dump
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def create_mapping_registry
|
84
|
+
@logger.info { "Creating mapping registry definition." }
|
85
|
+
@mr_filename = @name + 'MappingRegistry.rb'
|
86
|
+
check_file(@mr_filename) or return
|
87
|
+
write_file(@mr_filename) do |f|
|
88
|
+
f.puts "# encoding: ASCII-8BIT"
|
89
|
+
f << "require '#{@classdef_filename}'\n" if @classdef_filename
|
90
|
+
f << WSDL::SOAP::MappingRegistryCreator.new(@wsdl, @name_creator, @modulepath).dump
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def create_client_skelton(servicename)
|
95
|
+
return if @wsdl.services.empty?
|
96
|
+
@logger.info { "Creating client skelton." }
|
97
|
+
servicename ||= @wsdl.services[0].name.name
|
98
|
+
@client_skelton_filename = servicename + 'Client.rb'
|
99
|
+
check_file(@client_skelton_filename) or return
|
100
|
+
write_file(@client_skelton_filename) do |f|
|
101
|
+
f << shbang << "\n"
|
102
|
+
f.puts "# encoding: ASCII-8BIT"
|
103
|
+
f << "require '#{@driver_filename}'\n\n" if @driver_filename
|
104
|
+
f << WSDL::SOAP::ClientSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def create_servant_skelton(porttypename)
|
109
|
+
@logger.info { "Creating servant skelton." }
|
110
|
+
@servant_skelton_filename = (porttypename || @name + 'Servant') + '.rb'
|
111
|
+
check_file(@servant_skelton_filename) or return
|
112
|
+
write_file(@servant_skelton_filename) do |f|
|
113
|
+
f.puts "# encoding: ASCII-8BIT"
|
114
|
+
f << "require '#{@classdef_filename}'\n\n" if @classdef_filename
|
115
|
+
f << WSDL::SOAP::ServantSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(porttypename))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def create_cgi_stub(servicename)
|
120
|
+
@logger.info { "Creating CGI stub." }
|
121
|
+
servicename ||= @wsdl.services[0].name.name
|
122
|
+
@cgi_stubFilename = servicename + '.cgi'
|
123
|
+
check_file(@cgi_stubFilename) or return
|
124
|
+
write_file(@cgi_stubFilename) do |f|
|
125
|
+
f << shbang << "\n"
|
126
|
+
f.puts "# encoding: ASCII-8BIT"
|
127
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
128
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
129
|
+
f << WSDL::SOAP::CGIStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def create_standalone_server_stub(servicename)
|
134
|
+
@logger.info { "Creating standalone stub." }
|
135
|
+
servicename ||= @wsdl.services[0].name.name
|
136
|
+
@standalone_server_stub_filename = servicename + '.rb'
|
137
|
+
check_file(@standalone_server_stub_filename) or return
|
138
|
+
write_file(@standalone_server_stub_filename) do |f|
|
139
|
+
f << shbang << "\n"
|
140
|
+
f.puts "# encoding: ASCII-8BIT"
|
141
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
142
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
143
|
+
f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def create_servlet_stub(servicename)
|
148
|
+
@logger.info { "Creating servlet stub." }
|
149
|
+
servicename ||= @wsdl.services[0].name.name
|
150
|
+
@servlet_stub_filename = servicename + 'Servlet.rb'
|
151
|
+
check_file(@servlet_stub_filename) or return
|
152
|
+
write_file(@servlet_stub_filename) do |f|
|
153
|
+
f << shbang << "\n"
|
154
|
+
f.puts "# encoding: ASCII-8BIT"
|
155
|
+
f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
|
156
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
157
|
+
f << WSDL::SOAP::ServletStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def create_driver(porttypename, drivername_postfix)
|
162
|
+
@logger.info { "Creating driver." }
|
163
|
+
@driver_filename = (porttypename || @name) + 'Driver.rb'
|
164
|
+
creator = WSDL::SOAP::DriverCreator.new(@wsdl, @name_creator, @modulepath)
|
165
|
+
creator.drivername_postfix = drivername_postfix
|
166
|
+
check_file(@driver_filename) or return
|
167
|
+
write_file(@driver_filename) do |f|
|
168
|
+
f.puts "# encoding: ASCII-8BIT"
|
169
|
+
f << "require '#{@classdef_filename}'\n" if @classdef_filename
|
170
|
+
f << "require '#{@mr_filename}'\n" if @mr_filename
|
171
|
+
f << creator.dump(create_name(porttypename))
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def write_file(filename)
|
176
|
+
if @basedir
|
177
|
+
filename = File.join(basedir, filename)
|
178
|
+
end
|
179
|
+
File.open(filename, "w") do |f|
|
180
|
+
yield f
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def check_file(filename)
|
185
|
+
if @basedir
|
186
|
+
filename = File.join(basedir, filename)
|
187
|
+
end
|
188
|
+
if FileTest.exist?(filename)
|
189
|
+
if @opt.key?('force')
|
190
|
+
@logger.warn {
|
191
|
+
"File '#{filename}' exists but overrides it."
|
192
|
+
}
|
193
|
+
true
|
194
|
+
else
|
195
|
+
@logger.warn {
|
196
|
+
"File '#{filename}' exists. #{$0} did not override it."
|
197
|
+
}
|
198
|
+
false
|
199
|
+
end
|
200
|
+
else
|
201
|
+
@logger.info { "Creates file '#{filename}'." }
|
202
|
+
true
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def shbang
|
207
|
+
"#!/usr/bin/env ruby"
|
208
|
+
end
|
209
|
+
|
210
|
+
def create_name(name)
|
211
|
+
name ? XSD::QName.new(@wsdl.targetnamespace, name) : nil
|
212
|
+
end
|
213
|
+
|
214
|
+
def import(location)
|
215
|
+
WSDL::Importer.import(location)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
if __FILE__ == $0
|
225
|
+
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.")
|
226
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
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: ASCII-8BIT
|
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/xml_schema/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: ASCII-8BIT
|
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
|