Class WSDL::SOAP::StandaloneServerStubCreator
In: lib/wsdl/soap/standaloneServerStubCreator.rb
Parent: Object

Methods

dump   dump_porttype   new  

Included Modules

ClassDefCreatorSupport

Attributes

definitions  [R] 

Public Class methods

[Source]

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

Public Instance methods

[Source]

    # File lib/wsdl/soap/standaloneServerStubCreator.rb, line 28
28:   def dump(service_name)
29:     warn("- Standalone stub can have only 1 port for now.  So creating stub for the first port and rests are ignored.")
30:     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.")
31:     port = @definitions.service(service_name).ports[0]
32:     dump_porttype(port.porttype.name)
33:   end

Private Instance methods

[Source]

    # File lib/wsdl/soap/standaloneServerStubCreator.rb, line 37
37:   def dump_porttype(name)
38:     class_name = create_class_name(name)
39:     methoddef, types = MethodDefCreator.new(@definitions).dump(name)
40:     mr_creator = MappingRegistryCreator.new(@definitions)
41: 
42:     c1 = XSD::CodeGen::ClassDef.new(class_name)
43:     c1.def_require("soap/rpc/standaloneServer")
44:     c1.def_require("soap/mapping/registry")
45:     c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
46:     c1.def_code(mr_creator.dump(types))
47:     c1.def_code "Methods = [\n\#{methoddef.gsub(/^/, \"  \")}\n]\n"
48:     c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
49:       "::SOAP::RPC::StandaloneServer")
50:     c2.def_method("initialize", "*arg") do
51:       "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\n"
52:     end
53:     c1.dump + "\n" + c2.dump + format("\nif $0 == __FILE__\n# Change listen port.\nserver = \#{class_name}App.new('app', nil, '0.0.0.0', 10080)\ntrap(:INT) do\nserver.shutdown\nend\nserver.start\nend\n")
54:   end

[Validate]