forked from reidiculous/actionwebservice
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP, working around 1.8 -> 1.9 problems by importing soap libraries f…
…rom 1.8.7
- Loading branch information
Showing
149 changed files
with
18,451 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
debug.log | ||
actionwebservice_unittest.db | ||
*.gem | ||
*~ | ||
.#* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rvm use ruby-1.9.2@actionwebservice | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source "http://rubygems.org" | ||
|
||
gem 'actionpack', '3.0.0.rc2' | ||
gem 'activerecord', '3.0.0.rc2' | ||
gem 'activesupport', '3.0.0.rc2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# soap/attachment.rb: SOAP4R - SwA implementation. | ||
# Copyright (C) 2002, 2003 Jamie Herre and NAKAMURA, Hiroshi <nahi@ruby-lang.org>. | ||
|
||
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can | ||
# redistribute it and/or modify it under the same terms of Ruby's license; | ||
# either the dual license version in 2003, or any later version. | ||
|
||
|
||
require 'action_web_service/soap/baseData' | ||
require 'action_web_service/soap/mapping' | ||
|
||
|
||
module SOAP | ||
|
||
|
||
class SOAPAttachment < SOAPExternalReference | ||
attr_reader :data | ||
|
||
def initialize(value) | ||
super() | ||
@data = value | ||
end | ||
|
||
private | ||
|
||
def external_contentid | ||
@data.contentid | ||
end | ||
end | ||
|
||
|
||
class Attachment | ||
attr_reader :io | ||
attr_accessor :contenttype | ||
|
||
def initialize(string_or_readable = nil) | ||
@string_or_readable = string_or_readable | ||
@contenttype = "application/octet-stream" | ||
@contentid = nil | ||
end | ||
|
||
def contentid | ||
@contentid ||= Attachment.contentid(self) | ||
end | ||
|
||
def contentid=(contentid) | ||
@contentid = contentid | ||
end | ||
|
||
def mime_contentid | ||
'<' + contentid + '>' | ||
end | ||
|
||
def content | ||
if @content == nil and @string_or_readable != nil | ||
@content = @string_or_readable.respond_to?(:read) ? | ||
@string_or_readable.read : @string_or_readable | ||
end | ||
@content | ||
end | ||
|
||
def to_s | ||
content | ||
end | ||
|
||
def write(out) | ||
out.write(content) | ||
end | ||
|
||
def save(filename) | ||
File.open(filename, "wb") do |f| | ||
write(f) | ||
end | ||
end | ||
|
||
def self.contentid(obj) | ||
# this needs to be fixed | ||
[obj.__id__.to_s, Process.pid.to_s].join('.') | ||
end | ||
|
||
def self.mime_contentid(obj) | ||
'<' + contentid(obj) + '>' | ||
end | ||
end | ||
|
||
|
||
module Mapping | ||
class AttachmentFactory < SOAP::Mapping::Factory | ||
def obj2soap(soap_class, obj, info, map) | ||
soap_obj = soap_class.new(obj) | ||
mark_marshalled_obj(obj, soap_obj) | ||
soap_obj | ||
end | ||
|
||
def soap2obj(obj_class, node, info, map) | ||
obj = node.data | ||
mark_unmarshalled_obj(node, obj) | ||
return true, obj | ||
end | ||
end | ||
|
||
DefaultRegistry.add(::SOAP::Attachment, ::SOAP::SOAPAttachment, | ||
AttachmentFactory.new, nil) | ||
end | ||
|
||
|
||
end |
Oops, something went wrong.