| 1 |
require 'classDef' |
|---|
| 2 |
require 'soap/proxy' |
|---|
| 3 |
require 'soap/rpcUtils' |
|---|
| 4 |
require 'soap/streamHandler' |
|---|
| 5 |
|
|---|
| 6 |
class Sm11PortType |
|---|
| 7 |
MappingRegistry = SOAP::RPCUtils::MappingRegistry.new |
|---|
| 8 |
|
|---|
| 9 |
MappingRegistry.set( |
|---|
| 10 |
C_struct, |
|---|
| 11 |
::SOAP::SOAPStruct, |
|---|
| 12 |
::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, |
|---|
| 13 |
[ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] |
|---|
| 14 |
) |
|---|
| 15 |
MappingRegistry.set( |
|---|
| 16 |
ArrayOfboolean, |
|---|
| 17 |
::SOAP::SOAPArray, |
|---|
| 18 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 19 |
[ "http://www.w3.org/2001/XMLSchema", "boolean" ] |
|---|
| 20 |
) |
|---|
| 21 |
MappingRegistry.set( |
|---|
| 22 |
ArrayOfshort, |
|---|
| 23 |
::SOAP::SOAPArray, |
|---|
| 24 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 25 |
[ "http://www.w3.org/2001/XMLSchema", "short" ] |
|---|
| 26 |
) |
|---|
| 27 |
MappingRegistry.set( |
|---|
| 28 |
ArrayOfint, |
|---|
| 29 |
::SOAP::SOAPArray, |
|---|
| 30 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 31 |
[ "http://www.w3.org/2001/XMLSchema", "int" ] |
|---|
| 32 |
) |
|---|
| 33 |
MappingRegistry.set( |
|---|
| 34 |
ArrayOflong, |
|---|
| 35 |
::SOAP::SOAPArray, |
|---|
| 36 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 37 |
[ "http://www.w3.org/2001/XMLSchema", "long" ] |
|---|
| 38 |
) |
|---|
| 39 |
MappingRegistry.set( |
|---|
| 40 |
ArrayOffloat, |
|---|
| 41 |
::SOAP::SOAPArray, |
|---|
| 42 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 43 |
[ "http://www.w3.org/2001/XMLSchema", "float" ] |
|---|
| 44 |
) |
|---|
| 45 |
MappingRegistry.set( |
|---|
| 46 |
ArrayOfdouble, |
|---|
| 47 |
::SOAP::SOAPArray, |
|---|
| 48 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 49 |
[ "http://www.w3.org/2001/XMLSchema", "double" ] |
|---|
| 50 |
) |
|---|
| 51 |
MappingRegistry.set( |
|---|
| 52 |
ArrayOfstring, |
|---|
| 53 |
::SOAP::SOAPArray, |
|---|
| 54 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 55 |
[ "http://www.w3.org/2001/XMLSchema", "string" ] |
|---|
| 56 |
) |
|---|
| 57 |
MappingRegistry.set( |
|---|
| 58 |
F_struct, |
|---|
| 59 |
::SOAP::SOAPStruct, |
|---|
| 60 |
::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, |
|---|
| 61 |
[ "http://dopg.gr.jp/sm11.xsd", "F_struct" ] |
|---|
| 62 |
) |
|---|
| 63 |
MappingRegistry.set( |
|---|
| 64 |
ArrayOfC_struct, |
|---|
| 65 |
::SOAP::SOAPArray, |
|---|
| 66 |
::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, |
|---|
| 67 |
[ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] |
|---|
| 68 |
) |
|---|
| 69 |
|
|---|
| 70 |
Methods = [ |
|---|
| 71 |
[ "op0", "op0", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 72 |
[ "op1", "op1", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 73 |
[ "op4", "op4", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 74 |
[ "op5", "op5", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 75 |
[ "op6", "op6", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 76 |
[ "op7", "op7", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 77 |
[ "op8", "op8", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 78 |
[ "op9", "op9", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 79 |
[ "op11", "op11", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 80 |
[ "op14", "op14", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 81 |
[ "op15", "op15", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 82 |
[ "op16", "op16", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 83 |
[ "op17", "op17", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 84 |
[ "op18", "op18", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 85 |
[ "op19", "op19", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 86 |
[ "op21", "op21", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 87 |
[ "op24", "op24", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 88 |
[ "op25", "op25", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 89 |
[ "op26", "op26", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 90 |
[ "op27", "op27", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 91 |
[ "op28", "op28", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 92 |
[ "op29", "op29", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 93 |
[ "op30", "op30", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 94 |
[ "op31", "op31", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 95 |
[ "op34", "op34", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 96 |
[ "op35", "op35", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 97 |
[ "op36", "op36", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 98 |
[ "op37", "op37", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 99 |
[ "op38", "op38", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 100 |
[ "op39", "op39", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 101 |
[ "op40", "op40", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "in", "arg3" ], [ "in", "arg4" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 102 |
[ "op41", "op41", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 103 |
[ "op42", "op42", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 104 |
[ "op43", "op43", [ [ "in", "arg0" ], [ "in", "arg1" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 105 |
[ "excop1", "excop1", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 106 |
[ "excop2", "excop2", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 107 |
[ "excop3", "excop3", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], |
|---|
| 108 |
[ "excop4", "excop4", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ] |
|---|
| 109 |
] |
|---|
| 110 |
|
|---|
| 111 |
attr_reader :endpointUrl |
|---|
| 112 |
attr_reader :proxyUrl |
|---|
| 113 |
|
|---|
| 114 |
def initialize( endpointUrl, proxyUrl = nil ) |
|---|
| 115 |
@endpointUrl = endpointUrl |
|---|
| 116 |
@proxyUrl = proxyUrl |
|---|
| 117 |
@httpStreamHandler = SOAP::HTTPPostStreamHandler.new( @endpointUrl, |
|---|
| 118 |
@proxyUrl ) |
|---|
| 119 |
@proxy = SOAP::SOAPProxy.new( nil, @httpStreamHandler, nil ) |
|---|
| 120 |
@proxy.allowUnqualifiedElement = true |
|---|
| 121 |
@mappingRegistry = MappingRegistry |
|---|
| 122 |
addMethod |
|---|
| 123 |
end |
|---|
| 124 |
|
|---|
| 125 |
def setWireDumpDev( dumpDev ) |
|---|
| 126 |
@httpStreamHandler.dumpDev = dumpDev |
|---|
| 127 |
end |
|---|
| 128 |
|
|---|
| 129 |
def setDefaultEncodingStyle( encodingStyle ) |
|---|
| 130 |
@proxy.defaultEncodingStyle = encodingStyle |
|---|
| 131 |
end |
|---|
| 132 |
|
|---|
| 133 |
def getDefaultEncodingStyle |
|---|
| 134 |
@proxy.defaultEncodingStyle |
|---|
| 135 |
end |
|---|
| 136 |
|
|---|
| 137 |
def call( methodName, *params ) |
|---|
| 138 |
# Convert parameters |
|---|
| 139 |
params.collect! { | param | |
|---|
| 140 |
SOAP::RPCUtils.obj2soap( param, @mappingRegistry ) |
|---|
| 141 |
} |
|---|
| 142 |
|
|---|
| 143 |
# Then, call @proxy.call like the following. |
|---|
| 144 |
header, body = @proxy.call( nil, methodName, *params ) |
|---|
| 145 |
|
|---|
| 146 |
# Check Fault. |
|---|
| 147 |
begin |
|---|
| 148 |
@proxy.checkFault( body ) |
|---|
| 149 |
rescue SOAP::FaultError => e |
|---|
| 150 |
SOAP::RPCUtils.fault2exception( e, @mappingRegistry ) |
|---|
| 151 |
end |
|---|
| 152 |
|
|---|
| 153 |
ret = body.response ? |
|---|
| 154 |
SOAP::RPCUtils.soap2obj( body.response, @mappingRegistry ) : nil |
|---|
| 155 |
if body.outParams |
|---|
| 156 |
outParams = body.outParams.collect { | outParam | |
|---|
| 157 |
SOAP::RPCUtils.soap2obj( outParam ) |
|---|
| 158 |
} |
|---|
| 159 |
return [ ret ].concat( outParams ) |
|---|
| 160 |
else |
|---|
| 161 |
return ret |
|---|
| 162 |
end |
|---|
| 163 |
end |
|---|
| 164 |
|
|---|
| 165 |
private |
|---|
| 166 |
|
|---|
| 167 |
def addMethod |
|---|
| 168 |
Methods.each do | methodNameAs, methodName, params, soapAction, namespace | |
|---|
| 169 |
@proxy.addMethodAs( methodNameAs, methodName, params, soapAction, |
|---|
| 170 |
namespace ) |
|---|
| 171 |
addMethodInterface( methodNameAs, params ) |
|---|
| 172 |
end |
|---|
| 173 |
end |
|---|
| 174 |
|
|---|
| 175 |
def addMethodInterface( name, params ) |
|---|
| 176 |
self.instance_eval <<-EOD |
|---|
| 177 |
def #{ name }( *params ) |
|---|
| 178 |
call( "#{ name }", *params ) |
|---|
| 179 |
end |
|---|
| 180 |
EOD |
|---|
| 181 |
end |
|---|
| 182 |
end |
|---|
| 183 |
|
|---|