diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
commit | db9445103c082a306ba085f7677da02ea94b8841 (patch) | |
tree | a311d59f031ae5def87f68be71ed1f58abadc031 /lib/soap/soap.rb | |
parent | 8c2fb77787d1f20b4c19c9c52552856c339b86e9 (diff) |
* lib/soap/* (29 files): SOAP4R added.
* lib/wsdl/* (42 files): WSDL4R added.
* lib/xsd/* (12 files): XSD4R added.
* test/soap/* (16 files): added.
* test/wsdl/* (2 files): added.
* test/xsd/* (3 files): added.
* sample/soap/* (27 files): added.
* sample/wsdl/* (13 files): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap/soap.rb')
-rw-r--r-- | lib/soap/soap.rb | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/lib/soap/soap.rb b/lib/soap/soap.rb new file mode 100644 index 0000000000..313af3a059 --- /dev/null +++ b/lib/soap/soap.rb @@ -0,0 +1,112 @@ +=begin +SOAP4R - Base definitions. +Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PRATICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 675 Mass +Ave, Cambridge, MA 02139, USA. +=end + + +require 'xsd/qname' +require 'xsd/charset' + + +module SOAP + + +Version = '1.5.0' + +EnvelopeNamespace = 'http://schemas.xmlsoap.org/soap/envelope/' +EncodingNamespace = 'http://schemas.xmlsoap.org/soap/encoding/' +LiteralNamespace = 'http://xml.apache.org/xml-soap/literalxml' + +NextActor = 'http://schemas.xmlsoap.org/soap/actor/next' + +EleEnvelope = 'Envelope' +EleHeader = 'Header' +EleBody = 'Body' +EleFault = 'Fault' +EleFaultString = 'faultstring' +EleFaultActor = 'faultactor' +EleFaultCode = 'faultcode' +EleFaultDetail = 'detail' + +AttrMustUnderstand = 'mustUnderstand' +AttrEncodingStyle = 'encodingStyle' +AttrActor = 'actor' +AttrRoot = 'root' +AttrArrayType = 'arrayType' +AttrOffset = 'offset' +AttrPosition = 'position' +ValueArray = 'Array' + +EleEnvelopeName = XSD::QName.new(EnvelopeNamespace, EleEnvelope) +EleHeaderName = XSD::QName.new(EnvelopeNamespace, EleHeader) +EleBodyName = XSD::QName.new(EnvelopeNamespace, EleBody) +EleFaultName = XSD::QName.new(EnvelopeNamespace, EleFault) +EleFaultStringName = XSD::QName.new(nil, EleFaultString) +EleFaultActorName = XSD::QName.new(nil, EleFaultActor) +EleFaultCodeName = XSD::QName.new(nil, EleFaultCode) +EleFaultDetailName = XSD::QName.new(nil, EleFaultDetail) +AttrEncodingStyleName = XSD::QName.new(EnvelopeNamespace, AttrEncodingStyle) +AttrRootName = XSD::QName.new(EncodingNamespace, AttrRoot) +AttrArrayTypeName = XSD::QName.new(EncodingNamespace, AttrArrayType) +AttrOffsetName = XSD::QName.new(EncodingNamespace, AttrOffset) +AttrPositionName = XSD::QName.new(EncodingNamespace, AttrPosition) +ValueArrayName = XSD::QName.new(EncodingNamespace, ValueArray) + +Base64Literal = 'base64' + +SOAPNamespaceTag = 'env' +XSDNamespaceTag = 'xsd' +XSINamespaceTag = 'xsi' + +MediaType = 'text/xml' + +class Error < StandardError; end + +class StreamError < Error; end +class HTTPStreamError < StreamError; end +class PostUnavailableError < HTTPStreamError; end +class MPostUnavailableError < HTTPStreamError; end + +class ArrayIndexOutOfBoundsError < Error; end +class ArrayStoreError < Error; end + +class RPCRoutingError < Error; end + +class FaultError < Error + attr_reader :faultcode + attr_reader :faultstring + attr_reader :faultactor + attr_accessor :detail + + def initialize(fault) + @faultcode = fault.faultcode + @faultstring = fault.faultstring + @faultactor = fault.faultactor + @detail = fault.detail + super(self.to_s) + end + + def to_s + str = nil + if @faultstring && @faultstring.respond_to?('data') + str = @faultstring.data + end + str || '(No faultstring)' + end +end + + +end |