WSDL::Definitions (Class)

In: wsdl/soap/definitions.rb
wsdl/definitions.rb
Parent: Info

Attributes

imports  [R] 
name  [R] 
targetnamespace  [R] 

Public Class methods

[Source]

# File wsdl/soap/definitions.rb, line 26
  def self.array_complextype
    type = XMLSchema::ComplexType.new(::SOAP::ValueArrayName)
    type.complexcontent = XMLSchema::ComplexContent.new
    type.complexcontent.base = ::SOAP::ValueArrayName
    attr = XMLSchema::Attribute.new
    attr.ref = ::SOAP::AttrArrayTypeName
    anytype = XSD::AnyTypeName.dup
    anytype.name += '[]'
    attr.arytype = anytype
    type.complexcontent.attributes << attr
    type
  end

[Source]

# File wsdl/soap/definitions.rb, line 62
  def self.exception_complextype
    type = XMLSchema::ComplexType.new(XSD::QName.new(
        ::SOAP::Mapping::RubyCustomTypeNamespace, 'SOAPException'))
    excn_name = XMLSchema::Element.new(XSD::QName.new(nil, 'excn_type_name'), XSD::XSDString::Type)
    cause = XMLSchema::Element.new(XSD::QName.new(nil, 'cause'), XSD::AnyTypeName)
    backtrace = XMLSchema::Element.new(XSD::QName.new(nil, 'backtrace'), ::SOAP::ValueArrayName)
    message = XMLSchema::Element.new(XSD::QName.new(nil, 'message'), XSD::XSDString::Type)
    type.all_elements = [excn_name, cause, backtrace, message]
    type
  end

[Source]

# File wsdl/soap/definitions.rb, line 49
  def self.fault_complextype
    type = XMLSchema::ComplexType.new(::SOAP::EleFaultName)
    faultcode = XMLSchema::Element.new(::SOAP::EleFaultCodeName, XSD::XSDQName::Type)
    faultstring = XMLSchema::Element.new(::SOAP::EleFaultStringName, XSD::XSDString::Type)
    faultactor = XMLSchema::Element.new(::SOAP::EleFaultActorName, XSD::XSDAnyURI::Type)
    faultactor.minoccurs = 0
    detail = XMLSchema::Element.new(::SOAP::EleFaultDetailName, XSD::AnyTypeName)
    detail.minoccurs = 0
    type.all_elements = [faultcode, faultstring, faultactor, detail]
    type.final = 'extension'
    type
  end

[Source]

# File wsdl/definitions.rb, line 30
  def initialize
    super
    @name = nil
    @targetnamespace = nil
    @types = nil
    @imports = []
    @messages = XSD::NamedElements.new
    @porttypes = XSD::NamedElements.new
    @bindings = XSD::NamedElements.new
    @services = XSD::NamedElements.new

    @anontypes = XSD::NamedElements.new
    @root = self
  end

[Source]

# File wsdl/definitions.rb, line 214
  def self.parse_element(element)
    if element == DefinitionsName
      Definitions.new
    else
      nil
    end
  end

[Source]

# File wsdl/soap/definitions.rb, line 18
  def self.soap_rpc_complextypes
    types = XSD::NamedElements.new
    types << array_complextype
    types << fault_complextype
    types << exception_complextype
    types
  end

Public Instance methods

[Source]

# File wsdl/definitions.rb, line 83
  def add_type(complextype)
    @anontypes << complextype
  end

[Source]

# File wsdl/definitions.rb, line 139
  def binding(name)
    binding = @bindings[name]
    return binding if binding
    @imports.each do |import|
      binding = import.content.binding(name) if self.class === import.content
      return binding if binding
    end
    nil
  end

[Source]

# File wsdl/definitions.rb, line 103
  def bindings
    result = @bindings.dup
    @imports.each do |import|
      result.concat(import.content.bindings) if self.class === import.content
    end
    result
  end

[Source]

