|
Revision 1824, 1.6 kB
(checked in by nahi, 2 years ago)
|
- Copyright notice updated. add '2000-2007' uniformly.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
author date id revision
|
| Line | |
|---|
| 1 |
# WSDL4R - WSDL SOAP body definition. |
|---|
| 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 'wsdl/info' |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
module WSDL |
|---|
| 13 |
module SOAP |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
class Header < Info |
|---|
| 17 |
attr_reader :headerfault |
|---|
| 18 |
|
|---|
| 19 |
attr_reader :message # required |
|---|
| 20 |
attr_reader :part # required |
|---|
| 21 |
attr_reader :use # required |
|---|
| 22 |
attr_reader :encodingstyle |
|---|
| 23 |
attr_reader :namespace |
|---|
| 24 |
|
|---|
| 25 |
def initialize |
|---|
| 26 |
super |
|---|
| 27 |
@message = nil |
|---|
| 28 |
@part = nil |
|---|
| 29 |
@use = nil |
|---|
| 30 |
@encodingstyle = nil |
|---|
| 31 |
@namespace = nil |
|---|
| 32 |
@headerfault = nil |
|---|
| 33 |
end |
|---|
| 34 |
|
|---|
| 35 |
def targetnamespace |
|---|
| 36 |
parent.targetnamespace |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
def find_message |
|---|
| 40 |
root.message(@message) or raise RuntimeError.new("#{@message} not found") |
|---|
| 41 |
end |
|---|
| 42 |
|
|---|
| 43 |
def find_part |
|---|
| 44 |
find_message.parts.each do |part| |
|---|
| 45 |
if part.name == @part |
|---|
| 46 |
return part |
|---|
| 47 |
end |
|---|
| 48 |
end |
|---|
| 49 |
raise RuntimeError.new("#{@part} not found") |
|---|
| 50 |
end |
|---|
| 51 |
|
|---|
| 52 |
def parse_element(element) |
|---|
| 53 |
case element |
|---|
| 54 |
when HeaderFaultName |
|---|
| 55 |
o = WSDL::SOAP::HeaderFault.new |
|---|
| 56 |
@headerfault = o |
|---|
| 57 |
o |
|---|
| 58 |
else |
|---|
| 59 |
nil |
|---|
| 60 |
end |
|---|
| 61 |
end |
|---|
| 62 |
|
|---|
| 63 |
def parse_attr(attr, value) |
|---|
| 64 |
case attr |
|---|
| 65 |
when MessageAttrName |
|---|
| 66 |
if value.namespace.nil? |
|---|
| 67 |
value = XSD::QName.new(targetnamespace, value.source) |
|---|
| 68 |
end |
|---|
| 69 |
@message = value |
|---|
| 70 |
when PartAttrName |
|---|
| 71 |
@part = value.source |
|---|
| 72 |
when UseAttrName |
|---|
| 73 |
@use = value.source |
|---|
| 74 |
when EncodingStyleAttrName |
|---|
| 75 |
@encodingstyle = value.source |
|---|
| 76 |
when NamespaceAttrName |
|---|
| 77 |
@namespace = value.source |
|---|
| 78 |
else |
|---|
| 79 |
nil |
|---|
| 80 |
end |
|---|
| 81 |
end |
|---|
| 82 |
end |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
end |
|---|
| 86 |
end |
|---|