| 1 |
#!/usr/bin/env ruby |
|---|
| 2 |
require 'soap/rpc/standaloneServer' |
|---|
| 3 |
|
|---|
| 4 |
module WSDL; module RAA |
|---|
| 5 |
|
|---|
| 6 |
class RAABaseServicePortTypeServer |
|---|
| 7 |
def getAllListings |
|---|
| 8 |
["ruby", "soap4r"] |
|---|
| 9 |
end |
|---|
| 10 |
|
|---|
| 11 |
def getProductTree |
|---|
| 12 |
raise NotImplementedError.new |
|---|
| 13 |
end |
|---|
| 14 |
|
|---|
| 15 |
def getInfoFromCategory(category) |
|---|
| 16 |
raise NotImplementedError.new |
|---|
| 17 |
end |
|---|
| 18 |
|
|---|
| 19 |
def getModifiedInfoSince(timeInstant) |
|---|
| 20 |
raise NotImplementedError.new |
|---|
| 21 |
end |
|---|
| 22 |
|
|---|
| 23 |
def getInfoFromName(productName) |
|---|
| 24 |
Info.new( |
|---|
| 25 |
Category.new("major", "minor"), |
|---|
| 26 |
Product.new(123, productName, "short description", "version", "status", |
|---|
| 27 |
URI.parse("http://example.com/homepage"), |
|---|
| 28 |
URI.parse("http://example.com/download"), |
|---|
| 29 |
"license", "description"), |
|---|
| 30 |
Owner.new(456, URI.parse("mailto:email@example.com"), "name"), |
|---|
| 31 |
Time.now, |
|---|
| 32 |
Time.now) |
|---|
| 33 |
end |
|---|
| 34 |
|
|---|
| 35 |
def getInfoFromOwnerId(ownerId) |
|---|
| 36 |
raise NotImplementedError.new |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
Methods = [ |
|---|
| 40 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getAllListings"), |
|---|
| 41 |
"", |
|---|
| 42 |
"getAllListings", |
|---|
| 43 |
[ [:retval, "return", ["WSDL::RAA::C_String[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "StringArray"]] ], |
|---|
| 44 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 45 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 46 |
:faults => {} } |
|---|
| 47 |
], |
|---|
| 48 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getProductTree"), |
|---|
| 49 |
"", |
|---|
| 50 |
"getProductTree", |
|---|
| 51 |
[ [:retval, "return", ["Hash", "http://xml.apache.org/xml-soap", "Map"]] ], |
|---|
| 52 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 53 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 54 |
:faults => {} } |
|---|
| 55 |
], |
|---|
| 56 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromCategory"), |
|---|
| 57 |
"", |
|---|
| 58 |
"getInfoFromCategory", |
|---|
| 59 |
[ [:in, "category", ["WSDL::RAA::Category", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], |
|---|
| 60 |
[:retval, "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], |
|---|
| 61 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 62 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 63 |
:faults => {} } |
|---|
| 64 |
], |
|---|
| 65 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getModifiedInfoSince"), |
|---|
| 66 |
"", |
|---|
| 67 |
"getModifiedInfoSince", |
|---|
| 68 |
[ [:in, "timeInstant", ["::SOAP::SOAPDateTime"]], |
|---|
| 69 |
[:retval, "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], |
|---|
| 70 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 71 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 72 |
:faults => {} } |
|---|
| 73 |
], |
|---|
| 74 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromName"), |
|---|
| 75 |
"", |
|---|
| 76 |
"getInfoFromName", |
|---|
| 77 |
[ [:in, "productName", ["::SOAP::SOAPString"]], |
|---|
| 78 |
[:retval, "return", ["WSDL::RAA::Info", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]] ], |
|---|
| 79 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 80 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 81 |
:faults => {} } |
|---|
| 82 |
], |
|---|
| 83 |
[ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromOwnerId"), |
|---|
| 84 |
"", |
|---|
| 85 |
"getInfoFromOwnerId", |
|---|
| 86 |
[ [:in, "ownerId", ["::SOAP::SOAPInt"]], |
|---|
| 87 |
[:retval, "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], |
|---|
| 88 |
{ :request_style => :rpc, :request_use => :encoded, |
|---|
| 89 |
:response_style => :rpc, :response_use => :encoded, |
|---|
| 90 |
:faults => {} } |
|---|
| 91 |
] |
|---|
| 92 |
] |
|---|
| 93 |
end |
|---|
| 94 |
|
|---|
| 95 |
end; end |
|---|
| 96 |
|
|---|
| 97 |
module WSDL; module RAA |
|---|
| 98 |
|
|---|
| 99 |
class RAABaseServicePortTypeApp < ::SOAP::RPC::StandaloneServer |
|---|
| 100 |
def initialize(*arg) |
|---|
| 101 |
super(*arg) |
|---|
| 102 |
servant = WSDL::RAA::RAABaseServicePortTypeServer.new |
|---|
| 103 |
WSDL::RAA::RAABaseServicePortType::Methods.each do |definitions| |
|---|
| 104 |
opt = definitions.last |
|---|
| 105 |
if opt[:request_style] == :document |
|---|
| 106 |
@router.add_document_operation(servant, *definitions) |
|---|
| 107 |
else |
|---|
| 108 |
@router.add_rpc_operation(servant, *definitions) |
|---|
| 109 |
end |
|---|
| 110 |
end |
|---|
| 111 |
self.mapping_registry = RAAMappingRegistry::EncodedRegistry |
|---|
| 112 |
self.literal_mapping_registry = RAAMappingRegistry::LiteralRegistry |
|---|
| 113 |
end |
|---|
| 114 |
end |
|---|
| 115 |
|
|---|
| 116 |
end; end |
|---|
| 117 |
|
|---|
| 118 |
if $0 == __FILE__ |
|---|
| 119 |
# Change listen port. |
|---|
| 120 |
server = WSDL::RAA::RAABaseServicePortTypeApp.new('app', nil, '0.0.0.0', 10080) |
|---|
| 121 |
trap(:INT) do |
|---|
| 122 |
server.shutdown |
|---|
| 123 |
end |
|---|
| 124 |
server.start |
|---|
| 125 |
end |
|---|