Sha256: b7e397cf36e488ac9facdcf55fca5b74514b78e3cebf2df283bf9f3ab5e274c9
Contents?: true
Size: 940 Bytes
Versions: 7
Compression:
Stored size: 940 Bytes
Contents
require 'soap/rpc/driver' class ClientFilter1 < SOAP::Filter::Handler # 1 -> 2 def on_outbound(envelope, opt) param = envelope.body.root_node.inparam param["amt"] = SOAP::SOAPInt.new(param["amt"].data + 1) param["amt"].elename = XSD::QName.new(nil, 'amt') envelope end # 31 -> 32 def on_inbound(xml, opt) xml = xml.sub(/31/, '32') xml end end class ClientFilter2 < SOAP::Filter::Handler # 2 -> 4 def on_outbound(envelope, opt) param = envelope.body.root_node.inparam param["amt"] = SOAP::SOAPInt.new(param["amt"].data * 2) param["amt"].elename = XSD::QName.new(nil, 'amt') envelope end # 30 -> 31 def on_inbound(xml, opt) xml = xml.sub(/30/, '31') xml end end client = SOAP::RPC::Driver.new("http://localhost:7171", "urn:filter") client.add_method('echo', 'amt') client.filterchain << ClientFilter1.new client.filterchain << ClientFilter2.new p client.echo(1)
Version data entries
7 entries across 7 versions & 2 rubygems