|
Revision 1967, 1.0 kB
(checked in by nahi, 1 year ago)
|
|
| Line | |
|---|
| 1 |
# SOAP4R - SOAP Mapping header item handler |
|---|
| 2 |
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. |
|---|
| 3 |
|
|---|
| 4 |
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can |
|---|
| 5 |
# redistribute it and/or modify it under the same terms of Ruby's license; |
|---|
| 6 |
# either the dual license version in 2003, or any later version. |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
require 'soap/header/handler' |
|---|
| 10 |
require 'soap/mapping/mapping' |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
module SOAP |
|---|
| 14 |
module Header |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
class MappingHandler < SOAP::Header::Handler |
|---|
| 18 |
attr_accessor :registry |
|---|
| 19 |
|
|---|
| 20 |
def initialize(elename, registry = nil) |
|---|
| 21 |
super(elename) |
|---|
| 22 |
@registry = registry |
|---|
| 23 |
end |
|---|
| 24 |
|
|---|
| 25 |
# Should return an Object for mapping |
|---|
| 26 |
def on_mapping_outbound |
|---|
| 27 |
nil |
|---|
| 28 |
end |
|---|
| 29 |
|
|---|
| 30 |
# Given header is a mapped Object |
|---|
| 31 |
def on_mapping_inbound(obj, mustunderstand) |
|---|
| 32 |
end |
|---|
| 33 |
|
|---|
| 34 |
def on_outbound |
|---|
| 35 |
obj = on_mapping_outbound |
|---|
| 36 |
obj ? SOAP::Mapping.obj2soap(obj, @registry, @elename) : nil |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
def on_inbound(header, mustunderstand) |
|---|
| 40 |
obj = SOAP::Mapping.soap2obj(header, @registry) |
|---|
| 41 |
on_mapping_inbound(obj, mustunderstand) |
|---|
| 42 |
end |
|---|
| 43 |
end |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
end |
|---|
| 47 |
end |
|---|