|
Revision 1824, 1.7 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 param 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 |
|
|---|
| 14 |
|
|---|
| 15 |
class Param < Info |
|---|
| 16 |
attr_reader :message # required |
|---|
| 17 |
attr_reader :name # optional but required for fault. |
|---|
| 18 |
attr_reader :soapbody |
|---|
| 19 |
attr_reader :soapheader |
|---|
| 20 |
attr_reader :soapfault |
|---|
| 21 |
|
|---|
| 22 |
def initialize |
|---|
| 23 |
super |
|---|
| 24 |
@message = nil |
|---|
| 25 |
@name = nil |
|---|
| 26 |
@soapbody = nil |
|---|
| 27 |
@soapheader = [] |
|---|
| 28 |
@soapfault = nil |
|---|
| 29 |
end |
|---|
| 30 |
|
|---|
| 31 |
def targetnamespace |
|---|
| 32 |
parent.targetnamespace |
|---|
| 33 |
end |
|---|
| 34 |
|
|---|
| 35 |
def find_message |
|---|
| 36 |
root.message(@message) or raise RuntimeError.new("#{@message} not found") |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
def soapbody_use |
|---|
| 40 |
if @soapbody |
|---|
| 41 |
@soapbody.use || :literal |
|---|
| 42 |
else |
|---|
| 43 |
nil |
|---|
| 44 |
end |
|---|
| 45 |
end |
|---|
| 46 |
|
|---|
| 47 |
def soapbody_encodingstyle |
|---|
| 48 |
if @soapbody |
|---|
| 49 |
@soapbody.encodingstyle |
|---|
| 50 |
else |
|---|
| 51 |
nil |
|---|
| 52 |
end |
|---|
| 53 |
end |
|---|
| 54 |
|
|---|
| 55 |
def parse_element(element) |
|---|
| 56 |
case element |
|---|
| 57 |
when SOAPBodyName |
|---|
| 58 |
o = WSDL::SOAP::Body.new |
|---|
| 59 |
@soapbody = o |
|---|
| 60 |
o |
|---|
| 61 |
when SOAPHeaderName |
|---|
| 62 |
o = WSDL::SOAP::Header.new |
|---|
| 63 |
@soapheader << o |
|---|
| 64 |
o |
|---|
| 65 |
when SOAPFaultName |
|---|
| 66 |
o = WSDL::SOAP::Fault.new |
|---|
| 67 |
@soapfault = o |
|---|
| 68 |
o |
|---|
| 69 |
when DocumentationName |
|---|
| 70 |
o = Documentation.new |
|---|
| 71 |
o |
|---|
| 72 |
else |
|---|
| 73 |
nil |
|---|
| 74 |
end |
|---|
| 75 |
end |
|---|
| 76 |
|
|---|
| 77 |
def parse_attr(attr, value) |
|---|
| 78 |
case attr |
|---|
| 79 |
when MessageAttrName |
|---|
| 80 |
if value.namespace.nil? |
|---|
| 81 |
value = XSD::QName.new(targetnamespace, value.source) |
|---|
| 82 |
end |
|---|
| 83 |
@message = value |
|---|
| 84 |
when NameAttrName |
|---|
| 85 |
@name = XSD::QName.new(targetnamespace, value.source) |
|---|
| 86 |
else |
|---|
| 87 |
nil |
|---|
| 88 |
end |
|---|
| 89 |
end |
|---|
| 90 |
end |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
end |
|---|