File: expectedService.rb

package info (click to toggle)
jruby 1.5.6-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 43,808 kB
  • sloc: ruby: 398,491; java: 170,144; yacc: 3,782; xml: 2,529; sh: 299; tcl: 40; makefile: 28; ansic: 23
file content (52 lines) | stat: -rw-r--r-- 1,422 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env ruby
require 'echoServant.rb'

require 'soap/rpc/standaloneServer'
require 'soap/mapping/registry'

class Echo_port_type
  MappingRegistry = ::SOAP::Mapping::Registry.new

  MappingRegistry.set(
    FooBar,
    ::SOAP::SOAPStruct,
    ::SOAP::Mapping::Registry::TypedStructFactory,
    { :type => XSD::QName.new("urn:example.com:echo-type", "foo.bar") }
  )

  Methods = [
    [ XSD::QName.new("urn:example.com:echo", "echo"),
      "urn:example.com:echo",
      "echo",
      [ ["in", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]],
        ["retval", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]] ],
      { :request_style =>  :rpc, :request_use =>  :encoded,
        :response_style => :rpc, :response_use => :encoded }
    ]
  ]
end

class Echo_port_typeApp < ::SOAP::RPC::StandaloneServer
  def initialize(*arg)
    super(*arg)
    servant = Echo_port_type.new
    Echo_port_type::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 = Echo_port_type::MappingRegistry
  end
end

if $0 == __FILE__
  # Change listen port.
  server = Echo_port_typeApp.new('app', nil, '0.0.0.0', 10080)
  trap(:INT) do
    server.shutdown
  end
  server.start
end