# File wsdl/definitions.rb, line 70
  def collect_complextypes
    result = @anontypes.dup
    if @types
      @types.schemas.each do |schema|
        result.concat(schema.complextypes)
      end
    end
    @imports.each do |import|
      result.concat(import.content.collect_complextypes)
    end
    result
  end

[Source]

# File wsdl/definitions.rb, line 57
  def collect_elements
    result = XSD::NamedElements.new
    if @types
      @types.schemas.each do |schema|
        result.concat(schema.elements)
      end
    end
    @imports.each do |import|
      result.concat(import.content.collect_elements)
    end
    result
  end

[Source]

# File wsdl/definitions.rb, line 45
  def inspect
    name = @name || '(unnamed)'
    "#<#{self.class}:#{name}>"
  end

[Source]

# File wsdl/definitions.rb, line 119
  def message(name)
    message = @messages[name]
    return message if message
    @imports.each do |import|
      message = import.content.message(name) if self.class === import.content
      return message if message
    end
    nil
  end

[Source]

# File wsdl/definitions.rb, line 87
  def messages
    result = @messages.dup
    @imports.each do |import|
      result.concat(import.content.messages) if self.class === import.content
    end
    result
  end

[Source]

# File wsdl/definitions.rb, line 203
  def parse_attr(attr, value)
    case attr
    when NameAttrName
      @name = XSD::QName.new(@targetnamespace, value)
    when TargetNamespaceAttrName
      self.targetnamespace = value
    else
      nil
    end
  end

[Source]

# File wsdl/definitions.rb, line 169
  def parse_element(element)
    case element
    when ImportName
      o = Import.new
      @imports << o
      o
    when TypesName
      o = Types.new
      @types = o
      o
    when MessageName
      o = Message.new
      @messages << o
      o
    when PortTypeName
      o = PortType.new
      @porttypes << o
      o
    when BindingName
      o = Binding.new
      @bindings << o
      o
    when ServiceName
      o = Service.new
      @services << o
      o
    when DocumentationName
      o = Documentation.new
      o
    else
      nil
    end
  end

[Source]

# File wsdl/definitions.rb, line 129
  def porttype(name)
    porttype = @porttypes[name]
    return porttype if porttype
    @imports.each do |import|
      porttype = import.content.porttype(name) if self.class === import.content
      return porttype if porttype
    end
    nil
  end

[Source]

# File wsdl/definitions.rb, line 159
  def porttype_binding(name)
    binding = @bindings.find { |item| item.type == name }
    return binding if binding
    @imports.each do |import|
      binding = import.content.porttype_binding(name) if self.class === import.content
      return binding if binding
    end
    nil
  end

[Source]

# File wsdl/definitions.rb, line 95
  def porttypes
    result = @porttypes.dup
    @imports.each do |import|
      result.concat(import.content.porttypes) if self.class === import.content
    end
    result
  end

Overrides Info#root

[Source]

# File wsdl/definitions.rb, line 22
  def root
    @root
  end

[Source]

# File wsdl/definitions.rb, line 26
  def root=(root)
    @root = root
  end

[Source]

# File wsdl/definitions.rb, line 149
  def service(name)
    service = @services[name]
    return service if service
    @imports.each do |import|
      service = import.content.service(name) if self.class === import.content
      return service if service
    end
    nil
  end

[Source]

# File wsdl/definitions.rb, line 111
  def services
    result = @services.dup
    @imports.each do |import|
      result.concat(import.content.services) if self.class === import.content
    end
    result
  end

[Source]

# File wsdl/soap/definitions.rb, line 73
  def soap_rpc_complextypes(binding)
    types = rpc_operation_complextypes(binding)
    types + self.class.soap_rpc_complextypes
  end

[Source]

# File wsdl/definitions.rb, line 50
  def targetnamespace=(targetnamespace)
    @targetnamespace = targetnamespace
    if @name
      @name = XSD::QName.new(@targetnamespace, @name.name)
    end
  end

[Validate]