Parent

Included Modules

Files

Class Index [+]

Quicksearch

WSDL::SOAP::StandaloneServerStubCreator

Attributes

definitions[R]

Public Class Methods

new(definitions, name_creator, modulepath = nil) click to toggle source
    # File lib/wsdl/soap/standaloneServerStubCreator.rb, line 24
24:   def initialize(definitions, name_creator, modulepath = nil)
25:     @definitions = definitions
26:     @name_creator = name_creator
27:     @modulepath = modulepath
28:   end

Public Instance Methods

dump(service_name) click to toggle source
    # File lib/wsdl/soap/standaloneServerStubCreator.rb, line 30
30:   def dump(service_name)
31:     warn("- Standalone stub can have only 1 port for now.  So creating stub for the first port and rests are ignored.")
32:     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.")
33:     services = @definitions.service(service_name)
34:     unless services
35:       raise RuntimeError.new("service not defined: #{service_name}")
36:     end
37:     ports = services.ports
38:     if ports.empty?
39:       raise RuntimeError.new("ports not found for #{service_name}")
40:     end
41:     port = ports[0]
42:     if port.porttype.nil?
43:       raise RuntimeError.new("porttype not found for #{port}")
44:     end
45:     dump_porttype(port.porttype)
46:   end

Private Instance Methods

dump_porttype(porttype) click to toggle source
    # File lib/wsdl/soap/standaloneServerStubCreator.rb, line 50
50:   def dump_porttype(porttype)
51:     class_name = mapped_class_name(porttype.name, @modulepath)
52:     defined_const = {}
53:     result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
54:     methoddef = result[:methoddef]
55: 
56:     wsdl_name = @definitions.name ? @definitions.name.name : 'default'
57:     mrname = safeconstname(wsdl_name + 'MappingRegistry')
58:     
59:     c1 = XSD::CodeGen::ClassDef.new(class_name)
60:     c1.def_require("soap/rpc/standaloneServer")
61:     c1.def_code Methods = [#{methoddef.gsub(/^/, "  ")}]
62:     defined_const.each do |ns, tag|
63:       c1.def_const(tag, dq(ns))
64:     end
65:     c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
66:       "::SOAP::RPC::StandaloneServer")
67:     c2.def_method("initialize", "*arg") do
68:               super(*arg)        servant = #{class_name}.new        #{class_name}::Methods.each do |definitions|          opt = definitions.last          if opt[:request_style] == :document            @router.add_document_operation(servant, *definitions)          else            @router.add_rpc_operation(servant, *definitions)          end        end        self.mapping_registry = #{mrname}::EncodedRegistry        self.literal_mapping_registry = #{mrname}::LiteralRegistry
69:     end
70:     c1.dump + "\n" + c2.dump + format(      if $0 == __FILE__        # Change listen port.        server = #{class_name}App.new('app', nil, '0.0.0.0', 10080)        trap(:INT) do          server.shutdown        end        server.start      end)
71:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.