Class WSDL::SOAP::CGIStubCreator
In: lib/wsdl/soap/cgiStubCreator.rb
Parent: Object

Methods

dump   dump_porttype   new  

Included Modules

ClassDefCreatorSupport

Attributes

definitions  [R] 

Public Class methods

[Source]

    # File lib/wsdl/soap/cgiStubCreator.rb, line 24
24:   def initialize(definitions)
25:     @definitions = definitions
26:   end

Public Instance methods

[Source]

    # File lib/wsdl/soap/cgiStubCreator.rb, line 28
28:   def dump(service_name)
29:     warn("CGI stub can have only 1 port.  Creating stub for the first port...  Rests are ignored.")
30:     port = @definitions.service(service_name).ports[0]
31:     dump_porttype(port.porttype.name)
32:   end

Private Instance methods

[Source]

    # File lib/wsdl/soap/cgiStubCreator.rb, line 36
36:   def dump_porttype(name)
37:     class_name = create_class_name(name)
38:     methoddef, types = MethodDefCreator.new(@definitions).dump(name)
39:     mr_creator = MappingRegistryCreator.new(@definitions)
40:     c1 = XSD::CodeGen::ClassDef.new(class_name)
41:     c1.def_require("soap/rpc/cgistub")
42:     c1.def_require("soap/mapping/registry")
43:     c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
44:     c1.def_code(mr_creator.dump(types))
45:     c1.def_code "Methods = [\n\#{methoddef.gsub(/^/, \"  \")}\n]\n"
46:     c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
47:       "::SOAP::RPC::CGIStub")
48:     c2.def_method("initialize", "*arg") do
49:       "super(*arg)\nservant = \#{class_name}.new\n\#{class_name}::Methods.each do |definitions|\nopt = definitions.last\nif opt[:request_style] == :document\n@router.add_document_operation(servant, *definitions)\nelse\n@router.add_rpc_operation(servant, *definitions)\nend\nend\nself.mapping_registry = \#{class_name}::MappingRegistry\nself.level = Logger::Severity::ERROR\n"
50:     end
51:     c1.dump + "\n" + c2.dump + format("\#{class_name}App.new('app', nil).start\n")
52:   end

[Validate]