diff --git a/app/views/todos/add_predecessor.js.rjs b/app/views/todos/add_predecessor.js.rjs
index dfe73a7d..40303398 100644
--- a/app/views/todos/add_predecessor.js.rjs
+++ b/app/views/todos/add_predecessor.js.rjs
@@ -9,6 +9,14 @@ if @saved
# regenerate predecessor to add arrow
page[@predecessor].replace_html :partial => 'todos/todo', :locals => { :todo => @predecessor, :parent_container_type => parent_container_type }
+ # regenerate predecessor family
+ parents = @predecessor.predecessors
+ until parents.empty?
+ parent = parents.pop
+ parents += parent.predecessors
+ page[parent].replace_html :partial => 'todos/todo', :locals => { :todo => parent, :parent_container_type => parent_container_type }
+ end
+
# show in tickler box in project view
if source_view_is_one_of :project, :tag
page['tickler-empty-nd'].hide
diff --git a/app/views/todos/calendar.html.erb b/app/views/todos/calendar.html.erb
index 858c24b3..33ccae78 100644
--- a/app/views/todos/calendar.html.erb
+++ b/app/views/todos/calendar.html.erb
@@ -52,13 +52,6 @@
- <% # hack for #860 Need to refactor this and use another dom element to bind projectDefauiltContextsMap to -%>
-
-
<%= link_to('iCal', {:format => 'ics', :token => current_user.token}, :title => "iCal feed" ) %>
- Get this calendar in iCal format
diff --git a/app/views/todos/edit.js.rjs b/app/views/todos/edit.js.rjs
index 20f7e290..55c57c34 100644
--- a/app/views/todos/edit.js.rjs
+++ b/app/views/todos/edit.js.rjs
@@ -2,3 +2,4 @@ page[dom_id(@todo, 'form')].find('.placeholder').show().replace_html :partial =>
page[dom_id(@todo, 'edit')].show
page[dom_id(@todo, 'line')].hide
page[dom_id(@todo, 'form')].find('input#todo_description').show().focus
+page << "enable_rich_interaction();"
\ No newline at end of file
diff --git a/app/views/todos/index.text.erb b/app/views/todos/index.text.erb
index c8895d03..194cd44d 100644
--- a/app/views/todos/index.text.erb
+++ b/app/views/todos/index.text.erb
@@ -1 +1 @@
-<%= render :partial => "contexts/text_context", :collection => @contexts, :locals => { :todos => @todos } %>
\ No newline at end of file
+<%= render :partial => "contexts/text_context", :collection => @contexts, :locals => { :todos => @todos, :not_done_todos => @not_done_todos } %>
diff --git a/app/views/todos/remove_predecessor.js.rjs b/app/views/todos/remove_predecessor.js.rjs
index 734d24a6..07c89a84 100644
--- a/app/views/todos/remove_predecessor.js.rjs
+++ b/app/views/todos/remove_predecessor.js.rjs
@@ -5,6 +5,14 @@ if @removed
# replace old predecessor with one without the successor
page.replace dom_id(@predecessor), :partial => 'todos/todo', :locals => {
:todo => @predecessor, :parent_container_type => parent_container_type }
+
+ # regenerate predecessor family
+ parents = @predecessor.predecessors
+ until parents.empty?
+ parent = parents.pop
+ parents += parent.predecessors
+ page[parent].replace_html :partial => 'todos/todo', :locals => { :todo => parent, :parent_container_type => parent_container_type }
+ end
# update display if pending->active
if @successor.active?
diff --git a/artwork/add_successor_on.svg b/artwork/add_successor_on.svg
new file mode 100644
index 00000000..b7b3165c
--- /dev/null
+++ b/artwork/add_successor_on.svg
@@ -0,0 +1,179 @@
+
+
+
+
diff --git a/artwork/predecessor.svg b/artwork/predecessor.svg
new file mode 100644
index 00000000..75e1ea1a
--- /dev/null
+++ b/artwork/predecessor.svg
@@ -0,0 +1,175 @@
+
+
+
+
diff --git a/config/cucumber.yml b/config/cucumber.yml
index c4d32843..b639c79d 100644
--- a/config/cucumber.yml
+++ b/config/cucumber.yml
@@ -1,8 +1,9 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
-rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
+rerun_opts = rerun.to_s.strip.empty? ? "--format progress " : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
+requires = "-r features/support/env.rb -r features/step_definitions"
+std_opts = "#{rerun_opts} #{requires} --format rerun --out rerun.txt --strict --tags ~@wip"
%>
default: <%= std_opts %> --tags ~@selenium
-selenium: <%= std_opts %> --tags @selenium
+selenium: <%= std_opts %> --tags @selenium -r features/support/selenium.rb
wip: --tags @wip:3 --wip features
diff --git a/config/database.yml.tmpl b/config/database.yml.tmpl
index 87014691..00d192cd 100644
--- a/config/database.yml.tmpl
+++ b/config/database.yml.tmpl
@@ -5,7 +5,7 @@ development:
username: root
password:
-test:
+test: &TEST
adapter: sqlite3
database: ":memory:"
@@ -15,3 +15,9 @@ production:
host: localhost
username: root
password:
+
+cucumber:
+ <<: *TEST
+
+selenium:
+ <<: *TEST
diff --git a/config/environments/cucumber.rb b/config/environments/cucumber.rb
index 26c08a08..f3ddb3bb 100644
--- a/config/environments/cucumber.rb
+++ b/config/environments/cucumber.rb
@@ -22,7 +22,6 @@ config.action_controller.allow_forgery_protection = false
config.action_mailer.delivery_method = :test
config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
-config.gem 'database_cleaner', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
diff --git a/config/environments/selenium.rb b/config/environments/selenium.rb
new file mode 100644
index 00000000..b933322c
--- /dev/null
+++ b/config/environments/selenium.rb
@@ -0,0 +1,30 @@
+# Edit at your own peril - it's recommended to regenerate this file
+# in the future when you upgrade to a newer version of Cucumber.
+
+# IMPORTANT: Setting config.cache_classes to false is known to
+# break Cucumber's use_transactional_fixtures method.
+# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
+config.cache_classes = true
+
+# Log error messages when you accidentally call methods on nil.
+config.whiny_nils = true
+
+# Show full error reports and disable caching
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+
+# Disable request forgery protection in test environment
+config.action_controller.allow_forgery_protection = false
+
+# Tell Action Mailer not to deliver emails to the real world.
+# The :test delivery method accumulates sent emails in the
+# ActionMailer::Base.deliveries array.
+config.action_mailer.delivery_method = :test
+
+config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
+config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
+config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
+config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
+
+config.gem 'database_cleaner', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
+
diff --git a/features/contexts_manage.feature b/features/contexts_manage.feature
new file mode 100644
index 00000000..9f819215
--- /dev/null
+++ b/features/contexts_manage.feature
@@ -0,0 +1,50 @@
+Feature: Manage contexts
+
+ In order to manage my contexts
+ As a Tracks user
+ I want to view, edit, add, or remove contexts
+
+ Background:
+ Given the following user record
+ | login | password | is_admin |
+ | testuser | secret | false |
+ And I have logged in as "testuser" with password "secret"
+
+ @selenium
+ Scenario: In place edit of context name
+ Given I have a context called "Errands"
+ When I visits the context page for "Errands"
+ And I edit the context name in place to be "OutAndAbout"
+ Then I should see the context name is "OutAndAbout"
+ When I go to the contexts page
+ Then he should see that a context named "Errands" is not present
+ And he should see that a context named "OutAndAbout" is present
+
+ @selenium
+ Scenario: Delete context from context page
+ Given I have a context called "@computer"
+ When I go to the contexts page
+ Then the badge should show 1
+ When I delete the context "@computer"
+ Then he should see that a context named "@computer" is not present
+ And the badge should show 0
+
+ @selenium
+ Scenario: Delete context from context page right after an edit
+ Given I have a context called "@computer"
+ When I go to the contexts page
+ And I edit the context to rename it to "@laptop"
+ When I delete the context "@laptop"
+ Then he should see that a context named "@laptop" is not present
+ And the badge should show 0
+
+ @selenium
+ Scenario: Edit context from context twice
+ Given I have a context called "@computer"
+ When I go to the contexts page
+ And I edit the context to rename it to "@laptop"
+ And I edit the context to rename it to "@ipad"
+ Then he should see that a context named "@computer" is not present
+ And he should see that a context named "@laptop" is not present
+ And he should see that a context named "@ipad" is present
+ And the badge should show 1
diff --git a/features/dependencies.feature b/features/dependencies.feature
new file mode 100644
index 00000000..b6f7db84
--- /dev/null
+++ b/features/dependencies.feature
@@ -0,0 +1,25 @@
+Feature: dependencies
+
+ As a Tracks user
+ In order to keep track of complex todos
+ I want to assign and manage todo dependencies
+
+ Background:
+ Given the following user record
+ | login | password | is_admin |
+ | testuser | secret | false |
+ And I have logged in as "testuser" with password "secret"
+
+ @selenium
+ Scenario: Adding dependency to dependency
+ Given I have a project "dependencies" with 3 todos
+ And "Todo 2" depends on "Todo 1"
+ When I visit the "dependencies" project
+ And I drag "Todo 3" to "Todo 2"
+ Then the dependencies of "Todo 2" should include "Todo 1"
+ And the dependencies of "Todo 3" should include "Todo 2"
+ When I expand the dependencies of "Todo 1"
+ Then I should see "Todo 2" within the dependencies of "Todo 1"
+ And I should see "Todo 3" within the dependencies of "Todo 1"
+ When I expand the dependencies of "Todo 2"
+ Then I should see "Todo 3" within the dependencies of "Todo 2"
\ No newline at end of file
diff --git a/features/manage_project.feature b/features/manage_project.feature
new file mode 100644
index 00000000..5db9910e
--- /dev/null
+++ b/features/manage_project.feature
@@ -0,0 +1,19 @@
+Feature: Manage a project
+
+ In order to reach a goal by doing several related todos
+ As a Tracks user
+ I want to manage these todos in a project
+
+ Background:
+ Given the following user record
+ | login | password | is_admin |
+ | testuser | secret | false |
+ And I have logged in as "testuser" with password "secret"
+ And there exists a project "manage me" for user "testuser"
+
+ @selenium
+ Scenario: I can describe the project using markup
+ When I visit the "manage me" project
+ And I edit the project description to "_successfull outcome_: project is *done*"
+ Then I should see the italic text "successfull outcome" in the project description
+ And I should see the bold text "done" in the project description
\ No newline at end of file
diff --git a/features/notes_manage.feature b/features/notes_manage.feature
index bf4be120..c0e07406 100644
--- a/features/notes_manage.feature
+++ b/features/notes_manage.feature
@@ -8,17 +8,16 @@ Feature: View, add, remove notes
Given the following user record
| login | password | is_admin |
| testuser | secret | false |
+ And I have logged in as "testuser" with password "secret"
Scenario: View notes
- Given I have logged in as "testuser" with password "secret"
- And I have two projects with one note each
+ Given I have two projects with one note each
When I go to the notes page
Then 2 notes should be visible
And the badge should show 2
Scenario: Add a new note
- Given I have logged in as "testuser" with password "secret"
- And I have one project "Pass Final Exam" with no notes
+ Given I have one project "Pass Final Exam" with no notes
When I add note "My Note A" from the "Pass Final Exam" project page
Then I should see note "My Note A" on the "Pass Final Exam" project page
And I should see note "My Note A" on the notes page
@@ -26,25 +25,15 @@ Feature: View, add, remove notes
@selenium
Scenario: Delete note from notes page
- Given I have logged in as "testuser" with password "secret"
- And I have a project "Pass Final Exam" with 2 notes
+ Given I have a project "Pass Final Exam" with 2 notes
When I go to the notes page
And I delete the first note
Then the first note should disappear
- Then the badge should show 1
+ And the badge should show 1
@selenium
Scenario: Link to note
- Given I have logged in as "testuser" with password "secret"
- And I have a project "Pass Final Exam" with 1 note
+ Given I have a project "Pass Final Exam" with 1 note
When I visit the "Pass Final Exam" project
And I click the icon next to the note
Then I should see the note text
-
- @selenium
- Scenario: Toggle notes
- Given I have logged in as "testuser" with password "secret"
- And I have two projects with one note each
- When I go to the notes page
- And I click Toggle Notes
- Then I should see the body of the notes
diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb
new file mode 100644
index 00000000..58813a63
--- /dev/null
+++ b/features/step_definitions/context_steps.rb
@@ -0,0 +1,47 @@
+Given /^I have a context called "([^\"]*)"$/ do |context_name|
+ @context = @current_user.contexts.create!(:name => context_name)
+end
+
+When /^I visits the context page for "([^\"]*)"$/ do |context_name|
+ context = @current_user.contexts.find_by_name(context_name)
+ context.should_not be_nil
+ visit "/contexts/#{context.id}"
+end
+
+When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
+ selenium.click "context_name"
+ fill_in "value", :with => "OutAndAbout"
+ click_button "OK"
+end
+
+Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
+ Then "I should see \"#{context_name}\""
+end
+
+Then /^he should see that a context named "([^\"]*)" is present$/ do |context_name|
+ Then "I should see \"#{context_name}\""
+end
+
+Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
+ Then "I should not see \"#{context_name}\""
+end
+
+Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
+ context = @current_user.contexts.create!(:name => context_name)
+ 1.upto number_of_actions.to_i do |i|
+ @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
+ end
+end
+
+When /^I delete the context "([^\"]*)"$/ do |context_name|
+ context = @current_user.contexts.find_by_name(context_name)
+ context.should_not be_nil
+ click_link "delete_context_#{context.id}"
+ selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'?"
+end
+
+When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
+ click_link "edit_context_#{@context.id}"
+ fill_in "context_name", :with => new_name
+ click_button "submit_context_#{@context.id}"
+end
diff --git a/features/step_definitions/generic_steps.rb b/features/step_definitions/generic_steps.rb
index 1ef65177..5e1b684f 100644
--- a/features/step_definitions/generic_steps.rb
+++ b/features/step_definitions/generic_steps.rb
@@ -1,7 +1,16 @@
Then /the badge should show (.*)/ do |number|
+ # puts response.body.inspect
badge = -1
- response.should have_xpath("//span[@id='badge_count']") do |node|
- badge = node.first.content.to_i
+ xpath= "//span[@id='badge_count']"
+
+ if Rails.env == 'selenium'
+ response.should have_xpath(xpath)
+ badge = response.selenium.get_text("xpath=#{xpath}").to_i
+ else
+ response.should have_xpath(xpath) do |node|
+ badge = node.first.content.to_i
+ end
end
+
badge.should == number.to_i
end
diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb
index 13c50b59..b4d80868 100644
--- a/features/step_definitions/login_steps.rb
+++ b/features/step_definitions/login_steps.rb
@@ -1,9 +1,9 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
visit login_path
- fill_in "login", :with => username
- fill_in "password", :with => password
- click_button "Sign in"
- response.body.should =~ /Login successful/m
+ fill_in "Login", :with => username
+ fill_in "Password", :with => password
+ click_button
+ response.should contain(/Login successful/)
@current_user = User.find_by_login(username)
end
@@ -11,4 +11,4 @@ When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do
fill_in 'Login', :with => username
fill_in 'Password', :with => password
click_button
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb
index 59dfe53a..93fab0f6 100644
--- a/features/step_definitions/note_steps.rb
+++ b/features/step_definitions/note_steps.rb
@@ -1,3 +1,7 @@
+Given /^I have one project "([^\"]*)" with no notes$/ do |project_name|
+ @current_user.projects.create!(:name => project_name)
+end
+
Given /^I have two projects with one note each$/ do
project_a = @current_user.projects.create!(:name => 'project A')
project_a.notes.create!(:user_id => @current_user.id, :body => 'note for project A')
@@ -5,26 +9,38 @@ Given /^I have two projects with one note each$/ do
project_b.notes.create!(:user_id => @current_user.id, :body => 'note for project B')
end
-Then /^(.*) notes should be visible$/ do |number|
- # count number of project_notes
- count = 0
- response.should have_xpath("//div[@class='project_notes']") { |nodes| nodes.each { |n| count += 1 }}
- count.should == number.to_i
+Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
+ project = @current_user.projects.create!(:name => project_name)
+ 1.upto num.to_i do |i|
+ project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}. This is the very long body of note #{i} where you should not see the last part of the note after 50 characters")
+ end
end
When /^I click Toggle Notes$/ do
click_link 'Toggle notes'
end
-Given /^I have one project "([^\"]*)" with no notes$/ do |project_name|
- @current_user.projects.create!(:name => project_name)
-end
-
When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project|
project = Project.find_by_name(project)
project.notes.create!(:user_id => @current_user.id, :body => note)
end
+When /^I delete the first note$/ do
+ click_link "delete note"
+ selenium.get_confirmation.should == "Are you sure that you want to delete the note '1'?"
+end
+
+When /^I click the icon next to the note$/ do
+ click_link "Show note"
+end
+
+Then /^(.*) notes should be visible$/ do |number|
+ # count number of project_notes
+ count = 0
+ response.should have_xpath("//div[@class='project_notes']") { |nodes| nodes.each { |n| count += 1 }}
+ count.should == number.to_i
+end
+
Then /^I should see note "([^\"]*)" on the "([^\"]*)" project page$/ do |note, project|
project = Project.find_by_name(project)
visit project_path(project)
@@ -36,75 +52,12 @@ Then /^I should see note "([^\"]*)" on the notes page$/ do |note|
Then "I should see \"#{note}\""
end
-Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
- project = @current_user.projects.create!(:name => project_name)
- num.to_i.downto 0 do |i|
- project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}")
- end
+Then /^the first note should disappear$/ do
+ # the first note contains "A note 1", generated by the Given def above
+ Then "I should not see \"A note 1\""
end
-When /^I delete the first note$/ do
- # need selenium for this to check on the js
- pending
-end
-
-Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
- pending
-end
-
-When /^I click the icon next to the note$/ do
- # need selenium for this to check on the js
- pending
-end
Then /^I should see the note text$/ do
- # need selenium for this to check on the js
- pending
-end
-
-Then /^I should see the body of the notes$/ do
- pending
-end
-
-
-#------ left over from old stories. can be removed if pending stuff is done
-
-When "Luis adds a note from the Pass Final Exam project page" do
-When "Luis visits the Pass Final Exam project page"
-clicks_link 'Add a note', :wait => :ajax
-fills_in 'new_note_body', :with => 'new exam note'
-clicks_button 'Add note', :wait => :ajax
-end
-
-When "Luis deletes the first note" do
-selenium.click "css=a.delete_note"
-selenium.get_confirmation.should =~ /delete/
-end
-
-When "clicks the icon next to the note" do
-selenium.click "css=a.link_to_notes"
-wait_for_page_to_load
-end
-
-When "Luis clicks Toggle Notes" do
-clicks_link 'Toggle notes', :wait => :effects
-end
-
-Then "Luis should see the note on the Pass Final Exam project page" do
-should_see "new exam note"
-end
-
-Then "Luis should see the note on the notes page" do
-visits '/notes'
-should_see "new exam note"
-end
-
-Then "the first note should disappear" do
-wait_for_ajax_and_effects
-should_not_see 'exam note 1'
-end
-
-
-Then "he should see the note text" do
-should_see 'exam note 1'
+ Then "I should see \"after 50 characters\""
end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
index 585dcfe8..f08d349d 100644
--- a/features/step_definitions/project_steps.rb
+++ b/features/step_definitions/project_steps.rb
@@ -1,4 +1,48 @@
-When /^I visit the "([^\"]*)" project$/ do |project_name|
- project = Project.find_by_name(project_name)
- visit project_path(project)
+Given /^I have a project "([^\"]*)" with (.*) todos$/ do |project_name, num_todos|
+ context = @current_user.contexts.create!(:name => "Context A")
+ project = @current_user.projects.create!(:name => project_name)
+ 1.upto num_todos.to_i do |i|
+ @current_user.todos.create!(
+ :project_id => project.id,
+ :context_id => context.id,
+ :description => "Todo #{i}")
+ end
end
+
+Given /^there exists a project "([^\"]*)" for user "([^\"]*)"$/ do |project_name, user_name|
+ user = User.find_by_login(user_name)
+ user.should_not be_nil
+ user.projects.create!(:name => project_name)
+end
+
+When /^I visit the "([^\"]*)" project$/ do |project_name|
+ @project = Project.find_by_name(project_name)
+ @project.should_not be_nil
+ visit project_path(@project)
+end
+
+When /^I edit the project description to "([^\"]*)"$/ do |new_description|
+ click_link "link_edit_project_#{@project.id}"
+ fill_in "project[description]", :with => new_description
+ click_button "submit_project_#{@project.id}"
+end
+
+Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
+ xpath="//div[@class='project_description']/p/strong"
+
+ response.should have_xpath(xpath)
+ bold_text = response.selenium.get_text("xpath=#{xpath}")
+
+ puts "bt=#{bold_text}"
+ bold_text.should =~ /#{bold}/
+end
+
+Then /^I should see the italic text "([^\"]*)" in the project description$/ do |italic|
+ xpath="//div[@class='project_description']/p/em"
+
+ response.should have_xpath(xpath)
+ italic_text = response.selenium.get_text("xpath=#{xpath}")
+
+ puts "it=#{italic_text}"
+ italic_text.should =~ /#{italic}/
+end
\ No newline at end of file
diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb
index bd366f4c..b2bd9d24 100644
--- a/features/step_definitions/todo_steps.rb
+++ b/features/step_definitions/todo_steps.rb
@@ -24,8 +24,67 @@ Given /^I have ([0-9]+) completed todos$/ do |count|
end
end
+Given /^"(.*)" depends on "(.*)"$/ do |successor_name, predecessor_name|
+ successor = Todo.find_by_description(successor_name)
+ predecessor = Todo.find_by_description(predecessor_name)
+
+ successor.add_predecessor(predecessor)
+ successor.state = "pending"
+ successor.save!
+end
+
+When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
+ drag_id = Todo.find_by_description(dragged).id
+ drop_id = Todo.find_by_description(target).id
+ drag_name = "xpath=//div[@id='line_todo_#{drag_id}']//img[@class='grip']"
+ # xpath does not seem to work here... reverting to css
+ # xpath=//div[@id='line_todo_#{drop_id}']//img[@class='successor_target']
+ drop_name = "css=div#line_todo_#{drop_id} img.successor_target"
+
+ # HACK: the target img is hidden until drag starts. We need to show the img or the
+ # xpath will not find it
+ js="$('div#line_todo_#{drop_id} img.successor_target').show();"
+ selenium.get_eval "(function() {with(this) {#{js}}}).call(selenium.browserbot.getCurrentWindow());"
+
+ selenium.drag_and_drop_to_object(drag_name, drop_name)
+
+ arrow = "xpath=//div[@id='line_todo_#{drop_id}']/div/a[@class='show_successors']/img"
+ selenium.wait_for_element(arrow)
+end
+
+When /^I expand the dependencies of "([^\"]*)"$/ do |todo_name|
+ todo = Todo.find_by_description(todo_name)
+ todo.should_not be_nil
+
+ expand_img_locator = "xpath=//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img"
+ selenium.click(expand_img_locator)
+end
+
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
-end
\ No newline at end of file
+end
+
+Then /^the dependencies of "(.*)" should include "(.*)"$/ do |child_name, parent_name|
+ parent = @current_user.todos.find_by_description(parent_name)
+ parent.should_not be_nil
+
+ child = parent.pending_successors.find_by_description(child_name)
+ child.should_not be_nil
+end
+
+Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |successor_description, todo_description|
+ todo = @current_user.todos.find_by_description(todo_description)
+ todo.should_not be_nil
+ successor = @current_user.todos.find_by_description(successor_description)
+ successor.should_not be_nil
+
+ # argh, webrat on selenium does not support within, so this won't work
+ # xpath = "//div[@id='line_todo_#{todo.id}'"
+ # Then "I should see \"#{successor_description}\" within \"xpath=#{xpath}\""
+
+ # let selenium look for the presence of the successor
+ xpath = "xpath=//div[@id='line_todo_#{todo.id}']//div[@id='successor_line_todo_#{successor.id}']//span"
+ selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
+end
diff --git a/features/support/paths.rb b/features/support/paths.rb
index b4ecce8e..91222396 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -14,6 +14,8 @@ module NavigationHelpers
login_path
when /the notes page/
notes_path
+ when /the contexts page/
+ contexts_path
# Add more page name => path mappings here
diff --git a/features/support/selenium.rb b/features/support/selenium.rb
new file mode 100644
index 00000000..af319c12
--- /dev/null
+++ b/features/support/selenium.rb
@@ -0,0 +1,22 @@
+Webrat.configure do |config|
+ config.mode = :selenium
+ config.application_environment = :selenium
+ config.selenium_browser_startup_timeout = 30
+ #config.selenium_server_address = "localhost"
+end
+
+Cucumber::Rails::World.use_transactional_fixtures = false
+
+require 'database_cleaner'
+
+# clean the database once when starting
+DatabaseCleaner.clean_with :truncation
+DatabaseCleaner.strategy = :truncation
+
+Before do
+ DatabaseCleaner.start
+end
+
+After do
+ DatabaseCleaner.clean
+end
diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake
index ab04dc88..1a04fc73 100644
--- a/lib/tasks/cucumber.rake
+++ b/lib/tasks/cucumber.rake
@@ -7,41 +7,48 @@
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
-vendored_cucumber_bin = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
-$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
+ vendored_cucumber_bin = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
-begin
- require 'cucumber/rake/task'
+ begin
+ require 'cucumber/rake/task'
- namespace :cucumber do
- Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
- t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
- t.fork = true # You may get faster startup if you set this to false
- t.profile = 'default'
+ namespace :cucumber do
+ Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'default'
+ end
+
+ Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
+ t.binary = vendored_cucumber_bin
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'wip'
+ end
+
+ Cucumber::Rake::Task.new({:selenium => 'db:test:prepare'}, 'Run features that require selenium') do |t|
+ t.binary = vendored_cucumber_bin
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'selenium'
+ ENV['RAILS_ENV'] = "selenium" # switch to selenium environment
+ end
+
+ desc 'Run all features'
+ task :all => [:ok, :wip]
end
+ desc 'Alias for cucumber:ok'
+ task :cucumber => 'cucumber:ok'
- Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
- t.binary = vendored_cucumber_bin
- t.fork = true # You may get faster startup if you set this to false
- t.profile = 'wip'
+ task :default => :cucumber
+
+ task :features => :cucumber do
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
+ end
+ rescue LoadError
+ desc 'cucumber rake task not available (cucumber not installed)'
+ task :cucumber do
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
-
- desc 'Run all features'
- task :all => [:ok, :wip]
end
- desc 'Alias for cucumber:ok'
- task :cucumber => 'cucumber:ok'
-
- task :default => :cucumber
-
- task :features => :cucumber do
- STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
- end
-rescue LoadError
- desc 'cucumber rake task not available (cucumber not installed)'
- task :cucumber do
- abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
- end
-end
end
diff --git a/public/images/add_successor_off.png b/public/images/add_successor_off.png
new file mode 100644
index 00000000..183f1326
Binary files /dev/null and b/public/images/add_successor_off.png differ
diff --git a/public/images/add_successor_on.png b/public/images/add_successor_on.png
new file mode 100644
index 00000000..d9e6eff9
Binary files /dev/null and b/public/images/add_successor_on.png differ
diff --git a/public/images/to_project_off.png b/public/images/to_project_off.png
new file mode 100644
index 00000000..80f74649
Binary files /dev/null and b/public/images/to_project_off.png differ
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 6266685e..6fa769ef 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -49,7 +49,7 @@ $.fn.clearForm = function() {
* Unobtrusive jQuery written by Eric Allen
****************************************/
-/* Set up authenticity token proplery */
+/* Set up authenticity token properly */
$(document).ajaxSend(function(event, request, settings) {
if ( settings.type == 'POST' ) {
if(typeof(AUTH_TOKEN) != 'undefined'){
@@ -154,9 +154,9 @@ function update_order(event, ui){
url = '';
if(row.hasClass('context'))
- url = '/contexts/order';
+ url = relative_to_root('contexts/order');
else if(row.hasClass('project'))
- url = '/projects/order';
+ url = relative_to_root('projects/order');
else {
console.log("Bad sortable list");
return;
@@ -185,11 +185,11 @@ function project_defaults(){
}
function enable_rich_interaction(){
- $('input.Date').datepicker({'dateFormat': dateFormat});
+ $('input.Date').datepicker({'dateFormat': dateFormat, 'firstDay': weekStart});
/* Autocomplete */
- $('input[name=context_name]:not(.ac_input)').autocomplete(contextNames, {matchContains: true});
- $('input[name=project[default_context_name]]:not(.ac_input)').autocomplete(contextNames, {matchContains: true});
- $('input[name=project_name]:not(.ac_input)').autocomplete(projectNames, {matchContains: true});
+ $('input[name=context_name]').autocomplete(contextNames, {matchContains: true});
+ $('input[name=project[default_context_name]]').autocomplete(contextNames, {matchContains: true});
+ $('input[name=project_name]').autocomplete(projectNames, {matchContains: true});
$('input[name=tag_list]:not(.ac_input)').autocomplete(tagNames, {multiple: true,multipleSeparator:',',matchContains:true});
$('input[name=predecessor_list]:not(.ac_input)').autocomplete('/todos/auto_complete_for_predecessor',
{multiple: true,multipleSeparator:','});
@@ -209,18 +209,41 @@ function enable_rich_interaction(){
/* Drag & Drop for successor/predecessor */
function drop_todo(evt, ui) {
dragged_todo = ui.draggable[0].id.split('_')[2];
- dropped_todo = this.id.split('_')[2];
+ dropped_todo = $(this).parents('.item-show').get(0).id.split('_')[2];
ui.draggable.hide();
$(this).block({message: null});
- $.post('/todos/add_predecessor',
+ $.post(relative_to_root('todos/add_predecessor'),
{successor: dragged_todo, predecessor: dropped_todo},
null, 'script');
}
- $('.item-show').draggable({handle: '.grip', revert: 'invalid'});
- $('.item-show').droppable({
- drop: drop_todo,
- hoverClass: 'hover'
+ $('.item-show').draggable({handle: '.grip',
+ revert: 'invalid',
+ start: function() {$('.successor_target').show();},
+ stop: function() {$('.successor_target').hide();}});
+
+ $('.successor_target').droppable({drop: drop_todo,
+ tolerance: 'pointer',
+ hoverClass: 'hover'});
+
+ /* Reset auto updater */
+ field_touched = false;
+}
+
+/* Auto-refresh */
+
+function setup_auto_refresh(interval){
+ field_touched = false;
+ function refresh_page() {
+ if(!field_touched){
+ window.location.reload();
+ }
+ }
+ setTimeout(refresh_page, interval);
+ $(function(){
+ $("input").live('keydown', function(){
+ field_touched = true;
+ });
});
}
@@ -287,6 +310,17 @@ $(document).ready(function() {
$.post(this.value, params, null, 'script');
});
+ /* set behavior for edit icon */
+ $(".item-container a.edit_item").live('click', function (ev){
+ itemContainer = $(this).parents(".item-container");
+ $.ajax({
+ url: this.href,
+ beforeSend: function() { itemContainer.block({message: null});},
+ complete: function() { itemContainer.unblock();},
+ dataType: 'script'});
+ return false;
+ });
+
setup_container_toggles();
$('#toggle_action_new').click(function(){
@@ -339,7 +373,6 @@ $(document).ready(function() {
});
$("#recurring_todo_new_action_cancel").click(function(){
- $('#recurring-todo-form-new-action').clearForm();
$('#recurring-todo-form-new-action input:text:first').focus();
TracksForm.hide_all_recurring();
$('#recurring_daily').show();
@@ -347,7 +380,6 @@ $(document).ready(function() {
});
$("#recurring_todo_edit_action_cancel").live('click', function(){
- $('#recurring-todo-form-edit-action').clearForm();
$('#recurring-todo-form-edit-action input:text:first').focus();
TracksForm.hide_all_recurring();
$('#recurring_daily').show();
@@ -372,9 +404,9 @@ $(document).ready(function() {
highlight = function(){
$('div.context span#context_name').effect('highlight', {}, 500);
};
- $.post('/contexts/update/'+context_id, {'context[name]': value}, highlight);
+ $.post(relative_to_root('contexts/update/'+context_id), {'context[name]': value}, highlight);
return(value);
- }, {style: 'padding:0px', submit: "OK"});
+ }, {style: 'padding:0px', submit: "OK", cancel: "CANCEL"});
/* Projects behavior */
@@ -383,7 +415,7 @@ $(document).ready(function() {
highlight = function(){
$('h2#project_name').effect('highlight', {}, 500);
};
- $.post('/projects/update/'+project_id, {'project[name]': value, 'update_project_name': 'true'}, highlight, 'script');
+ $.post(relative_to_root('projects/update/'+project_id), {'project[name]': value, 'update_project_name': 'true'}, highlight, 'script');
return(value);
};
@@ -448,6 +480,51 @@ $(document).ready(function() {
$("#list-contexts-active").sortable({handle: '.handle', update: update_order});
$("#list-contexts-hidden").sortable({handle: '.handle', update: update_order});
+
+ /* Feeds page */
+ $("#feed-contexts").change(function(){
+ $("#feeds-for-context").load('/feedlist/get_feeds_for_context?context_id='+this.value);
+ });
+ $("#feed-projects").change(function(){
+ $("#feeds-for-project").load('/feedlist/get_feeds_for_project?project_id='+this.value);
+ });
+
+ /* Integrations page */
+ /*
+ <%= observe_field "applescript1-contexts", :update => "applescript1",
+ :with => 'context_id',
+ :url => { :controller => "integrations", :action => "get_applescript1" },
+ :before => "$('applescript1').startWaiting()",
+ :complete => "$('applescript1').stopWaiting()"
+ %>
+ */
+ $('#applescript1-contexts').live('change', function(){
+ $("#applescript1").load(relative_to_root('integrations/get_applescript1?context_id='+this.value));
+ });
+
+ /*
+ <%= observe_field "applescript2-contexts", :update => "applescript2",
+ :with => 'context_id',
+ :url => { :controller => "integrations", :action => "get_applescript2" },
+ :before => "$('applescript2').startWaiting()",
+ :complete => "$('applescript2').stopWaiting()"
+ %>
+ */
+ $('#applescript2-contexts').live('change', function(){
+ $("#applescript2").load(relative_to_root('integrations/get_applescript2?context_id='+this.value));
+ });
+
+ /*
+ <%= observe_field "quicksilver-contexts", :update => "quicksilver",
+ :with => 'context_id',
+ :url => { :controller => "integrations", :action => "get_quicksilver_applescript" },
+ :before => "$('quicksilver').startWaiting()",
+ :complete => "$('quicksilver').stopWaiting()"
+ %>
+ */
+ $('#quicksilver-contexts').live('change', function(){
+ $("#quicksilver").load(relative_to_root('integrations/get_quicksilver_applescript?context_id='+this.value));
+ });
/* Gets called from some AJAX callbacks, too */
enable_rich_interaction();
diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css
index c32a167a..b326652d 100644
--- a/public/stylesheets/standard.css
+++ b/public/stylesheets/standard.css
@@ -99,8 +99,8 @@ a.to_bottom:hover {background: transparent url(../images/bottom_on.png) no-repea
a.show_notes, a.link_to_notes {background-image: url(../images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_notes:hover, a.link_to_notes:hover {background-image: url(../images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
-a.show_successors, a.link_to_successors {background-image: url(/images/successor_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
-a.show_successors:hover, a.link_to_successors:hover {background-image: url(/images/successor_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
+a.show_successors, a.link_to_successors {background-image: url(../images/successor_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
+a.show_successors:hover, a.link_to_successors:hover {background-image: url(../images/successor_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
/* Structural divs */
@@ -939,9 +939,17 @@ div.message {
cursor: move;
}
-.hover {
- background: #EAEAEA;
- font-weight: bold;
+.successor_target {
+ background-image:url("../images/add_successor_off.png");
+ background-repeat: no-repeat;
+ background-position: center right;
+ display: none;
+}
+
+.successor_target.hover {
+ background-image:url("../images/add_successor_on.png");
+ background-repeat: no-repeat;
+ background-position: center right;
}
/* Error message styles */
@@ -1284,3 +1292,6 @@ div.auto_complete ul strong.highlight {
margin:0;
padding:0;
}
+.ui-datepicker {
+ z-index: 1000;
+}
diff --git a/stories/all.rb b/stories/all.rb
deleted file mode 100644
index 2e8f46a4..00000000
--- a/stories/all.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-dir = File.dirname(__FILE__)
-Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
- require file
-end
\ No newline at end of file
diff --git a/stories/context_detail/change_context_name.story b/stories/context_detail/change_context_name.story
deleted file mode 100644
index 0dffeebe..00000000
--- a/stories/context_detail/change_context_name.story
+++ /dev/null
@@ -1,15 +0,0 @@
-Story: Change context name
-
- As a Tracks user
- I want to change the name of a context
- So that it can best reflect my daily life
-
- Scenario: In place edit of context name
- Given a logged in user Luis
- And Luis has a context Errands
- When Luis visits the Errands context page
- And he edits the Errands context name in place to be OutAndAbout
- Then he should see the context name is OutAndAbout
- When Luis visits the context listing page
- Then he should see that a context named Errands is not present
- And he should see that a context named OutAndAbout is present
diff --git a/stories/helper.rb b/stories/helper.rb
deleted file mode 100644
index da7a13a6..00000000
--- a/stories/helper.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-require 'spec/rails/story_adapter'
\ No newline at end of file
diff --git a/stories/notes/view_add_remove.story b/stories/notes/view_add_remove.story
deleted file mode 100644
index 34e519fe..00000000
--- a/stories/notes/view_add_remove.story
+++ /dev/null
@@ -1,41 +0,0 @@
-Story: View, add, remove notes
-
- As a Tracks user
- I want to view, add, and remove notes
- So that I can keep important information easily accessible
-
- Scenario: View and toggle notes
-
- Given a logged in user Luis
- And Luis has two projects with one note each
- When Luis visits the notes page
- Then two notes should be visible
- And the badge should show 2
- When Luis clicks Toggle Notes
- Then the body of the notes should be shown
-
- Scenario: Add a new note
-
- Given a logged in user Luis
- And Luis has one project Pass Final Exam with no notes
- When Luis adds a note from the Pass Final Exam project page
- Then Luis should see the note on the Pass Final Exam project page
- And Luis should see the note on the notes page
- And the badge on the notes page should show 1
-
- Scenario: Delete note from notes page
-
- Given a logged in user Luis
- And Luis has one project Pass Final Exam with 2 notes
- When Luis visits the notes page
- And Luis deletes the first note
- Then the first note should disappear
- Then the badge should show 1
-
- Scenario: Link to note
- Given a logged in user Luis
- And Luis has one project Pass Final Exam with 1 note
- When Luis visits the Pass Final Exam project page
- And clicks the icon next to the note
- Then he should see the note text
-
\ No newline at end of file
diff --git a/stories/steps/context_detail.rb b/stories/steps/context_detail.rb
deleted file mode 100644
index f02ae1aa..00000000
--- a/stories/steps/context_detail.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-steps_for :context_detail do
- include_steps_for :users
-
- Given "Luis has a context Errands" do
- @errands = @luis.contexts.create!(:name => 'Errands')
- end
-
- When "Luis visits the Errands context page" do
- visits "/contexts/#{@errands.to_param}"
- end
-
- When "he edits the Errands context name in place to be OutAndAbout" do
- selenium.click 'context_name_in_place_editor'
- wait_for_ajax_and_effects
- selenium.type "css=#context_name_in_place_editor-inplaceeditor input.editor_field", "OutAndAbout"
- clicks_button "ok", :wait => :ajax
- end
-
- When "Luis visits the context listing page" do
- visits "/contexts"
- end
-
- Then "he should see the context name is OutAndAbout" do
- should_see 'OutAndAbout'
- end
-
- Then "he should see that a context named Errands is not present" do
- should_not_see 'Errands'
- end
-
- Then "he should see that a context named OutAndAbout is present" do
- should_see 'OutAndAbout'
- end
-end
diff --git a/stories/steps/notes.rb b/stories/steps/notes.rb
deleted file mode 100644
index aa17722a..00000000
--- a/stories/steps/notes.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-steps_for :notes do
- include_steps_for :users
-
- Given "Luis has two projects with one note each" do
- project_a = @luis.projects.create!(:name => 'project A')
- project_a.notes.create!(:user_id => @luis.id, :body => 'note for project A')
- project_b = @luis.projects.create!(:name => 'project B')
- project_b.notes.create!(:user_id => @luis.id, :body => 'note for project B')
- end
-
- Given "Luis has one project Pass Final Exam with no notes" do
- @exam_project = @luis.projects.create!(:name => 'Pass Final Exam')
- end
-
- Given "Luis has one project Pass Final Exam with 1 note" do
- Given "Luis has one project Pass Final Exam with no notes"
- @exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 1')
- end
-
- Given "Luis has one project Pass Final Exam with 2 notes" do
- Given "Luis has one project Pass Final Exam with 1 note"
- @exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 2')
- end
-
- When "Luis visits the notes page" do
- visits '/notes'
- end
-
- When "Luis adds a note from the Pass Final Exam project page" do
- When "Luis visits the Pass Final Exam project page"
- clicks_link 'Add a note', :wait => :ajax
- fills_in 'new_note_body', :with => 'new exam note'
- clicks_button 'Add note', :wait => :ajax
- end
-
- When "Luis visits the Pass Final Exam project page" do
- visits "/projects/#{@exam_project.to_param}"
- end
-
- When "Luis deletes the first note" do
- selenium.click "css=a.delete_note"
- selenium.get_confirmation.should =~ /delete/
- end
-
- When "clicks the icon next to the note" do
- selenium.click "css=a.link_to_notes"
- wait_for_page_to_load
- end
-
- When "Luis clicks Toggle Notes" do
- clicks_link 'Toggle notes', :wait => :effects
- end
-
- Then "the body of the notes should be shown" do
- wait_for_effects
- selenium.is_visible("css=body.notes").should be_true
- end
-
- Then "Luis should see the note on the Pass Final Exam project page" do
- should_see "new exam note"
- end
-
- Then "Luis should see the note on the notes page" do
- visits '/notes'
- should_see "new exam note"
- end
-
- Then "the badge on the notes page should show 1" do
- badge_count_should_show(1)
- end
-
- Then "the first note should disappear" do
- wait_for_ajax_and_effects
- should_not_see 'exam note 1'
- end
-
- Then "the badge should show 1" do
- wait_for_ajax_and_effects
- badge_count_should_show(1)
- end
-
- Then "the badge should show 2" do
- badge_count_should_show(2)
- end
-
- Then "two notes should be visible" do
- should_see 'note for project A'
- should_see 'note for project B'
- end
-
- Then "he should see the note text" do
- should_see 'exam note 1'
- end
-end
\ No newline at end of file
diff --git a/test/selenium/context_detail/in_place_edit_name.rsel b/test/selenium/context_detail/in_place_edit_name.rsel
deleted file mode 100644
index d899d9cc..00000000
--- a/test/selenium/context_detail/in_place_edit_name.rsel
+++ /dev/null
@@ -1,10 +0,0 @@
-setup :fixtures => :all
-login :as => 'admin'
-open "/contexts/1"
-click "context_name"
-wait_for_element_present "css=#context_name form input"
-type "css=#context_name form input", "Test Foo"
-click "css=#context_name form button"
-wait_for_text "context_name", "Test Foo"
-open "/contexts/1"
-wait_for_text "context_name", "Test Foo"
diff --git a/test/selenium/context_listing/delete.rsel b/test/selenium/context_listing/delete.rsel
deleted file mode 100644
index e16221fe..00000000
--- a/test/selenium/context_listing/delete.rsel
+++ /dev/null
@@ -1,6 +0,0 @@
-setup :fixtures => :all
-login :as => 'admin'
-open "/contexts"
-click "css=#context_3 .buttons img.delete_item"
-assert_confirmation "Are you sure that you want to delete the context 'email'?"
-wait_for_element_not_present "context_3"
\ No newline at end of file
diff --git a/vendor/gems/soap4r-1.5.8/.specification b/vendor/gems/soap4r-1.5.8/.specification
new file mode 100644
index 00000000..5f64ff07
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/.specification
@@ -0,0 +1,566 @@
+--- !ruby/object:Gem::Specification
+name: soap4r
+version: !ruby/object:Gem::Version
+ version: 1.5.8
+platform: ruby
+authors:
+- NAKAMURA, Hiroshi
+autorequire:
+bindir: bin
+cert_chain:
+date: 2007-09-23 00:00:00 -07:00
+default_executable:
+dependencies:
+- !ruby/object:Gem::Dependency
+ name: httpclient
+ type: :runtime
+ version_requirement:
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 2.1.1
+ version:
+description:
+email: nahi@ruby-lang.org
+executables:
+- wsdl2ruby.rb
+- xsd2ruby.rb
+extensions: []
+
+extra_rdoc_files: []
+
+files:
+- bin/wsdl2ruby.rb
+- bin/xsd2ruby.rb
+- lib/tags
+- lib/xsd
+- lib/xsd/datatypes.rb
+- lib/xsd/namedelements.rb
+- lib/xsd/iconvcharset.rb
+- lib/xsd/charset.rb
+- lib/xsd/qname.rb
+- lib/xsd/mapping.rb
+- lib/xsd/codegen
+- lib/xsd/codegen/methoddef.rb
+- lib/xsd/codegen/moduledef.rb
+- lib/xsd/codegen/gensupport.rb
+- lib/xsd/codegen/commentdef.rb
+- lib/xsd/codegen/classdef.rb
+- lib/xsd/xmlparser
+- lib/xsd/xmlparser/xmlscanner.rb
+- lib/xsd/xmlparser/rexmlparser.rb
+- lib/xsd/xmlparser/parser.rb
+- lib/xsd/xmlparser/xmlparser.rb
+- lib/xsd/codegen.rb
+- lib/xsd/xmlparser.rb
+- lib/xsd/ns.rb
+- lib/xsd/datatypes1999.rb
+- lib/wsdl
+- lib/wsdl/xmlSchema
+- lib/wsdl/xmlSchema/fractiondigits.rb
+- lib/wsdl/xmlSchema/union.rb
+- lib/wsdl/xmlSchema/importHandler.rb
+- lib/wsdl/xmlSchema/minexclusive.rb
+- lib/wsdl/xmlSchema/complexRestriction.rb
+- lib/wsdl/xmlSchema/totaldigits.rb
+- lib/wsdl/xmlSchema/group.rb
+- lib/wsdl/xmlSchema/include.rb
+- lib/wsdl/xmlSchema/annotation.rb
+- lib/wsdl/xmlSchema/content.rb
+- lib/wsdl/xmlSchema/maxexclusive.rb
+- lib/wsdl/xmlSchema/element.rb
+- lib/wsdl/xmlSchema/choice.rb
+- lib/wsdl/xmlSchema/unique.rb
+- lib/wsdl/xmlSchema/sequence.rb
+- lib/wsdl/xmlSchema/list.rb
+- lib/wsdl/xmlSchema/any.rb
+- lib/wsdl/xmlSchema/maxinclusive.rb
+- lib/wsdl/xmlSchema/attribute.rb
+- lib/wsdl/xmlSchema/complexType.rb
+- lib/wsdl/xmlSchema/enumeration.rb
+- lib/wsdl/xmlSchema/length.rb
+- lib/wsdl/xmlSchema/maxlength.rb
+- lib/wsdl/xmlSchema/complexExtension.rb
+- lib/wsdl/xmlSchema/simpleType.rb
+- lib/wsdl/xmlSchema/parser.rb
+- lib/wsdl/xmlSchema/pattern.rb
+- lib/wsdl/xmlSchema/whitespace.rb
+- lib/wsdl/xmlSchema/all.rb
+- lib/wsdl/xmlSchema/schema.rb
+- lib/wsdl/xmlSchema/xsd2ruby.rb
+- lib/wsdl/xmlSchema/simpleContent.rb
+- lib/wsdl/xmlSchema/mininclusive.rb
+- lib/wsdl/xmlSchema/complexContent.rb
+- lib/wsdl/xmlSchema/anyAttribute.rb
+- lib/wsdl/xmlSchema/minlength.rb
+- lib/wsdl/xmlSchema/simpleExtension.rb
+- lib/wsdl/xmlSchema/simpleRestriction.rb
+- lib/wsdl/xmlSchema/attributeGroup.rb
+- lib/wsdl/xmlSchema/data.rb
+- lib/wsdl/xmlSchema/import.rb
+- lib/wsdl/xmlSchema/importer.rb
+- lib/wsdl/documentation.rb
+- lib/wsdl/param.rb
+- lib/wsdl/portType.rb
+- lib/wsdl/definitions.rb
+- lib/wsdl/wsdl.rb
+- lib/wsdl/operation.rb
+- lib/wsdl/operationBinding.rb
+- lib/wsdl/parser.rb
+- lib/wsdl/message.rb
+- lib/wsdl/port.rb
+- lib/wsdl/types.rb
+- lib/wsdl/part.rb
+- lib/wsdl/soap
+- lib/wsdl/soap/servletStubCreator.rb
+- lib/wsdl/soap/body.rb
+- lib/wsdl/soap/methodDefCreator.rb
+- lib/wsdl/soap/encodedMappingRegistryCreator.rb
+- lib/wsdl/soap/driverCreator.rb
+- lib/wsdl/soap/literalMappingRegistryCreator.rb
+- lib/wsdl/soap/element.rb
+- lib/wsdl/soap/definitions.rb
+- lib/wsdl/soap/servantSkeltonCreator.rb
+- lib/wsdl/soap/standaloneServerStubCreator.rb
+- lib/wsdl/soap/mappingRegistryCreatorSupport.rb
+- lib/wsdl/soap/fault.rb
+- lib/wsdl/soap/complexType.rb
+- lib/wsdl/soap/cgiStubCreator.rb
+- lib/wsdl/soap/operation.rb
+- lib/wsdl/soap/address.rb
+- lib/wsdl/soap/wsdl2ruby.rb
+- lib/wsdl/soap/clientSkeltonCreator.rb
+- lib/wsdl/soap/classDefCreatorSupport.rb
+- lib/wsdl/soap/headerfault.rb
+- lib/wsdl/soap/classDefCreator.rb
+- lib/wsdl/soap/mappingRegistryCreator.rb
+- lib/wsdl/soap/classNameCreator.rb
+- lib/wsdl/soap/binding.rb
+- lib/wsdl/soap/data.rb
+- lib/wsdl/soap/header.rb
+- lib/wsdl/binding.rb
+- lib/wsdl/service.rb
+- lib/wsdl/data.rb
+- lib/wsdl/import.rb
+- lib/wsdl/importer.rb
+- lib/wsdl/info.rb
+- lib/soap
+- lib/soap/mappingRegistry.rb
+- lib/soap/filter
+- lib/soap/filter/filterchain.rb
+- lib/soap/filter/streamhandler.rb
+- lib/soap/filter/handler.rb
+- lib/soap/encodingstyle
+- lib/soap/encodingstyle/literalHandler.rb
+- lib/soap/encodingstyle/soapHandler.rb
+- lib/soap/encodingstyle/aspDotNetHandler.rb
+- lib/soap/encodingstyle/handler.rb
+- lib/soap/wsdlDriver.rb
+- lib/soap/rpc
+- lib/soap/rpc/driver.rb
+- lib/soap/rpc/element.rb
+- lib/soap/rpc/soaplet.rb
+- lib/soap/rpc/cgistub.rb
+- lib/soap/rpc/proxy.rb
+- lib/soap/rpc/rpc.rb
+- lib/soap/rpc/standaloneServer.rb
+- lib/soap/rpc/router.rb
+- lib/soap/rpc/httpserver.rb
+- lib/soap/XMLSchemaDatatypes.rb
+- lib/soap/marshal.rb
+- lib/soap/driver.rb
+- lib/soap/mapping
+- lib/soap/mapping/registry.rb
+- lib/soap/mapping/typeMap.rb
+- lib/soap/mapping/mapping.rb
+- lib/soap/mapping/rubytypeFactory.rb
+- lib/soap/mapping/encodedregistry.rb
+- lib/soap/mapping/wsdlencodedregistry.rb
+- lib/soap/mapping/factory.rb
+- lib/soap/mapping/wsdlliteralregistry.rb
+- lib/soap/mapping/schemadefinition.rb
+- lib/soap/mapping/literalregistry.rb
+- lib/soap/nestedexception.rb
+- lib/soap/element.rb
+- lib/soap/charset.rb
+- lib/soap/qname.rb
+- lib/soap/httpconfigloader.rb
+- lib/soap/netHttpClient.rb
+- lib/soap/mapping.rb
+- lib/soap/cgistub.rb
+- lib/soap/XMLSchemaDatatypes1999.rb
+- lib/soap/proxy.rb
+- lib/soap/filter.rb
+- lib/soap/baseData.rb
+- lib/soap/streamHandler.rb
+- lib/soap/generator.rb
+- lib/soap/rpcUtils.rb
+- lib/soap/mimemessage.rb
+- lib/soap/header
+- lib/soap/header/simplehandler.rb
+- lib/soap/header/handlerset.rb
+- lib/soap/header/mappinghandler.rb
+- lib/soap/header/handler.rb
+- lib/soap/property.rb
+- lib/soap/attachment.rb
+- lib/soap/parser.rb
+- lib/soap/processor.rb
+- lib/soap/standaloneServer.rb
+- lib/soap/server.rb
+- lib/soap/rpcRouter.rb
+- lib/soap/ns.rb
+- lib/soap/compat.rb
+- lib/soap/soap.rb
+- lib/soap/namespace.rb
+- test/interopR4
+- test/interopR4/client.rb
+- test/testutil.rb
+- test/sm11
+- test/sm11/driver.rb
+- test/sm11/servant.rb
+- test/sm11/classDef.rb
+- test/sm11/server.rb
+- test/sm11/client.rb
+- test/xsd
+- test/xsd/xmlschema.xml
+- test/xsd/test_xsd.rb
+- test/xsd/xsd2ruby
+- test/xsd/xsd2ruby/expected_mysample.rb
+- test/xsd/xsd2ruby/section.xsd
+- test/xsd/xsd2ruby/expected_mysample_mapper.rb
+- test/xsd/xsd2ruby/test_xsd2ruby.rb
+- test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb
+- test/xsd/test_noencoding.rb
+- test/xsd/codegen
+- test/xsd/codegen/test_classdef.rb
+- test/xsd/noencoding.xml
+- test/xsd/test_xmlschemaparser.rb
+- test/xsd/test_ns.rb
+- test/xsd/xmllang.xml
+- test/wsdl
+- test/wsdl/simpletype
+- test/wsdl/simpletype/rpc
+- test/wsdl/simpletype/rpc/expectedEchoVersion.rb
+- test/wsdl/simpletype/rpc/test_rpc.rb
+- test/wsdl/simpletype/rpc/expectedClient.rb
+- test/wsdl/simpletype/rpc/expectedDriver.rb
+- test/wsdl/simpletype/rpc/expectedMappingRegistry.rb
+- test/wsdl/simpletype/rpc/rpc.wsdl
+- test/wsdl/simpletype/rpc/expectedServant.rb
+- test/wsdl/simpletype/rpc/expectedService.rb
+- test/wsdl/simpletype/simpletype.wsdl
+- test/wsdl/simpletype/test_simpletype.rb
+- test/wsdl/abstract
+- test/wsdl/abstract/test_abstract.rb
+- test/wsdl/abstract/abstract.wsdl
+- test/wsdl/rpc
+- test/wsdl/rpc/test_rpc.rb
+- test/wsdl/rpc/test_rpc_lit.rb
+- test/wsdl/rpc/test-rpc-lit.wsdl
+- test/wsdl/rpc/rpc.wsdl
+- test/wsdl/test_multiplefault.rb
+- test/wsdl/marshal
+- test/wsdl/marshal/person.wsdl
+- test/wsdl/marshal/test_wsdlmarshal.rb
+- test/wsdl/marshal/person_org.rb
+- test/wsdl/choice
+- test/wsdl/choice/choice.wsdl
+- test/wsdl/choice/test_choice.rb
+- test/wsdl/simplecontent
+- test/wsdl/simplecontent/test_simplecontent.rb
+- test/wsdl/simplecontent/simplecontent.wsdl
+- test/wsdl/overload
+- test/wsdl/overload/overload.wsdl
+- test/wsdl/overload/test_overload.rb
+- test/wsdl/complexcontent
+- test/wsdl/complexcontent/test_echo.rb
+- test/wsdl/complexcontent/complexContent.wsdl
+- test/wsdl/multiplefault.wsdl
+- test/wsdl/raa
+- test/wsdl/raa/README.txt
+- test/wsdl/raa/RAAService.rb
+- test/wsdl/raa/raa.wsdl
+- test/wsdl/raa/test_raa.rb
+- test/wsdl/raa/expectedDriver.rb
+- test/wsdl/raa/expectedMappingRegistry.rb
+- test/wsdl/raa/expectedClassDef.rb
+- test/wsdl/document
+- test/wsdl/document/test_rpc.rb
+- test/wsdl/document/test_number.rb
+- test/wsdl/document/ping_nosoapaction.wsdl
+- test/wsdl/document/document.wsdl
+- test/wsdl/document/number.wsdl
+- test/wsdl/document/array
+- test/wsdl/document/array/test_array.rb
+- test/wsdl/document/array/double.wsdl
+- test/wsdl/document/test_nosoapaction.rb
+- test/wsdl/any
+- test/wsdl/any/expectedDriver.rb
+- test/wsdl/any/expectedMappingRegistry.rb
+- test/wsdl/any/expectedEcho.rb
+- test/wsdl/any/any.wsdl
+- test/wsdl/any/test_any.rb
+- test/wsdl/any/expectedService.rb
+- test/wsdl/datetime
+- test/wsdl/datetime/datetimeServant.rb
+- test/wsdl/datetime/test_datetime.rb
+- test/wsdl/datetime/datetime.wsdl
+- test/wsdl/datetime/DatetimeService.rb
+- test/wsdl/datetime/datetime.rb
+- test/wsdl/list
+- test/wsdl/list/test_list.rb
+- test/wsdl/list/list.wsdl
+- test/wsdl/ref
+- test/wsdl/ref/product.wsdl
+- test/wsdl/ref/test_ref.rb
+- test/wsdl/ref/expectedDriver.rb
+- test/wsdl/ref/expectedProduct.rb
+- test/wsdl/test_fault.rb
+- test/wsdl/emptycomplextype.wsdl
+- test/wsdl/test_emptycomplextype.rb
+- test/wsdl/map
+- test/wsdl/map/map.xml
+- test/wsdl/map/map.wsdl
+- test/wsdl/map/test_map.rb
+- test/wsdl/axisArray
+- test/wsdl/axisArray/test_axisarray.rb
+- test/wsdl/axisArray/axisArray.wsdl
+- test/wsdl/qualified
+- test/wsdl/qualified/np.wsdl
+- test/wsdl/qualified/lp.xsd
+- test/wsdl/qualified/test_qualified.rb
+- test/wsdl/qualified/test_unqualified.rb
+- test/wsdl/qualified/lp.wsdl
+- test/wsdl/soap
+- test/wsdl/soap/test_soapbodyparts.rb
+- test/wsdl/soap/soapbodyparts.wsdl
+- test/wsdl/soap/wsdl2ruby
+- test/wsdl/soap/wsdl2ruby/expectedClassdef.rb
+- test/wsdl/soap/wsdl2ruby/expectedClient.rb
+- test/wsdl/soap/wsdl2ruby/section
+- test/wsdl/soap/wsdl2ruby/section/test_section.rb
+- test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb
+- test/wsdl/soap/wsdl2ruby/section/section.xsd
+- test/wsdl/soap/wsdl2ruby/expectedDriver.rb
+- test/wsdl/soap/wsdl2ruby/expectedService.cgi
+- test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb
+- test/wsdl/soap/wsdl2ruby/soapenc
+- test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl
+- test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb
+- test/wsdl/soap/wsdl2ruby/rpc.wsdl
+- test/wsdl/soap/wsdl2ruby/expectedServant.rb
+- test/wsdl/soap/wsdl2ruby/expectedService.rb
+- test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb
+- test/wsdl/anonymous
+- test/wsdl/anonymous/test_anonymous.rb
+- test/wsdl/anonymous/expectedDriver.rb
+- test/wsdl/anonymous/expectedMappingRegistry.rb
+- test/wsdl/anonymous/expectedClassDef.rb
+- test/wsdl/anonymous/lp.wsdl
+- test/wsdl/oneway
+- test/wsdl/oneway/test_oneway.rb
+- test/wsdl/oneway/oneway.wsdl
+- test/wsdl/group
+- test/wsdl/group/expectedClassdef.rb
+- test/wsdl/group/test_rpc.rb
+- test/wsdl/group/group.wsdl
+- test/wsdl/group/expectedDriver.rb
+- test/wsdl/group/expectedMappingRegistry.rb
+- test/wsdl/soaptype
+- test/wsdl/soaptype/soaptype.wsdl
+- test/wsdl/soaptype/test_soaptype.rb
+- test/wsdl/fault
+- test/wsdl/fault/test_multifault.rb
+- test/wsdl/fault/test_fault.rb
+- test/wsdl/fault/multifault.wsdl
+- test/wsdl/fault/fault.wsdl
+- test/runner.rb
+- test/interopR2
+- test/interopR2/clientBEAWebLogic.rb
+- test/interopR2/client4S4C2.rb
+- test/interopR2/client.log
+- test/interopR2/rwikiInteropService.rb
+- test/interopR2/InteropTest.wsdl
+- test/interopR2/clientJSOAP.rb
+- test/interopR2/clientMSSOAPToolkit2.0.rb
+- test/interopR2/clientOpenLink.rb
+- test/interopR2/clientSilverStream.rb
+- test/interopR2/clientSIMACE.rb
+- test/interopR2/clientMSSOAPToolkit3.0.rb
+- test/interopR2/InteropTestDriver.rb
+- test/interopR2/clientApacheAxis.rb
+- test/interopR2/SOAPBuildersInterop_R2GrB.wsdl
+- test/interopR2/clientWASP.rb
+- test/interopR2/InteropTestC.wsdl
+- test/interopR2/clientEasySoap.rb
+- test/interopR2/README.txt
+- test/interopR2/interopService.rb
+- test/interopR2/clientGLUE.rb
+- test/interopR2/SOAPBuildersInterop_R2.wsdl
+- test/interopR2/clientBase.rb
+- test/interopR2/clientWASPC.rb
+- test/interopR2/clientSpray2001.rb
+- test/interopR2/clientASP.NET.rb
+- test/interopR2/clientNuSOAP.rb
+- test/interopR2/clientCapeConnect.rb
+- test/interopR2/clientZSI.rb
+- test/interopR2/clientSQLData.rb
+- test/interopR2/groupc.wsdl
+- test/interopR2/clientJAX-RPC.rb
+- test/interopR2/iSimonReg.rb
+- test/interopR2/clientWhiteMesa.rb
+- test/interopR2/clienteSOAP.rb
+- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl
+- test/interopR2/clientOracle.rb
+- test/interopR2/clientSun.rb
+- test/interopR2/clientHP.rb
+- test/interopR2/clientgSOAP.rb
+- test/interopR2/simonReg.rb
+- test/interopR2/clientDelphi.rb
+- test/interopR2/clientXMLRPC-EPI.rb
+- test/interopR2/client4S4C.rb
+- test/interopR2/clientPhalanx.rb
+- test/interopR2/server.cgi
+- test/interopR2/clientPEAR.rb
+- test/interopR2/clientkSOAP.rb
+- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2.wsdl
+- test/interopR2/clientVWOpentalkSoap.rb
+- test/interopR2/clientSOAP4R.rb
+- test/interopR2/clientNuWave.rb
+- test/interopR2/clientKafkaXSLT.rb
+- test/interopR2/InteropTest.rb
+- test/interopR2/server.rb
+- test/interopR2/interopResultBase.rb
+- test/interopR2/clientXSOAP.rb
+- test/interopR2/clientFrontier.rb
+- test/interopR2/client.rb
+- test/interopR2/test.sh
+- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupCClient.rb
+- test/interopR2/clientWebMethods.rb
+- test/interopR2/clientWingfoot.rb
+- test/interopR2/SOAPBuildersInterop_R2GrC.wsdl
+- test/interopR2/base.rb
+- test/interopR2/clientXMLBus.rb
+- test/interopR2/client.NetRemoting.rb
+- test/interopR2/clientSOAP__Lite.rb
+- test/interopR2/clientApacheSOAP.rb
+- test/soap
+- test/soap/ssl
+- test/soap/ssl/client.cert
+- test/soap/ssl/server.cert
+- test/soap/ssl/README
+- test/soap/ssl/test_ssl.rb
+- test/soap/ssl/sslsvr.rb
+- test/soap/ssl/server.key
+- test/soap/ssl/ca.cert
+- test/soap/ssl/client.key
+- test/soap/ssl/subca.cert
+- test/soap/filter
+- test/soap/filter/test_filter.rb
+- test/soap/marshal
+- test/soap/marshal/test_digraph.rb
+- test/soap/marshal/test_struct.rb
+- test/soap/marshal/test_marshal.rb
+- test/soap/marshal/marshaltestlib.rb
+- test/soap/test_generator.rb
+- test/soap/test_nestedexception.rb
+- test/soap/helloworld
+- test/soap/helloworld/test_helloworld.rb
+- test/soap/helloworld/hw_s.rb
+- test/soap/test_basetype.rb
+- test/soap/test_custommap.rb
+- test/soap/calc
+- test/soap/calc/test_calc2.rb
+- test/soap/calc/server2.rb
+- test/soap/calc/test_calc_cgi.rb
+- test/soap/calc/calc.rb
+- test/soap/calc/calc2.rb
+- test/soap/calc/server.cgi
+- test/soap/calc/test_calc.rb
+- test/soap/calc/server.rb
+- test/soap/test_empty.rb
+- test/soap/test_extraattr.rb
+- test/soap/test_response_as_xml.rb
+- test/soap/wsdlDriver
+- test/soap/wsdlDriver/test_document.rb
+- test/soap/wsdlDriver/README.txt
+- test/soap/wsdlDriver/simpletype.wsdl
+- test/soap/wsdlDriver/calc.wsdl
+- test/soap/wsdlDriver/echo_version.rb
+- test/soap/wsdlDriver/document.wsdl
+- test/soap/wsdlDriver/test_calc.rb
+- test/soap/wsdlDriver/test_simpletype.rb
+- test/soap/test_soapelement.rb
+- test/soap/test_httpconfigloader.rb
+- test/soap/test_envelopenamespace.rb
+- test/soap/struct
+- test/soap/struct/test_struct.rb
+- test/soap/test_nil.rb
+- test/soap/case
+- test/soap/case/test_mapping.rb
+- test/soap/test_cookie.rb
+- test/soap/test_property.rb
+- test/soap/test_streamhandler.rb
+- test/soap/header
+- test/soap/header/test_simplehandler.rb
+- test/soap/header/test_authheader.rb
+- test/soap/header/server.cgi
+- test/soap/header/test_authheader_cgi.rb
+- test/soap/asp.net
+- test/soap/asp.net/hello.wsdl
+- test/soap/asp.net/test_aspdotnet.rb
+- test/soap/styleuse
+- test/soap/styleuse/server.rb
+- test/soap/styleuse/client.rb
+- test/soap/test_styleuse.rb
+- test/soap/test_no_indent.rb
+- test/soap/test_custom_ns.rb
+- test/soap/htpasswd
+- test/soap/literalArrayMapping
+- test/soap/literalArrayMapping/amazonEcDriver.rb
+- test/soap/literalArrayMapping/amazonresponse.xml
+- test/soap/literalArrayMapping/amazonEc.rb
+- test/soap/literalArrayMapping/test_definedarray.rb
+- test/soap/auth
+- test/soap/auth/htdigest
+- test/soap/auth/test_basic.rb
+- test/soap/auth/htpasswd
+- test/soap/auth/test_digest.rb
+- test/soap/swa
+- test/soap/swa/test_file.rb
+- test/soap/fault
+- test/soap/fault/test_soaparray.rb
+- test/soap/fault/test_customfault.rb
+- test/soap/test_mapping.rb
+- test/16runner.rb
+has_rdoc: true
+homepage: http://dev.ctor.org/soap4r
+licenses: []
+
+post_install_message:
+rdoc_options: []
+
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">"
+ - !ruby/object:Gem::Version
+ version: 0.0.0
+ version:
+required_rubygems_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+requirements: []
+
+rubyforge_project:
+rubygems_version: 1.3.5
+signing_key:
+specification_version: 1
+summary: An implementation of SOAP 1.1 for Ruby.
+test_files:
+- test/runner.rb
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb b/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb
new file mode 100644
index 00000000..85b9078b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb
@@ -0,0 +1,108 @@
+# soap/attachment.rb: SOAP4R - SwA implementation.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require '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
+ @content = 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
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/attrproxy.rb b/vendor/gems/soap4r-1.5.8/lib/soap/attrproxy.rb
new file mode 100644
index 00000000..0c25bf50
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/attrproxy.rb
@@ -0,0 +1,34 @@
+# SOAP4R - attribute proxy interface.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+
+
+module AttrProxy
+ def self.included(klass)
+ klass.extend(AttrProxyClassSupport)
+ end
+
+ module AttrProxyClassSupport
+ def attr_proxy(symbol, assignable = false)
+ name = symbol.to_s
+ define_method(name) {
+ attrproxy.__send__(name)
+ }
+ if assignable
+ aname = name + '='
+ define_method(aname) { |rhs|
+ attrproxy.__send__(aname, rhs)
+ }
+ end
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb b/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb
new file mode 100644
index 00000000..562fed1b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb
@@ -0,0 +1,1094 @@
+# soap/baseData.rb: SOAP4R - Base type library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+require 'soap/soap'
+require 'xsd/codegen/gensupport'
+require 'soap/mapping/mapping'
+
+
+module SOAP
+
+
+###
+## Mix-in module for SOAP base type classes.
+#
+module SOAPModuleUtils
+ include SOAP
+
+public
+
+ def decode(elename)
+ d = self.new
+ d.elename = elename
+ d
+ end
+
+ def to_data(str)
+ new(str).data
+ end
+end
+
+
+###
+## for SOAP type(base and compound)
+#
+module SOAPType
+ attr_accessor :encodingstyle
+ attr_accessor :elename
+ attr_accessor :id
+ attr_reader :precedents
+ attr_accessor :root
+ attr_accessor :parent
+ attr_accessor :position
+ attr_reader :extraattr
+ attr_accessor :definedtype
+ attr_accessor :force_typed
+
+ def initialize(*arg)
+ super
+ @encodingstyle = nil
+ @elename = XSD::QName::EMPTY
+ @id = nil
+ @precedents = []
+ @root = false
+ @parent = nil
+ @position = nil
+ @definedtype = nil
+ @extraattr = {}
+ @force_typed = false
+ end
+
+ def inspect
+ if self.is_a?(XSD::NSDBase)
+ sprintf("#<%s:0x%x %s %s>", self.class.name, __id__, self.elename, self.type)
+ else
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
+ end
+ end
+
+ def rootnode
+ node = self
+ while node = node.parent
+ break if SOAPEnvelope === node
+ end
+ node
+ end
+end
+
+
+###
+## for SOAP base type
+#
+module SOAPBasetype
+ include SOAPType
+ include SOAP
+
+ attr_accessor :qualified
+
+ def initialize(*arg)
+ super
+ @qualified = nil
+ end
+end
+
+
+###
+## for SOAP compound type
+#
+module SOAPCompoundtype
+ include SOAPType
+ include SOAP
+
+ attr_accessor :qualified
+
+ def initialize(*arg)
+ super
+ @qualified = nil
+ end
+end
+
+# marker for compound types which have named accessor
+module SOAPNameAccessible
+end
+
+
+###
+## Convenience datatypes.
+#
+class SOAPReference < XSD::NSDBase
+ include SOAPBasetype
+ extend SOAPModuleUtils
+
+public
+
+ attr_accessor :refid
+
+ # Override the definition in SOAPBasetype.
+ def initialize(obj = nil)
+ super()
+ @type = XSD::QName::EMPTY
+ @refid = nil
+ @obj = nil
+ __setobj__(obj) if obj
+ end
+
+ def __getobj__
+ @obj
+ end
+
+ def __setobj__(obj)
+ @obj = obj
+ @refid = @obj.id || SOAPReference.create_refid(@obj)
+ @obj.id = @refid unless @obj.id
+ @obj.precedents << self
+ # Copies NSDBase information
+ @obj.type = @type unless @obj.type
+ end
+
+ # Why don't I use delegate.rb?
+ # -> delegate requires target object type at initialize time.
+ # Why don't I use forwardable.rb?
+ # -> forwardable requires a list of forwarding methods.
+ #
+ # ToDo: Maybe I should use forwardable.rb and give it a methods list like
+ # delegate.rb...
+ #
+ def method_missing(msg_id, *params)
+ if @obj
+ @obj.send(msg_id, *params)
+ else
+ nil
+ end
+ end
+
+ # for referenced base type such as a long value from Axis.
+ # base2obj requires a node to respond to :data
+ def data
+ if @obj.respond_to?(:data)
+ @obj.data
+ end
+ end
+
+ def refidstr
+ '#' + @refid
+ end
+
+ def self.create_refid(obj)
+ 'id' + obj.__id__.to_s
+ end
+
+ def self.decode(elename, refidstr)
+ if /\A#(.*)\z/ =~ refidstr
+ refid = $1
+ elsif /\Acid:(.*)\z/ =~ refidstr
+ refid = $1
+ else
+ raise ArgumentError.new("illegal refid #{refidstr}")
+ end
+ d = super(elename)
+ d.refid = refid
+ d
+ end
+end
+
+
+class SOAPExternalReference < XSD::NSDBase
+ include SOAPBasetype
+ extend SOAPModuleUtils
+
+ def initialize
+ super()
+ @type = XSD::QName::EMPTY
+ end
+
+ def referred
+ rootnode.external_content[external_contentid] = self
+ end
+
+ def refidstr
+ 'cid:' + external_contentid
+ end
+
+private
+
+ def external_contentid
+ raise NotImplementedError.new
+ end
+end
+
+
+class SOAPNil < XSD::XSDNil
+ include SOAPBasetype
+ extend SOAPModuleUtils
+
+public
+
+ def initialize(value = nil)
+ super(value)
+ @extraattr[XSD::AttrNilName] = 'true'
+ end
+end
+
+# SOAPRawString is for sending raw string. In contrast to SOAPString,
+# SOAP4R does not do XML encoding and does not convert its CES. The string it
+# holds is embedded to XML instance directly as a 'xsd:string'.
+class SOAPRawString < XSD::XSDString
+ include SOAPBasetype
+ extend SOAPModuleUtils
+end
+
+
+###
+## Basic datatypes.
+#
+class SOAPAnySimpleType < XSD::XSDAnySimpleType
+ include SOAPBasetype
+ extend SOAPModuleUtils
+end
+
+class SOAPString < XSD::XSDString
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, StringLiteral)
+end
+
+class SOAPNormalizedString < XSD::XSDNormalizedString
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NormalizedStringLiteral)
+end
+
+class SOAPToken < XSD::XSDToken
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, TokenLiteral)
+end
+
+class SOAPLanguage < XSD::XSDLanguage
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, LanguageLiteral)
+end
+
+class SOAPNMTOKEN < XSD::XSDNMTOKEN
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NMTOKENLiteral)
+end
+
+class SOAPNMTOKENS < XSD::XSDNMTOKENS
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NMTOKENSLiteral)
+end
+
+class SOAPName < XSD::XSDName
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NameLiteral)
+end
+
+class SOAPNCName < XSD::XSDNCName
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NCNameLiteral)
+end
+
+class SOAPID < XSD::XSDID
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, IDLiteral)
+end
+
+class SOAPIDREF < XSD::XSDIDREF
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, IDREFLiteral)
+end
+
+class SOAPIDREFS < XSD::XSDIDREFS
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, IDREFSLiteral)
+end
+
+class SOAPENTITY < XSD::XSDENTITY
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, ENTITYLiteral)
+end
+
+class SOAPENTITIES < XSD::XSDENTITIES
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, ENTITIESLiteral)
+end
+
+class SOAPBoolean < XSD::XSDBoolean
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, BooleanLiteral)
+end
+
+class SOAPDecimal < XSD::XSDDecimal
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, DecimalLiteral)
+end
+
+class SOAPFloat < XSD::XSDFloat
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, FloatLiteral)
+end
+
+class SOAPDouble < XSD::XSDDouble
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, DoubleLiteral)
+end
+
+class SOAPDuration < XSD::XSDDuration
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, DurationLiteral)
+end
+
+class SOAPDateTime < XSD::XSDDateTime
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, DateTimeLiteral)
+end
+
+class SOAPTime < XSD::XSDTime
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, TimeLiteral)
+end
+
+class SOAPDate < XSD::XSDDate
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, DateLiteral)
+end
+
+class SOAPGYearMonth < XSD::XSDGYearMonth
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, GYearMonthLiteral)
+end
+
+class SOAPGYear < XSD::XSDGYear
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, GYearLiteral)
+end
+
+class SOAPGMonthDay < XSD::XSDGMonthDay
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, GMonthDayLiteral)
+end
+
+class SOAPGDay < XSD::XSDGDay
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, GDayLiteral)
+end
+
+class SOAPGMonth < XSD::XSDGMonth
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, GMonthLiteral)
+end
+
+class SOAPHexBinary < XSD::XSDHexBinary
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, HexBinaryLiteral)
+end
+
+class SOAPBase64 < XSD::XSDBase64Binary
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ Type = SOAPENCType = QName.new(EncodingNamespace, Base64Literal)
+
+public
+
+ def initialize(value = nil)
+ super(value)
+ @type = Type
+ end
+
+ def as_xsd
+ @type = XSD::XSDBase64Binary::Type
+ end
+end
+
+class SOAPAnyURI < XSD::XSDAnyURI
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, AnyURILiteral)
+end
+
+class SOAPQName < XSD::XSDQName
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, QNameLiteral)
+end
+
+
+class SOAPInteger < XSD::XSDInteger
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, IntegerLiteral)
+end
+
+class SOAPNonPositiveInteger < XSD::XSDNonPositiveInteger
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NonPositiveIntegerLiteral)
+end
+
+class SOAPNegativeInteger < XSD::XSDNegativeInteger
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NegativeIntegerLiteral)
+end
+
+class SOAPLong < XSD::XSDLong
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, LongLiteral)
+end
+
+class SOAPInt < XSD::XSDInt
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, IntLiteral)
+end
+
+class SOAPShort < XSD::XSDShort
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, ShortLiteral)
+end
+
+class SOAPByte < XSD::XSDByte
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, ByteLiteral)
+end
+
+class SOAPNonNegativeInteger < XSD::XSDNonNegativeInteger
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, NonNegativeIntegerLiteral)
+end
+
+class SOAPUnsignedLong < XSD::XSDUnsignedLong
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, UnsignedLongLiteral)
+end
+
+class SOAPUnsignedInt < XSD::XSDUnsignedInt
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, UnsignedIntLiteral)
+end
+
+class SOAPUnsignedShort < XSD::XSDUnsignedShort
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, UnsignedShortLiteral)
+end
+
+class SOAPUnsignedByte < XSD::XSDUnsignedByte
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, UnsignedByteLiteral)
+end
+
+class SOAPPositiveInteger < XSD::XSDPositiveInteger
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ SOAPENCType = QName.new(EncodingNamespace, PositiveIntegerLiteral)
+end
+
+
+###
+## Compound datatypes.
+#
+class SOAPStruct < XSD::NSDBase
+ include Enumerable
+ include SOAPCompoundtype
+ include SOAPNameAccessible
+
+public
+
+ def initialize(type = nil)
+ super()
+ @type = type || XSD::QName::EMPTY
+ @array = []
+ @data = []
+ end
+
+ def to_s
+ str = ''
+ self.each do |key, data|
+ str << "#{key}: #{data}\n"
+ end
+ str
+ end
+
+ def add(name, value)
+ value = SOAPNil.new if value.nil?
+ @array.push(name)
+ value.elename = value.elename.dup_name(name)
+ @data.push(value)
+ value.parent = self if value.respond_to?(:parent=)
+ value
+ end
+
+ def [](idx)
+ if idx.is_a?(Range)
+ @data[idx]
+ elsif idx.is_a?(Integer)
+ if (idx > @array.size)
+ raise ArrayIndexOutOfBoundsError.new('In ' << @type.name)
+ end
+ @data[idx]
+ else
+ if @array.include?(idx)
+ @data[@array.index(idx)]
+ else
+ nil
+ end
+ end
+ end
+
+ def []=(idx, data)
+ if @array.include?(idx)
+ data.parent = self if data.respond_to?(:parent=)
+ @data[@array.index(idx)] = data
+ else
+ add(idx, data)
+ end
+ end
+
+ def key?(name)
+ @array.include?(name)
+ end
+
+ def members
+ @array
+ end
+
+ def have_member
+ !@array.empty?
+ end
+
+ def to_obj
+ hash = {}
+ proptype = {}
+ each do |k, v|
+ value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
+ case proptype[k]
+ when :single
+ hash[k] = [hash[k], value]
+ proptype[k] = :multi
+ when :multi
+ hash[k] << value
+ else
+ hash[k] = value
+ proptype[k] = :single
+ end
+ end
+ hash
+ end
+
+ def each
+ idx = 0
+ while idx < @array.length
+ yield(@array[idx], @data[idx])
+ idx += 1
+ end
+ end
+
+ def replace
+ members.each do |member|
+ self[member] = yield(self[member])
+ end
+ end
+
+ def self.decode(elename, type)
+ s = SOAPStruct.new(type)
+ s.elename = elename
+ s
+ end
+end
+
+
+# SOAPElement is not typed so it is not derived from NSDBase.
+class SOAPElement
+ include Enumerable
+ include SOAPCompoundtype
+ include SOAPNameAccessible
+
+ attr_accessor :type
+ # Text interface.
+ attr_accessor :text
+ alias data text
+
+ def initialize(elename, text = nil)
+ super()
+ if elename.nil?
+ elename = XSD::QName::EMPTY
+ else
+ elename = Mapping.to_qname(elename)
+ end
+ @encodingstyle = LiteralNamespace
+ @elename = elename
+ @type = nil
+
+ @array = []
+ @data = []
+ @text = text
+ end
+
+ def inspect
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename) +
+ (@text ? " #{@text.inspect}" : '') +
+ @data.collect { |ele| "\n#{ele.inspect}" }.join.gsub(/^/, ' ')
+ end
+
+ def set(value)
+ @text = value
+ end
+
+ # Element interfaces.
+ def add(value)
+ name = value.elename.name
+ @array.push(name)
+ @data.push(value)
+ value.parent = self if value.respond_to?(:parent=)
+ value
+ end
+
+ def [](idx)
+ if @array.include?(idx)
+ @data[@array.index(idx)]
+ else
+ nil
+ end
+ end
+
+ def []=(idx, data)
+ if @array.include?(idx)
+ data.parent = self if data.respond_to?(:parent=)
+ @data[@array.index(idx)] = data
+ else
+ add(data)
+ end
+ end
+
+ def key?(name)
+ @array.include?(name)
+ end
+
+ def members
+ @array
+ end
+
+ def have_member
+ !@array.empty?
+ end
+
+ def to_obj
+ if !have_member
+ @text
+ else
+ hash = {}
+ proptype = {}
+ each do |k, v|
+ value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
+ case proptype[k]
+ when :single
+ hash[k] = [hash[k], value]
+ proptype[k] = :multi
+ when :multi
+ hash[k] << value
+ else
+ hash[k] = value
+ proptype[k] = :single
+ end
+ end
+ hash
+ end
+ end
+
+ def each
+ idx = 0
+ while idx < @array.length
+ yield(@array[idx], @data[idx])
+ idx += 1
+ end
+ end
+
+ def self.decode(elename)
+ o = SOAPElement.new(elename)
+ o
+ end
+
+ def self.from_objs(objs)
+ objs.collect { |value|
+ if value.is_a?(SOAPElement)
+ value
+ else
+ k, v = value
+ ele = from_obj(v)
+ ele.elename = XSD::QName.new(nil, k)
+ ele
+ end
+ }
+ end
+
+ # when obj is a Hash or an Array:
+ # when key starts with "xmlattr_":
+ # value is added as an XML attribute with the key name however the
+ # "xmlattr_" is dropped from the name.
+ # when key starts with "xmlele_":
+ # value is added as an XML element with the key name however the
+ # "xmlele_" is dropped from the name.
+ # if else:
+ # value is added as an XML element with the key name.
+ def self.from_obj(obj, namespace = nil)
+ return obj if obj.is_a?(SOAPElement)
+ o = SOAPElement.new(nil)
+ case obj
+ when nil
+ o.text = nil
+ when Hash, Array
+ obj.each do |name, value|
+ addname, is_attr = parse_name(name, namespace)
+ if value.is_a?(Array)
+ value.each do |subvalue|
+ if is_attr
+ o.extraattr[addname] = subvalue
+ else
+ child = from_obj(subvalue, namespace)
+ child.elename = addname
+ o.add(child)
+ end
+ end
+ else
+ if is_attr
+ o.extraattr[addname] = value
+ else
+ child = from_obj(value, namespace)
+ child.elename = addname
+ o.add(child)
+ end
+ end
+ end
+ else
+ o.text = obj.to_s
+ end
+ o
+ end
+
+ def self.parse_name(obj, namespace = nil)
+ qname = to_qname(obj, namespace)
+ if /\Axmlele_/ =~ qname.name
+ qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlele_/, ''))
+ return qname, false
+ elsif /\Axmlattr_/ =~ qname.name
+ qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlattr_/, ''))
+ return qname, true
+ else
+ return qname, false
+ end
+ end
+
+ def self.to_qname(obj, namespace = nil)
+ if obj.is_a?(XSD::QName)
+ obj
+ elsif /\A(.+):([^:]+)\z/ =~ obj.to_s
+ XSD::QName.new($1, $2)
+ else
+ XSD::QName.new(namespace, obj.to_s)
+ end
+ end
+end
+
+
+class SOAPRawData < SOAPElement
+ def initialize(obj)
+ super(XSD::QName::EMPTY)
+ @obj = obj
+ end
+
+ def to_xmlpart
+ @obj.to_xmlpart
+ end
+end
+
+
+class SOAPREXMLElementWrap
+ def initialize(ele)
+ @ele = ele
+ end
+
+ def to_xmlpart
+ @ele.to_s
+ end
+end
+
+
+class SOAPArray < XSD::NSDBase
+ include SOAPCompoundtype
+ include Enumerable
+
+public
+
+ attr_accessor :sparse
+
+ attr_reader :offset, :rank
+ attr_accessor :size, :size_fixed
+ attr_reader :arytype
+
+ def initialize(type = nil, rank = 1, arytype = nil)
+ super()
+ @type = type || ValueArrayName
+ @rank = rank
+ @data = Array.new
+ @sparse = false
+ @offset = Array.new(rank, 0)
+ @size = Array.new(rank, 0)
+ @size_fixed = false
+ @position = nil
+ @arytype = arytype
+ end
+
+ def offset=(var)
+ @offset = var
+ @sparse = true
+ end
+
+ def add(value)
+ self[*(@offset)] = value
+ end
+
+ def have_member
+ !@data.empty?
+ end
+
+ def [](*idxary)
+ if idxary.size != @rank
+ raise ArgumentError.new("given #{idxary.size} params does not match rank: #{@rank}")
+ end
+ retrieve(idxary)
+ end
+
+ def []=(*idxary)
+ value = idxary.slice!(-1)
+ if idxary.size != @rank
+ raise ArgumentError.new("given #{idxary.size} params(#{idxary}) does not match rank: #{@rank}")
+ end
+ idx = 0
+ while idx < idxary.size
+ if idxary[idx] + 1 > @size[idx]
+ @size[idx] = idxary[idx] + 1
+ end
+ idx += 1
+ end
+ data = retrieve(idxary[0, idxary.size - 1])
+ data[idxary.last] = value
+ if value.is_a?(SOAPType)
+ value.elename = ITEM_NAME
+ # Sync type
+ unless @type.name
+ @type = XSD::QName.new(value.type.namespace,
+ SOAPArray.create_arytype(value.type.name, @rank))
+ end
+ value.type ||= @type
+ end
+ @offset = idxary
+ value.parent = self if value.respond_to?(:parent=)
+ offsetnext
+ end
+
+ def each
+ @data.each do |data|
+ yield(data)
+ end
+ end
+
+ def to_a
+ @data.dup
+ end
+
+ def replace
+ @data = deep_map(@data) do |ele|
+ yield(ele)
+ end
+ end
+
+ def deep_map(ary, &block)
+ ary.collect do |ele|
+ if ele.is_a?(Array)
+ deep_map(ele, &block)
+ else
+ new_obj = block.call(ele)
+ new_obj.elename = ITEM_NAME
+ new_obj
+ end
+ end
+ end
+
+ def include?(var)
+ traverse_data(@data) do |v, *rank|
+ if v.is_a?(SOAPBasetype) && v.data == var
+ return true
+ end
+ end
+ false
+ end
+
+ def traverse
+ traverse_data(@data) do |v, *rank|
+ unless @sparse
+ yield(v)
+ else
+ yield(v, *rank) if v && !v.is_a?(SOAPNil)
+ end
+ end
+ end
+
+ def soap2array(ary)
+ traverse_data(@data) do |v, *position|
+ iteary = ary
+ rank = 1
+ while rank < position.size
+ idx = position[rank - 1]
+ if iteary[idx].nil?
+ iteary = iteary[idx] = Array.new
+ else
+ iteary = iteary[idx]
+ end
+ rank += 1
+ end
+ if block_given?
+ iteary[position.last] = yield(v)
+ else
+ iteary[position.last] = v
+ end
+ end
+ end
+
+ def position
+ @position
+ end
+
+private
+
+ ITEM_NAME = XSD::QName.new(nil, 'item')
+
+ def retrieve(idxary)
+ data = @data
+ rank = 1
+ while rank <= idxary.size
+ idx = idxary[rank - 1]
+ if data[idx].nil?
+ data = data[idx] = Array.new
+ else
+ data = data[idx]
+ end
+ rank += 1
+ end
+ data
+ end
+
+ def traverse_data(data, rank = 1)
+ idx = 0
+ while idx < ranksize(rank)
+ if rank < @rank and data[idx]
+ traverse_data(data[idx], rank + 1) do |*v|
+ v[1, 0] = idx
+ yield(*v)
+ end
+ else
+ yield(data[idx], idx)
+ end
+ idx += 1
+ end
+ end
+
+ def ranksize(rank)
+ @size[rank - 1]
+ end
+
+ def offsetnext
+ move = false
+ idx = @offset.size - 1
+ while !move && idx >= 0
+ @offset[idx] += 1
+ if @size_fixed
+ if @offset[idx] < @size[idx]
+ move = true
+ else
+ @offset[idx] = 0
+ idx -= 1
+ end
+ else
+ move = true
+ end
+ end
+ end
+
+ def self.decode(elename, type, arytype)
+ typestr, nofary = parse_type(arytype.name)
+ rank = nofary.count(',') + 1
+ plain_arytype = XSD::QName.new(arytype.namespace, typestr)
+ o = SOAPArray.new(type, rank, plain_arytype)
+ size = []
+ nofary.split(',').each do |s|
+ if s.empty?
+ size.clear
+ break
+ else
+ size << s.to_i
+ end
+ end
+ unless size.empty?
+ o.size = size
+ o.size_fixed = true
+ end
+ o.elename = elename
+ o
+ end
+
+ def self.create_arytype(typename, rank)
+ "#{typename}[" << ',' * (rank - 1) << ']'
+ end
+
+ TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$')
+
+ def self.parse_type(string)
+ TypeParseRegexp =~ string
+ return $1, $2
+ end
+end
+
+
+require 'soap/mapping/typeMap'
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/element.rb b/vendor/gems/soap4r-1.5.8/lib/soap/element.rb
new file mode 100644
index 00000000..edc3fb75
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/element.rb
@@ -0,0 +1,277 @@
+# SOAP4R - SOAP elements library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'soap/baseData'
+
+
+module SOAP
+
+
+###
+## SOAP elements
+#
+module SOAPEnvelopeElement; end
+
+class SOAPFault < SOAPStruct
+ include SOAPEnvelopeElement
+ include SOAPCompoundtype
+
+public
+
+ def faultcode
+ self['faultcode']
+ end
+
+ def faultstring
+ self['faultstring']
+ end
+
+ def faultactor
+ self['faultactor']
+ end
+
+ def detail
+ self['detail']
+ end
+
+ def faultcode=(rhs)
+ self['faultcode'] = rhs
+ end
+
+ def faultstring=(rhs)
+ self['faultstring'] = rhs
+ end
+
+ def faultactor=(rhs)
+ self['faultactor'] = rhs
+ end
+
+ def detail=(rhs)
+ self['detail'] = rhs
+ end
+
+ def initialize(faultcode = nil, faultstring = nil, faultactor = nil, detail = nil)
+ super(EleFaultName)
+ @elename = EleFaultName
+ @encodingstyle = EncodingNamespace
+ if faultcode
+ self.faultcode = faultcode
+ self.faultstring = faultstring
+ self.faultactor = faultactor
+ self.detail = detail
+ self.faultcode.elename = EleFaultCodeName if self.faultcode
+ self.faultstring.elename = EleFaultStringName if self.faultstring
+ self.faultactor.elename = EleFaultActorName if self.faultactor
+ self.detail.elename = EleFaultDetailName if self.detail
+ end
+ faultcode.parent = self if faultcode
+ faultstring.parent = self if faultstring
+ faultactor.parent = self if faultactor
+ detail.parent = self if detail
+ end
+
+ def encode(generator, ns, attrs = {})
+ Generator.assign_ns(attrs, ns, EnvelopeNamespace)
+ Generator.assign_ns(attrs, ns, EncodingNamespace)
+ attrs[ns.name(AttrEncodingStyleName)] = EncodingNamespace
+ name = ns.name(@elename)
+ generator.encode_tag(name, attrs)
+ yield(self.faultcode)
+ yield(self.faultstring)
+ yield(self.faultactor)
+ yield(self.detail) if self.detail
+ generator.encode_tag_end(name, true)
+ end
+end
+
+
+class SOAPBody < SOAPStruct
+ include SOAPEnvelopeElement
+
+ attr_reader :is_fault
+
+ def initialize(data = nil, is_fault = false)
+ super(nil)
+ @elename = EleBodyName
+ @encodingstyle = nil
+ if data
+ if data.respond_to?(:to_xmlpart)
+ data = SOAP::SOAPRawData.new(data)
+ elsif defined?(::REXML) and data.is_a?(::REXML::Element)
+ data = SOAP::SOAPRawData.new(SOAP::SOAPREXMLElementWrap.new(data))
+ end
+ if data.respond_to?(:elename)
+ add(data.elename.name, data)
+ else
+ data.to_a.each do |datum|
+ add(datum.elename.name, datum)
+ end
+ end
+ end
+ @is_fault = is_fault
+ end
+
+ def encode(generator, ns, attrs = {})
+ name = ns.name(@elename)
+ generator.encode_tag(name, attrs)
+ @data.each do |data|
+ yield(data)
+ end
+ generator.encode_tag_end(name, @data.size > 0)
+ end
+
+ def root_node
+ @data.each do |node|
+ if node.root == 1
+ return node
+ end
+ end
+ # No specified root...
+ @data.each do |node|
+ if node.root != 0
+ return node
+ end
+ end
+ raise Parser::FormatDecodeError.new('no root element')
+ end
+end
+
+
+class SOAPHeaderItem < XSD::NSDBase
+ include SOAPEnvelopeElement
+ include SOAPCompoundtype
+
+public
+
+ attr_accessor :element
+ attr_accessor :mustunderstand
+ attr_accessor :encodingstyle
+ attr_accessor :actor
+
+ def initialize(element, mustunderstand = true, encodingstyle = nil, actor = nil)
+ super()
+ @type = nil
+ @element = element
+ @mustunderstand = mustunderstand
+ @encodingstyle = encodingstyle
+ @actor = actor
+ element.parent = self if element
+ element.qualified = true
+ end
+
+ def encode(generator, ns, attrs = {})
+ attrs.each do |key, value|
+ @element.extraattr[key] = value
+ end
+ # to remove mustUnderstand attribute, set it to nil
+ unless @mustunderstand.nil?
+ @element.extraattr[AttrMustUnderstandName] = (@mustunderstand ? '1' : '0')
+ end
+ if @encodingstyle
+ @element.extraattr[AttrEncodingStyleName] = @encodingstyle
+ end
+ unless @element.encodingstyle
+ @element.encodingstyle = @encodingstyle
+ end
+ if @actor
+ @element.extraattr[AttrActorName] = @actor
+ end
+ yield(@element)
+ end
+end
+
+
+class SOAPHeader < SOAPStruct
+ include SOAPEnvelopeElement
+
+ attr_writer :force_encode
+
+ def initialize
+ super(nil)
+ @elename = EleHeaderName
+ @encodingstyle = nil
+ @force_encode = false
+ end
+
+ def encode(generator, ns, attrs = {})
+ name = ns.name(@elename)
+ generator.encode_tag(name, attrs)
+ @data.each do |data|
+ yield(data)
+ end
+ generator.encode_tag_end(name, @data.size > 0)
+ end
+
+ def add(name, value)
+ actor = value.extraattr[AttrActorName]
+ mu = value.extraattr[AttrMustUnderstandName]
+ encstyle = value.extraattr[AttrEncodingStyleName]
+ mu_value = mu.nil? ? nil : (mu == '1')
+ # to remove mustUnderstand attribute, set it to nil
+ item = SOAPHeaderItem.new(value, mu_value, encstyle, actor)
+ super(name, item)
+ end
+
+ def length
+ @data.length
+ end
+ alias size length
+
+ def encode?
+ @force_encode or length > 0
+ end
+end
+
+
+class SOAPEnvelope < XSD::NSDBase
+ include SOAPEnvelopeElement
+ include SOAPCompoundtype
+
+ attr_reader :header
+ attr_reader :body
+ attr_reader :external_content
+
+ def initialize(header = nil, body = nil)
+ super()
+ @type = nil
+ @elename = EleEnvelopeName
+ @encodingstyle = nil
+ @header = header
+ @body = body
+ @external_content = {}
+ header.parent = self if header
+ body.parent = self if body
+ end
+
+ def header=(header)
+ header.parent = self
+ @header = header
+ end
+
+ def body=(body)
+ body.parent = self
+ @body = body
+ end
+
+ def encode(generator, ns, attrs = {})
+ Generator.assign_ns(attrs, ns, elename.namespace)
+ name = ns.name(@elename)
+ generator.encode_tag(name, attrs)
+ yield(@header) if @header and @header.encode?
+ yield(@body)
+ generator.encode_tag_end(name, true)
+ end
+
+ def to_ary
+ [header, body]
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb
new file mode 100644
index 00000000..ce6c450b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb
@@ -0,0 +1,207 @@
+# SOAP4R - ASP.NET EncodingStyle handler library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/encodingstyle/handler'
+
+
+module SOAP
+module EncodingStyle
+
+
+class ASPDotNetHandler < Handler
+ Namespace = 'http://tempuri.org/ASP.NET'
+ add_handler
+
+ def initialize(charset = nil)
+ super(charset)
+ @textbuf = ''
+ @decode_typemap = nil
+ end
+
+
+ ###
+ ## encode interface.
+ #
+ def encode_data(generator, ns, data, parent)
+ attrs = {}
+ # ASPDotNetHandler is intended to be used for accessing an ASP.NET doc/lit
+ # service as an rpc/encoded service. in the situation, local elements
+ # should be qualified. propagate parent's namespace to children.
+ if data.elename.namespace.nil?
+ data.elename =
+ XSD::QName.new(parent.elename.namespace, data.elename.name)
+ end
+ name = generator.encode_name(ns, data, attrs)
+ case data
+ when SOAPRawString
+ generator.encode_tag(name, attrs)
+ generator.encode_rawstring(data.to_s)
+ when XSD::XSDString
+ generator.encode_tag(name, attrs)
+ generator.encode_string(@charset ?
+ XSD::Charset.encoding_to_xml(data.to_s, @charset) : data.to_s)
+ when XSD::XSDAnySimpleType
+ generator.encode_tag(name, attrs)
+ generator.encode_string(data.to_s)
+ when SOAPStruct
+ generator.encode_tag(name, attrs)
+ data.each do |key, value|
+ generator.encode_child(ns, value, data)
+ end
+ when SOAPArray
+ generator.encode_tag(name, attrs)
+ data.traverse do |child, *rank|
+ data.position = nil
+ generator.encode_child(ns, child, data)
+ end
+ else
+ raise EncodingStyleError.new(
+ "unknown object:#{data} in this encodingStyle")
+ end
+ end
+
+ def encode_data_end(generator, ns, data, parent)
+ name = generator.encode_name_end(ns, data)
+ cr = (data.is_a?(SOAPCompoundtype) and data.have_member)
+ generator.encode_tag_end(name, cr)
+ end
+
+
+ ###
+ ## decode interface.
+ #
+ class SOAPTemporalObject
+ attr_accessor :parent
+
+ def initialize
+ @parent = nil
+ end
+ end
+
+ class SOAPUnknown < SOAPTemporalObject
+ def initialize(handler, elename)
+ super()
+ @handler = handler
+ @elename = elename
+ end
+
+ def as_struct
+ o = SOAPStruct.decode(@elename, XSD::AnyTypeName)
+ o.parent = @parent
+ o.type.name = @name
+ @handler.decode_parent(@parent, o)
+ o
+ end
+
+ def as_string
+ o = SOAPString.decode(@elename)
+ o.parent = @parent
+ @handler.decode_parent(@parent, o)
+ o
+ end
+ end
+
+ def decode_tag(ns, elename, attrs, parent)
+ @textbuf = ''
+ o = SOAPUnknown.new(self, elename)
+ o.parent = parent
+ o
+ end
+
+ def decode_tag_end(ns, node)
+ o = node.node
+ if o.is_a?(SOAPUnknown)
+ newnode = o.as_string
+# if /\A\s*\z/ =~ @textbuf
+# o.as_struct
+# else
+# o.as_string
+# end
+ node.replace_node(newnode)
+ o = node.node
+ end
+
+ decode_textbuf(o)
+ @textbuf = ''
+ end
+
+ def decode_text(ns, text)
+ # @textbuf is set at decode_tag_end.
+ @textbuf << text
+ end
+
+ def decode_prologue
+ end
+
+ def decode_epilogue
+ end
+
+ def decode_parent(parent, node)
+ case parent.node
+ when SOAPUnknown
+ newparent = parent.node.as_struct
+ node.parent = newparent
+ parent.replace_node(newparent)
+ decode_parent(parent, node)
+
+ when SOAPStruct
+ data = parent.node[node.elename.name]
+ case data
+ when nil
+ parent.node.add(node.elename.name, node)
+ when SOAPArray
+ name, type_ns = node.elename.name, node.type.namespace
+ data.add(node)
+ node.elename, node.type.namespace = name, type_ns
+ else
+ parent.node[node.elename.name] = SOAPArray.new
+ name, type_ns = data.elename.name, data.type.namespace
+ parent.node[node.elename.name].add(data)
+ data.elename.name, data.type.namespace = name, type_ns
+ name, type_ns = node.elename.name, node.type.namespace
+ parent.node[node.elename.name].add(node)
+ node.elename.name, node.type.namespace = name, type_ns
+ end
+
+ when SOAPArray
+ if node.position
+ parent.node[*(decode_arypos(node.position))] = node
+ parent.node.sparse = true
+ else
+ parent.node.add(node)
+ end
+
+ when SOAPBasetype
+ raise EncodingStyleError.new("SOAP base type must not have a child")
+
+ else
+ # SOAPUnknown does not have parent.
+ # raise EncodingStyleError.new("illegal parent: #{parent}")
+ end
+ end
+
+private
+
+ def decode_textbuf(node)
+ if node.is_a?(XSD::XSDString)
+ if @charset
+ node.set(XSD::Charset.encoding_from_xml(@textbuf, @charset))
+ else
+ node.set(@textbuf)
+ end
+ else
+ # Nothing to do...
+ end
+ end
+end
+
+ASPDotNetHandler.new
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb
new file mode 100644
index 00000000..90389aa0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb
@@ -0,0 +1,120 @@
+# SOAP4R - EncodingStyle handler library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/baseData'
+require 'soap/element'
+
+
+module SOAP
+module EncodingStyle
+
+
+class Handler
+ @@handlers = {}
+
+ class EncodingStyleError < Error; end
+
+ class << self
+ def uri
+ self::Namespace
+ end
+
+ def handler(uri)
+ @@handlers[uri]
+ end
+
+ def each
+ @@handlers.each do |key, value|
+ yield(value)
+ end
+ end
+
+ private
+
+ def add_handler
+ @@handlers[self.uri] = self
+ end
+ end
+
+ attr_reader :charset
+ attr_accessor :generate_explicit_type
+ def decode_typemap=(definedtypes)
+ @decode_typemap = definedtypes
+ end
+
+ def initialize(charset)
+ @charset = charset
+ @generate_explicit_type = true
+ @decode_typemap = nil
+ end
+
+ ###
+ ## encode interface.
+ #
+ # Returns a XML instance as a string.
+ def encode_data(generator, ns, data, parent)
+ raise NotImplementError
+ end
+
+ def encode_data_end(generator, ns, data, parent)
+ raise NotImplementError
+ end
+
+ def encode_prologue
+ end
+
+ def encode_epilogue
+ end
+
+ ###
+ ## decode interface.
+ #
+ # Returns SOAP/OM data.
+ def decode_tag(ns, name, attrs, parent)
+ raise NotImplementError
+ end
+
+ def decode_tag_end(ns, name)
+ raise NotImplementError
+ end
+
+ def decode_text(ns, text)
+ raise NotImplementError
+ end
+
+ def decode_prologue
+ end
+
+ def decode_epilogue
+ end
+
+ def encode_attr_key(attrs, ns, qname)
+ if qname.namespace.nil?
+ qname.name
+ else
+ unless ns.assigned_as_tagged?(qname.namespace)
+ Generator.assign_ns!(attrs, ns, qname.namespace)
+ end
+ ns.name_attr(qname)
+ end
+ end
+
+ def encode_qname(attrs, ns, qname)
+ if qname.namespace.nil?
+ qname.name
+ else
+ Generator.assign_ns(attrs, ns, qname.namespace)
+ ns.name(qname)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb
new file mode 100644
index 00000000..6327edb0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb
@@ -0,0 +1,195 @@
+# SOAP4R - XML Literal EncodingStyle handler library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/encodingstyle/handler'
+
+
+module SOAP
+module EncodingStyle
+
+
+class LiteralHandler < Handler
+ Namespace = SOAP::LiteralNamespace
+ add_handler
+
+ def initialize(charset = nil)
+ super(charset)
+ @textbuf = []
+ end
+
+
+ ###
+ ## encode interface.
+ #
+ def encode_data(generator, ns, data, parent)
+ attrs = {}
+ name = generator.encode_name(ns, data, attrs)
+ if data.type and data.type.name and
+ (@generate_explicit_type or data.force_typed)
+ data.extraattr[XSD::AttrTypeName] = data.type
+ end
+ data.extraattr.each do |key, value|
+ keytag = key
+ if key.is_a?(XSD::QName)
+ keytag = encode_attr_key(attrs, ns, key)
+ end
+ if value.is_a?(XSD::QName)
+ value = encode_qname(attrs, ns, value)
+ end
+ attrs[keytag] = value
+ end
+ case data
+ when SOAPExternalReference
+ # do not encode SOAPExternalReference in
+ # literalHandler (which is used for literal service)
+ data.referred
+ when SOAPRawString
+ generator.encode_tag(name, attrs)
+ generator.encode_rawstring(data.to_s)
+ when XSD::XSDString
+ generator.encode_tag(name, attrs)
+ str = decode_str(data.to_s)
+ generator.encode_string(str)
+ when XSD::XSDAnySimpleType
+ generator.encode_tag(name, attrs)
+ generator.encode_string(data.to_s)
+ when SOAPStruct
+ generator.encode_tag(name, attrs)
+ data.each do |key, value|
+ generator.encode_child(ns, value, data)
+ end
+ when SOAPArray
+ generator.encode_tag(name, attrs)
+ data.traverse do |child, *rank|
+ data.position = nil
+ generator.encode_child(ns, child, data)
+ end
+ when SOAPElement
+ unless generator.use_default_namespace
+ # passes 2 times for simplifying namespace definition
+ data.each do |key, value|
+ if value.elename.namespace
+ Generator.assign_ns(attrs, ns, value.elename.namespace)
+ end
+ end
+ end
+ if data.text and data.text.is_a?(XSD::QName)
+ Generator.assign_ns(attrs, ns, data.text.namespace)
+ end
+ generator.encode_tag(name, attrs)
+ if data.text
+ if data.text.is_a?(XSD::QName)
+ text = ns.name(data.text)
+ else
+ text = data.text
+ end
+ generator.encode_string(text)
+ end
+ data.each do |key, value|
+ generator.encode_child(ns, value, data)
+ end
+ else
+ raise EncodingStyleError.new(
+ "unknown object:#{data} in this encodingStyle")
+ end
+ end
+
+ def encode_data_end(generator, ns, data, parent)
+ # do not encode SOAPExternalReference in
+ # literalHandler (which is used for literal service)
+ return nil if data.is_a?(SOAPExternalReference)
+ name = generator.encode_name_end(ns, data)
+ cr = (data.is_a?(SOAPCompoundtype) and data.have_member)
+ generator.encode_tag_end(name, cr)
+ end
+
+
+ ###
+ ## decode interface.
+ #
+ def decode_tag(ns, elename, attrs, parent)
+ @textbuf.clear
+ if attrs[XSD::AttrNilName] == 'true'
+ o = SOAPNil.decode(elename)
+ else
+ o = SOAPElement.decode(elename)
+ end
+ if definedtype = attrs[XSD::AttrTypeName]
+ o.type = ns.parse(definedtype)
+ end
+ o.parent = parent
+ o.extraattr.update(attrs)
+ decode_parent(parent, o)
+ o
+ end
+
+ def decode_tag_end(ns, node)
+ textbufstr = @textbuf.join
+ @textbuf.clear
+ o = node.node
+ decode_textbuf(o, textbufstr)
+ end
+
+ def decode_text(ns, text)
+ # @textbuf is set at decode_tag_end.
+ @textbuf << text
+ end
+
+ def decode_prologue
+ end
+
+ def decode_epilogue
+ end
+
+ def decode_parent(parent, node)
+ return unless parent.node
+ case parent.node
+ when SOAPElement
+ parent.node.add(node)
+ node.parent = parent.node
+ when SOAPStruct
+ parent.node.add(node.elename.name, node)
+ node.parent = parent.node
+ when SOAPArray
+ if node.position
+ parent.node[*(decode_arypos(node.position))] = node
+ parent.node.sparse = true
+ else
+ parent.node.add(node)
+ end
+ node.parent = parent.node
+ else
+ raise EncodingStyleError.new("illegal parent: #{parent.node}")
+ end
+ end
+
+private
+
+ def decode_textbuf(node, textbufstr)
+ case node
+ when XSD::XSDString, SOAPElement
+ if @charset
+ node.set(decode_str(textbufstr))
+ else
+ node.set(textbufstr)
+ end
+ else
+ # Nothing to do...
+ end
+ end
+
+ def decode_str(str)
+ @charset ? XSD::Charset.encoding_from_xml(str, @charset) : str
+ end
+end
+
+LiteralHandler.new
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb
new file mode 100644
index 00000000..a14f533d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb
@@ -0,0 +1,559 @@
+# SOAP4R - SOAP EncodingStyle handler library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/encodingstyle/handler'
+require 'soap/mapping/registry'
+
+
+module SOAP
+module EncodingStyle
+
+
+class SOAPHandler < Handler
+ Namespace = SOAP::EncodingNamespace
+ add_handler
+
+ def initialize(charset = nil)
+ super(charset)
+ @refpool = []
+ @idpool = []
+ @textbuf = []
+ @is_first_top_ele = true
+ end
+
+
+ ###
+ ## encode interface.
+ #
+ def encode_data(generator, ns, data, parent)
+ attrs = encode_attrs(generator, ns, data, parent)
+ if parent && parent.is_a?(SOAPArray) && parent.position
+ attrs[ns.name(AttrPositionName)] = "[#{parent.position.join(',')}]"
+ end
+ name = generator.encode_name(ns, data, attrs)
+ case data
+ when SOAPReference
+ attrs['href'] = data.refidstr
+ generator.encode_tag(name, attrs)
+ when SOAPExternalReference
+ data.referred
+ attrs['href'] = data.refidstr
+ generator.encode_tag(name, attrs)
+ when SOAPRawString
+ generator.encode_tag(name, attrs)
+ generator.encode_rawstring(data.to_s)
+ when XSD::XSDString
+ generator.encode_tag(name, attrs)
+ generator.encode_string(@charset ?
+ XSD::Charset.encoding_to_xml(data.to_s, @charset) : data.to_s)
+ when XSD::XSDAnySimpleType
+ generator.encode_tag(name, attrs)
+ generator.encode_string(data.to_s)
+ when SOAPStruct
+ generator.encode_tag(name, attrs)
+ data.each do |key, value|
+ generator.encode_child(ns, value, data)
+ end
+ when SOAPArray
+ generator.encode_tag(name, attrs)
+ data.traverse do |child, *rank|
+ data.position = data.sparse ? rank : nil
+ generator.encode_child(ns, child, data)
+ end
+ else
+ raise EncodingStyleError.new(
+ "unknown object:#{data} in this encodingStyle")
+ end
+ end
+
+ def encode_data_end(generator, ns, data, parent)
+ name = generator.encode_name_end(ns, data)
+ cr = (data.is_a?(SOAPCompoundtype) and data.have_member)
+ generator.encode_tag_end(name, cr)
+ end
+
+
+ ###
+ ## decode interface.
+ #
+ class SOAPTemporalObject
+ attr_accessor :parent
+ attr_accessor :position
+ attr_accessor :id
+ attr_accessor :root
+
+ def initialize
+ @parent = nil
+ @position = nil
+ @id = nil
+ @root = nil
+ end
+ end
+
+ class SOAPUnknown < SOAPTemporalObject
+ attr_reader :type
+ attr_accessor :definedtype
+ attr_reader :extraattr
+
+ def initialize(handler, elename, type, extraattr)
+ super()
+ @handler = handler
+ @elename = elename
+ @type = type
+ @extraattr = extraattr
+ @definedtype = nil
+ end
+
+ def as_struct
+ if @extraattr[XSD::AttrNilName] == 'true'
+ return as_nil
+ end
+ o = SOAPStruct.decode(@elename, @type)
+ o.id = @id
+ o.root = @root
+ o.parent = @parent
+ o.position = @position
+ o.extraattr.update(@extraattr)
+ @handler.decode_parent(@parent, o)
+ o
+ end
+
+ def as_string
+ if @extraattr[XSD::AttrNilName] == 'true'
+ return as_nil
+ end
+ o = SOAPString.decode(@elename)
+ o.id = @id
+ o.root = @root
+ o.parent = @parent
+ o.position = @position
+ o.extraattr.update(@extraattr)
+ @handler.decode_parent(@parent, o)
+ o
+ end
+
+ def as_nil
+ o = SOAPNil.decode(@elename)
+ o.id = @id
+ o.root = @root
+ o.parent = @parent
+ o.position = @position
+ o.extraattr.update(@extraattr)
+ @handler.decode_parent(@parent, o)
+ o
+ end
+ end
+
+ def decode_tag(ns, elename, attrs, parent)
+ @textbuf.clear
+ is_nil, type, arytype, root, offset, position, href, id =
+ extract_attrs(ns, attrs)
+ o = nil
+ if is_nil
+ o = SOAPNil.decode(elename)
+ elsif href
+ o = SOAPReference.decode(elename, href)
+ @refpool << o
+ elsif @decode_typemap
+ o = decode_tag_by_wsdl(ns, elename, type, parent.node, arytype, attrs)
+ else
+ o = decode_tag_by_type(ns, elename, type, parent.node, arytype, attrs)
+ end
+
+ if o.is_a?(SOAPArray)
+ if offset
+ o.offset = decode_arypos(offset)
+ o.sparse = true
+ else
+ o.sparse = false
+ end
+ end
+
+ o.parent = parent
+ o.id = id
+ o.root = root
+ o.position = position
+
+ unless o.is_a?(SOAPTemporalObject)
+ @idpool << o if o.id
+ decode_parent(parent, o)
+ end
+ o
+ end
+
+ def decode_tag_end(ns, node)
+ textbufstr = @textbuf.join
+ @textbuf.clear
+ o = node.node
+ if o.is_a?(SOAPUnknown)
+ newnode = if /\A\s*\z/ =~ textbufstr
+ o.as_struct
+ else
+ o.as_string
+ end
+ if newnode.id
+ @idpool << newnode
+ end
+ node.replace_node(newnode)
+ o = node.node
+ end
+ decode_textbuf(o, textbufstr)
+ # unlink definedtype
+ o.definedtype = nil
+ end
+
+ def decode_text(ns, text)
+ @textbuf << text
+ end
+
+ def decode_prologue
+ @refpool.clear
+ @idpool.clear
+ @is_first_top_ele = true
+ end
+
+ def decode_epilogue
+ decode_resolve_id
+ end
+
+ def decode_parent(parent, node)
+ return unless parent.node
+ case parent.node
+ when SOAPUnknown
+ newparent = parent.node.as_struct
+ node.parent = newparent
+ if newparent.id
+ @idpool << newparent
+ end
+ parent.replace_node(newparent)
+ decode_parent(parent, node)
+ when SOAPStruct
+ parent.node.add(node.elename.name, node)
+ node.parent = parent.node
+ when SOAPArray
+ if node.position
+ parent.node[*(decode_arypos(node.position))] = node
+ parent.node.sparse = true
+ else
+ parent.node.add(node)
+ end
+ node.parent = parent.node
+ else
+ raise EncodingStyleError.new("illegal parent: #{parent.node}")
+ end
+ end
+
+private
+
+ def content_ranksize(typename)
+ typename.scan(/\[[\d,]*\]$/)[0]
+ end
+
+ def content_typename(typename)
+ typename.sub(/\[,*\]$/, '')
+ end
+
+ def create_arytype(ns, data)
+ XSD::QName.new(data.arytype.namespace,
+ content_typename(data.arytype.name) + "[#{data.size.join(',')}]")
+ end
+
+ def encode_attrs(generator, ns, data, parent)
+ attrs = {}
+ return attrs if data.is_a?(SOAPReference)
+
+ if !parent || parent.encodingstyle != EncodingNamespace
+ if @generate_explicit_type
+ Generator.assign_ns(attrs, ns, EnvelopeNamespace)
+ attrs[ns.name(AttrEncodingStyleName)] = EncodingNamespace
+ end
+ data.encodingstyle = EncodingNamespace
+ end
+
+ if data.is_a?(SOAPNil)
+ attrs[ns.name(XSD::AttrNilName)] = XSD::NilValue
+ elsif @generate_explicit_type
+ if data.type.namespace
+ Generator.assign_ns(attrs, ns, data.type.namespace)
+ end
+ if data.is_a?(SOAPArray)
+ if data.arytype.namespace
+ Generator.assign_ns(attrs, ns, data.arytype.namespace)
+ end
+ Generator.assign_ns(attrs, ns, EncodingNamespace)
+ attrs[ns.name(AttrArrayTypeName)] = ns.name(create_arytype(ns, data))
+ if data.type.name
+ attrs[ns.name(XSD::AttrTypeName)] = ns.name(data.type)
+ end
+ elsif parent && parent.is_a?(SOAPArray) && (parent.arytype == data.type)
+ # No need to add.
+ elsif !data.type.namespace
+ # No need to add.
+ else
+ attrs[ns.name(XSD::AttrTypeName)] = ns.name(data.type)
+ end
+ end
+ data.extraattr.each do |key, value|
+ keytag = key
+ if key.is_a?(XSD::QName)
+ keytag = encode_attr_key(attrs, ns, key)
+ end
+ if value.is_a?(XSD::QName)
+ value = encode_qname(attrs, ns, value)
+ else
+ value = encode_attr_value(generator, ns, key, value)
+ end
+ attrs[keytag] = value
+ end
+ if data.id
+ attrs['id'] = data.id
+ end
+ attrs
+ end
+
+ def encode_attr_value(generator, ns, qname, value)
+ case value
+ when SOAPType
+ ref = SOAPReference.new(value)
+ generator.add_reftarget(qname.name, value)
+ ref.refidstr
+ else
+ value.to_s
+ end
+ end
+
+ def decode_tag_by_wsdl(ns, elename, typestr, parent, arytypestr, attrs)
+ o = nil
+ if parent.class == SOAPBody
+ # root element: should branch by root attribute?
+ if @is_first_top_ele
+ # Unqualified name is allowed here.
+ @is_first_top_ele = false
+ type = @decode_typemap[elename] ||
+ @decode_typemap.find_name(elename.name)
+ if type
+ o = SOAPStruct.new(elename)
+ o.elename = elename
+ o.definedtype = type
+ return o
+ end
+ end
+ # multi-ref element.
+ if typestr
+ typename = ns.parse(typestr)
+ typedef = @decode_typemap[typename]
+ if typedef
+ return decode_definedtype(elename, typename, typedef, arytypestr)
+ end
+ end
+ return decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs)
+ end
+
+ if parent.type == XSD::AnyTypeName
+ return decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs)
+ end
+
+ # parent.definedtype == nil means the parent is SOAPUnknown. SOAPUnknown
+ # is generated by decode_tag_by_type when its type is anyType.
+ parenttype = parent.definedtype || @decode_typemap[parent.type]
+ unless parenttype
+ return decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs)
+ end
+
+ definedtype_name = parenttype.child_type(elename)
+ if definedtype_name and (klass = TypeMap[definedtype_name])
+ return decode_basetype(klass, elename)
+ elsif definedtype_name == XSD::AnyTypeName
+ return decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs)
+ end
+
+ if definedtype_name
+ typedef = @decode_typemap[definedtype_name]
+ else
+ typedef = parenttype.child_defined_complextype(elename)
+ end
+ decode_definedtype(elename, definedtype_name, typedef, arytypestr)
+ end
+
+ def decode_definedtype(elename, typename, typedef, arytypestr)
+ unless typedef
+ raise EncodingStyleError.new("unknown type '#{typename}'")
+ end
+ if typedef.is_a?(::WSDL::XMLSchema::SimpleType)
+ decode_defined_simpletype(elename, typename, typedef, arytypestr)
+ else
+ decode_defined_complextype(elename, typename, typedef, arytypestr)
+ end
+ end
+
+ def decode_basetype(klass, elename)
+ klass.decode(elename)
+ end
+
+ def decode_defined_simpletype(elename, typename, typedef, arytypestr)
+ if typedef.base
+ o = decode_basetype(TypeMap[typedef.base], elename)
+ o.definedtype = typedef
+ o
+ else
+ raise RuntimeError.new("unsupported simpleType: #{typedef}")
+ end
+ end
+
+ def decode_defined_complextype(elename, typename, typedef, arytypestr)
+ case typedef.compoundtype
+ when :TYPE_STRUCT, :TYPE_MAP
+ o = SOAPStruct.decode(elename, typename)
+ o.definedtype = typedef
+ return o
+ when :TYPE_ARRAY
+ expected_arytype = typedef.find_arytype
+ if arytypestr
+ actual_arytype = XSD::QName.new(expected_arytype.namespace,
+ content_typename(expected_arytype.name) <<
+ content_ranksize(arytypestr))
+ o = SOAPArray.decode(elename, typename, actual_arytype)
+ else
+ o = SOAPArray.new(typename, 1, expected_arytype)
+ o.elename = elename
+ end
+ o.definedtype = typedef
+ return o
+ when :TYPE_EMPTY
+ o = SOAPNil.decode(elename)
+ o.definedtype = typedef
+ return o
+ else
+ raise RuntimeError.new(
+ "Unknown kind of complexType: #{typedef.compoundtype}")
+ end
+ nil
+ end
+
+ def decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs)
+ if arytypestr
+ type = typestr ? ns.parse(typestr) : ValueArrayName
+ node = SOAPArray.decode(elename, type, ns.parse(arytypestr))
+ node.extraattr.update(attrs)
+ return node
+ end
+
+ type = nil
+ if typestr
+ type = ns.parse(typestr)
+ elsif parent.is_a?(SOAPArray)
+ type = parent.arytype
+ else
+ # Since it's in dynamic(without any type) encoding process,
+ # assumes entity as its type itself.
+ # => type Array in SOAP-ENC.
+ # => type Country in foo.
+ type = elename
+ end
+
+ if klass = TypeMap[type]
+ node = decode_basetype(klass, elename)
+ node.extraattr.update(attrs)
+ return node
+ end
+
+ # Unknown type... Struct or String
+ SOAPUnknown.new(self, elename, type, attrs)
+ end
+
+ def decode_textbuf(node, textbufstr)
+ case node
+ when XSD::XSDHexBinary, XSD::XSDBase64Binary
+ node.set_encoded(textbufstr)
+ when XSD::XSDString
+ if @charset
+ textbufstr = XSD::Charset.encoding_from_xml(textbufstr, @charset)
+ end
+ if node.definedtype
+ node.definedtype.check_lexical_format(textbufstr)
+ end
+ node.set(textbufstr)
+ when SOAPNil
+ # Nothing to do.
+ when SOAPBasetype
+ node.set(textbufstr)
+ else
+ # Nothing to do...
+ end
+ end
+
+ NilLiteralMap = {
+ 'true' => true,
+ '1' => true,
+ 'false' => false,
+ '0' => false
+ }
+ RootLiteralMap = {
+ '1' => 1,
+ '0' => 0
+ }
+ def extract_attrs(ns, attrs)
+ is_nil = NilLiteralMap[attrs[XSD::AttrNilName]]
+ type = attrs[XSD::AttrTypeName]
+ arytype = attrs[AttrArrayTypeName]
+ root = attrs[AttrRootName]
+ offset = attrs[AttrOffsetName]
+ position = attrs[AttrPositionName]
+ href = attrs[AttrHrefName]
+ id = attrs[AttrIdName]
+ if attrs.key?(Mapping::RubyIVarName)
+ attrs[Mapping::RubyIVarName] =
+ decode_ref_value(ns, attrs[Mapping::RubyIVarName])
+ end
+ return is_nil, type, arytype, root, offset, position, href, id
+ end
+
+ def decode_ref_value(ns, value)
+ if /\A#/ =~ value
+ o = SOAPReference.decode(nil, value)
+ @refpool << o
+ o
+ else
+ value
+ end
+ end
+
+ def decode_arypos(position)
+ /^\[(.+)\]$/ =~ position
+ $1.split(',').collect { |s| s.to_i }
+ end
+
+ def decode_resolve_id
+ count = @refpool.length # To avoid infinite loop
+ while !@refpool.empty? && count > 0
+ @refpool = @refpool.find_all { |ref|
+ o = @idpool.find { |item|
+ item.id == ref.refid
+ }
+ if o.is_a?(SOAPReference)
+ true # link of link.
+ elsif o
+ ref.__setobj__(o)
+ false
+ elsif o = ref.rootnode.external_content[ref.refid]
+ ref.__setobj__(o)
+ false
+ else
+ raise EncodingStyleError.new("unresolved reference: #{ref.refid}")
+ end
+ }
+ count -= 1
+ end
+ end
+end
+
+SOAPHandler.new
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb
new file mode 100644
index 00000000..83cc7bf7
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb
@@ -0,0 +1,13 @@
+# SOAP4R - SOAP filter.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/filter/filterchain'
+# envelope filter
+require 'soap/filter/handler'
+# steram filter
+require 'soap/filter/streamhandler'
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb
new file mode 100644
index 00000000..54d821a2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb
@@ -0,0 +1,51 @@
+# SOAP4R - SOAP filter chain.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/filter/handler'
+
+
+module SOAP
+module Filter
+
+
+class FilterChain
+
+ def each
+ @array.each do |filter|
+ yield filter
+ end
+ end
+
+ def reverse_each
+ @array.reverse_each do |filter|
+ yield filter
+ end
+ end
+
+ def initialize
+ @array = []
+ end
+
+ def add(filter)
+ @array << filter
+ end
+ alias << add
+
+ def delete(filter)
+ @array.delete(filter)
+ end
+
+ def include?(filter)
+ @array.include?(filter)
+ end
+
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb
new file mode 100644
index 00000000..1fde5cd0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb
@@ -0,0 +1,31 @@
+# SOAP4R - SOAP envelope filter base class.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+module Filter
+
+
+class Handler
+
+ # should return envelope. opt can be updated for other filters.
+ def on_outbound(envelope, opt)
+ # do something.
+ envelope
+ end
+
+ # should return xml. opt can be updated for other filters.
+ def on_inbound(xml, opt)
+ # do something.
+ xml
+ end
+
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb
new file mode 100644
index 00000000..868f786c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb
@@ -0,0 +1,29 @@
+# SOAP4R - SOAP stream filter base class.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+module Filter
+
+
+class StreamHandler
+
+ # no returning value expected.
+ def on_http_outbound(req)
+ # do something.
+ end
+
+ # no returning value expected.
+ def on_http_inbound(req, res)
+ # do something.
+ end
+
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb b/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb
new file mode 100644
index 00000000..3968410d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb
@@ -0,0 +1,299 @@
+# SOAP4R - SOAP XML Instance Generator library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/ns'
+require 'soap/baseData'
+require 'soap/encodingstyle/handler'
+require 'xsd/codegen/gensupport'
+
+
+module SOAP
+
+
+###
+## CAUTION: MT-unsafe
+#
+class Generator
+ include SOAP
+ include XSD::CodeGen::GenSupport
+
+ class FormatEncodeError < Error; end
+
+public
+
+ attr_accessor :charset
+ attr_accessor :default_encodingstyle
+ attr_accessor :generate_explicit_type
+ attr_accessor :use_numeric_character_reference
+ attr_accessor :use_default_namespace
+
+ def initialize(opt = {})
+ @reftarget = nil
+ @handlers = {}
+ @charset = opt[:charset] || XSD::Charset.xml_encoding_label
+ @default_encodingstyle = opt[:default_encodingstyle] || EncodingNamespace
+ @generate_explicit_type =
+ opt.key?(:generate_explicit_type) ? opt[:generate_explicit_type] : true
+ @use_default_namespace = opt[:use_default_namespace]
+ @attributeformdefault = opt[:attributeformdefault]
+ @use_numeric_character_reference = opt[:use_numeric_character_reference]
+ @indentstr = opt[:no_indent] ? '' : ' '
+ @buf = @indent = @curr = nil
+ @default_ns = opt[:default_ns]
+ @default_ns_tag = opt[:default_ns_tag]
+ end
+
+ def generate(obj, io = nil)
+ @buf = io || ''
+ @indent = ''
+ @encode_char_regexp = get_encode_char_regexp()
+
+ prologue
+ @handlers.each do |uri, handler|
+ handler.encode_prologue
+ end
+
+ ns = SOAP::NS.new
+ if @default_ns
+ @default_ns.each_ns do |default_ns, default_tag|
+ Generator.assign_ns(obj.extraattr, ns, default_ns, default_tag)
+ end
+ end
+ if @default_ns_tag
+ @default_ns_tag.each_ns do |default_ns, default_tag|
+ ns.known_tag[default_ns] = default_tag
+ end
+ end
+ @buf << xmldecl
+ encode_data(ns, obj, nil)
+
+ @handlers.each do |uri, handler|
+ handler.encode_epilogue
+ end
+ epilogue
+
+ @buf
+ end
+
+ def encode_data(ns, obj, parent)
+ if obj.respond_to?(:to_xmlpart)
+ formatted = trim_eol(obj.to_xmlpart)
+ formatted = trim_indent(formatted)
+ formatted = formatted.gsub(/^/, @indent).sub(/\n+\z/, '')
+ @buf << "\n#{formatted}"
+ return
+ elsif obj.is_a?(SOAPEnvelopeElement)
+ encode_element(ns, obj, parent)
+ return
+ end
+ if @reftarget && !obj.precedents.empty?
+ add_reftarget(obj.elename.name, obj)
+ ref = SOAPReference.new(obj)
+ ref.elename = ref.elename.dup_name(obj.elename.name)
+ obj.precedents.clear # Avoid cyclic delay.
+ obj.encodingstyle = parent.encodingstyle
+ # SOAPReference is encoded here.
+ obj = ref
+ end
+ encodingstyle = obj.encodingstyle
+ # Children's encodingstyle is derived from its parent.
+ encodingstyle ||= parent.encodingstyle if parent
+ obj.encodingstyle = encodingstyle
+ handler = find_handler(encodingstyle || @default_encodingstyle)
+ unless handler
+ raise FormatEncodeError.new("Unknown encodingStyle: #{ encodingstyle }.")
+ end
+ if !obj.elename.name
+ raise FormatEncodeError.new("Element name not defined: #{ obj }.")
+ end
+ handler.encode_data(self, ns, obj, parent)
+ handler.encode_data_end(self, ns, obj, parent)
+ end
+
+ def add_reftarget(name, node)
+ unless @reftarget
+ raise FormatEncodeError.new("Reftarget is not defined.")
+ end
+ @reftarget.add(name, node)
+ end
+
+ def encode_child(ns, child, parent)
+ indent_backup, @indent = @indent, @indent + @indentstr
+ encode_data(ns.clone_ns, child, parent)
+ @indent = indent_backup
+ end
+
+ def encode_element(ns, obj, parent)
+ attrs = obj.extraattr
+ if obj.is_a?(SOAPBody)
+ @reftarget = obj
+ obj.encode(self, ns, attrs) do |child|
+ indent_backup, @indent = @indent, @indent + @indentstr
+ encode_data(ns.clone_ns, child, obj)
+ @indent = indent_backup
+ end
+ @reftarget = nil
+ else
+ if obj.is_a?(SOAPEnvelope)
+ Generator.assign_ns(attrs, ns, XSD::InstanceNamespace)
+ Generator.assign_ns(attrs, ns, XSD::Namespace)
+ end
+ obj.encode(self, ns, attrs) do |child|
+ indent_backup, @indent = @indent, @indent + @indentstr
+ encode_data(ns.clone_ns, child, obj)
+ @indent = indent_backup
+ end
+ end
+ end
+
+ def encode_name(ns, data, attrs)
+ if element_local?(data)
+ data.elename.name
+ else
+ if @use_default_namespace
+ Generator.assign_ns(attrs, ns, data.elename.namespace, '')
+ else
+ Generator.assign_ns(attrs, ns, data.elename.namespace)
+ end
+ ns.name(data.elename)
+ end
+ end
+
+ def encode_name_end(ns, data)
+ if element_local?(data)
+ data.elename.name
+ else
+ ns.name(data.elename)
+ end
+ end
+
+ def encode_tag(elename, attrs = nil)
+ if attrs.nil? or attrs.empty?
+ @buf << "\n#{ @indent }<#{ elename }>"
+ return
+ end
+ ary = []
+ attrs.each do |key, value|
+ ary << %Q[#{ key }="#{ get_encoded(value.to_s) }"]
+ end
+ case ary.size
+ when 0
+ @buf << "\n#{ @indent }<#{ elename }>"
+ when 1
+ @buf << %Q[\n#{ @indent }<#{ elename } #{ ary[0] }>]
+ else
+ @buf << "\n#{ @indent }<#{ elename } " <<
+ ary.join("\n#{ @indent }#{ @indentstr * 2 }") <<
+ '>'
+ end
+ end
+
+ def encode_tag_end(elename, cr = nil)
+ if cr
+ @buf << "\n#{ @indent }#{ elename }>"
+ else
+ @buf << "#{ elename }>"
+ end
+ end
+
+ def encode_rawstring(str)
+ @buf << str
+ end
+
+ def encode_string(str)
+ @buf << get_encoded(str)
+ end
+
+ def element_local?(element)
+ element.elename.namespace.nil?
+ end
+
+ def self.assign_ns(attrs, ns, namespace, tag = nil)
+ if namespace.nil?
+ raise FormatEncodeError.new("empty namespace")
+ end
+ override_default_ns = (tag == '' and namespace != ns.default_namespace)
+ if override_default_ns or !ns.assigned?(namespace)
+ assign_ns!(attrs, ns, namespace, tag)
+ end
+ end
+
+ def self.assign_ns!(attrs, ns, namespace, tag = nil)
+ tag = ns.assign(namespace, tag)
+ if tag == ''
+ attr = 'xmlns'
+ else
+ attr = "xmlns:#{tag}"
+ end
+ attrs[attr] = namespace
+ end
+
+private
+
+ def prologue
+ end
+
+ def epilogue
+ end
+
+ ENCODE_CHAR_REGEXP = {}
+
+ EncodeMap = {
+ '&' => '&',
+ '<' => '<',
+ '>' => '>',
+ '"' => '"',
+ '\'' => ''',
+ "\r" => '
'
+ }
+
+ def get_encoded(str)
+ if @use_numeric_character_reference and !XSD::Charset.is_us_ascii(str)
+ str.gsub!(@encode_char_regexp) { |c| EncodeMap[c] }
+ str.unpack("U*").collect { |c|
+ if c == 0x9 or c == 0xa or c == 0xd or (c >= 0x20 and c <= 0x7f)
+ c.chr
+ else
+ sprintf("%x;", c)
+ end
+ }.join
+ else
+ str.gsub(@encode_char_regexp) { |c| EncodeMap[c] }
+ end
+ end
+
+ def get_encode_char_regexp
+ ENCODE_CHAR_REGEXP[XSD::Charset.encoding] ||=
+ Regexp.new("[#{EncodeMap.keys.join}]")
+ end
+
+ def find_handler(encodingstyle)
+ unless @handlers.key?(encodingstyle)
+ factory = SOAP::EncodingStyle::Handler.handler(encodingstyle)
+ if factory
+ handler = factory.new(@charset)
+ handler.generate_explicit_type = @generate_explicit_type
+ handler.encode_prologue
+ @handlers[encodingstyle] = handler
+ end
+ end
+ @handlers[encodingstyle]
+ end
+
+ def xmldecl
+ if @charset
+ %Q[]
+ else
+ %Q[]
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb
new file mode 100644
index 00000000..439f00ba
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb
@@ -0,0 +1,61 @@
+# SOAP4R - SOAP Header handler item
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/element'
+
+
+module SOAP
+module Header
+
+
+class Handler
+ attr_reader :elename
+ attr_accessor :mustunderstand
+ attr_reader :encodingstyle
+ attr_reader :target_actor
+
+ def initialize(elename)
+ @elename = elename
+ @mustunderstand = false
+ @encodingstyle = nil
+ @target_actor = nil
+ end
+
+ # Should return a SOAP/OM, a SOAPHeaderItem or nil.
+ def on_outbound
+ nil
+ end
+
+ # Given header is a SOAPHeaderItem or nil.
+ def on_inbound(header, mustunderstand = false)
+ # do something.
+ end
+
+ def on_outbound_headeritem(header)
+ arity = self.method(:on_outbound).arity
+ item = (arity == 0) ? on_outbound : on_outbound(header)
+ if item.nil?
+ nil
+ elsif item.is_a?(::SOAP::SOAPHeaderItem)
+ item.elename = @elename
+ item
+ else
+ item.elename = @elename
+ ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle,
+ @target_actor)
+ end
+ end
+
+ def on_inbound_headeritem(header, item)
+ on_inbound(item.element, item.mustunderstand)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb
new file mode 100644
index 00000000..c86aab66
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb
@@ -0,0 +1,70 @@
+# SOAP4R - SOAP Header handler set
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/namedelements'
+
+
+module SOAP
+module Header
+
+
+class HandlerSet
+ def initialize
+ @store = XSD::NamedElements.new
+ end
+
+ def dup
+ obj = HandlerSet.new
+ obj.store = @store.dup
+ obj
+ end
+
+ def add(handler)
+ @store << handler
+ end
+ alias << add
+
+ def delete(handler)
+ @store.delete(handler)
+ end
+
+ def include?(handler)
+ @store.include?(handler)
+ end
+
+ # returns: Array of SOAPHeaderItem
+ def on_outbound(header)
+ @store.collect { |handler|
+ handler.on_outbound_headeritem(header)
+ }.compact
+ end
+
+ # header: SOAPHeaderItem enumerable object
+ def on_inbound(header)
+ header.each do |name, item|
+ handler = @store.find { |handler|
+ handler.elename == item.element.elename
+ }
+ if handler
+ handler.on_inbound_headeritem(header, item)
+ elsif item.mustunderstand
+ raise UnhandledMustUnderstandHeaderError.new(item.element.elename.to_s)
+ end
+ end
+ end
+
+protected
+
+ def store=(store)
+ @store = store
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb
new file mode 100644
index 00000000..32529a57
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb
@@ -0,0 +1,47 @@
+# SOAP4R - SOAP Mapping header item handler
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/header/handler'
+require 'soap/mapping/mapping'
+
+
+module SOAP
+module Header
+
+
+class MappingHandler < SOAP::Header::Handler
+ attr_accessor :registry
+
+ def initialize(elename, registry = nil)
+ super(elename)
+ @registry = registry
+ end
+
+ # Should return an Object for mapping
+ def on_mapping_outbound
+ nil
+ end
+
+ # Given header is a mapped Object
+ def on_mapping_inbound(obj, mustunderstand)
+ end
+
+ def on_outbound
+ obj = on_mapping_outbound
+ obj ? SOAP::Mapping.obj2soap(obj, @registry, @elename) : nil
+ end
+
+ def on_inbound(header, mustunderstand)
+ obj = SOAP::Mapping.soap2obj(header, @registry)
+ on_mapping_inbound(obj, mustunderstand)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb
new file mode 100644
index 00000000..39ce8fa0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb
@@ -0,0 +1,44 @@
+# SOAP4R - SOAP Simple header item handler
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/header/handler'
+require 'soap/baseData'
+
+
+module SOAP
+module Header
+
+
+class SimpleHandler < SOAP::Header::Handler
+ def initialize(elename)
+ super(elename)
+ end
+
+ # Should return a Hash, String or nil.
+ def on_simple_outbound
+ nil
+ end
+
+ # Given header is a Hash, String or nil.
+ def on_simple_inbound(header, mustunderstand)
+ end
+
+ def on_outbound
+ h = on_simple_outbound
+ h ? SOAPElement.from_obj(h, elename.namespace) : nil
+ end
+
+ def on_inbound(header, mustunderstand)
+ h = header.respond_to?(:to_obj) ? header.to_obj : header.data
+ on_simple_inbound(h, mustunderstand)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb b/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb
new file mode 100644
index 00000000..ed31b0a2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb
@@ -0,0 +1,139 @@
+# SOAP4R - HTTP config loader.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/property'
+
+
+module SOAP
+
+
+module HTTPConfigLoader
+module_function
+
+ def set_options(client, options)
+ client.proxy = options["proxy"]
+ options.add_hook("proxy") do |key, value|
+ client.proxy = value
+ end
+ client.no_proxy = options["no_proxy"]
+ options.add_hook("no_proxy") do |key, value|
+ client.no_proxy = value
+ end
+ if client.respond_to?(:protocol_version=)
+ client.protocol_version = options["protocol_version"]
+ options.add_hook("protocol_version") do |key, value|
+ client.protocol_version = value
+ end
+ end
+ ssl_config = options["ssl_config"] ||= ::SOAP::Property.new
+ set_ssl_config(client, ssl_config)
+ ssl_config.add_hook(true) do |key, value|
+ set_ssl_config(client, ssl_config)
+ end
+ basic_auth = options["basic_auth"] ||= ::SOAP::Property.new
+ set_basic_auth(client, basic_auth)
+ basic_auth.add_hook do |key, value|
+ set_basic_auth(client, basic_auth)
+ end
+ auth = options["auth"] ||= ::SOAP::Property.new
+ set_auth(client, auth)
+ auth.add_hook do |key, value|
+ set_auth(client, auth)
+ end
+ options.add_hook("connect_timeout") do |key, value|
+ client.connect_timeout = value
+ end
+ options.add_hook("send_timeout") do |key, value|
+ client.send_timeout = value
+ end
+ options.add_hook("receive_timeout") do |key, value|
+ client.receive_timeout = value
+ end
+ end
+
+ def set_basic_auth(client, basic_auth)
+ basic_auth.values.each do |ele|
+ client.set_basic_auth(*authele_to_triplets(ele))
+ end
+ end
+
+ def set_auth(client, auth)
+ auth.values.each do |ele|
+ client.set_auth(*authele_to_triplets(ele))
+ end
+ end
+
+ def authele_to_triplets(ele)
+ if ele.is_a?(::Array)
+ url, userid, passwd = ele
+ else
+ url, userid, passwd = ele[:url], ele[:userid], ele[:password]
+ end
+ return url, userid, passwd
+ end
+
+ def set_ssl_config(client, ssl_config)
+ ssl_config.each do |key, value|
+ cfg = client.ssl_config
+ if cfg.nil?
+ raise NotImplementedError.new("SSL not supported")
+ end
+ case key
+ when 'client_cert'
+ cfg.client_cert = cert_from_file(value)
+ when 'client_key'
+ cfg.client_key = key_from_file(value)
+ when 'client_ca'
+ cfg.client_ca = value
+ when 'ca_path'
+ cfg.set_trust_ca(value)
+ when 'ca_file'
+ cfg.set_trust_ca(value)
+ when 'crl'
+ cfg.set_crl(value)
+ when 'verify_mode'
+ cfg.verify_mode = ssl_config_int(value)
+ when 'verify_depth'
+ cfg.verify_depth = ssl_config_int(value)
+ when 'options'
+ cfg.options = value
+ when 'ciphers'
+ cfg.ciphers = value
+ when 'verify_callback'
+ cfg.verify_callback = value
+ when 'cert_store'
+ cfg.cert_store = value
+ else
+ raise ArgumentError.new("unknown ssl_config property #{key}")
+ end
+ end
+ end
+
+ def ssl_config_int(value)
+ if value.nil? or value.to_s.empty?
+ nil
+ else
+ begin
+ Integer(value)
+ rescue ArgumentError
+ ::SOAP::Property::Util.const_from_name(value.to_s)
+ end
+ end
+ end
+
+ def cert_from_file(filename)
+ OpenSSL::X509::Certificate.new(File.open(filename) { |f| f.read })
+ end
+
+ def key_from_file(filename)
+ OpenSSL::PKey::RSA.new(File.open(filename) { |f| f.read })
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb
new file mode 100644
index 00000000..a121290e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb
@@ -0,0 +1,12 @@
+# SOAP4R - Ruby type mapping utility.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/mapping/mapping'
+require 'soap/mapping/registry'
+require 'soap/mapping/encodedregistry'
+require 'soap/mapping/literalregistry'
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb
new file mode 100644
index 00000000..4acd69fc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb
@@ -0,0 +1,537 @@
+# SOAP4R - encoded mapping registry.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/mapping/mapping'
+require 'soap/mapping/typeMap'
+require 'soap/mapping/factory'
+require 'soap/mapping/rubytypeFactory'
+
+
+module SOAP
+module Mapping
+
+
+# Inner class to pass an exception.
+class SOAPException
+ attr_reader :excn_type_name, :cause
+
+ def initialize(e)
+ @excn_type_name = Mapping.name2elename(e.class.to_s)
+ @cause = e
+ end
+
+ def to_e
+ if @cause.is_a?(::Exception)
+ @cause.extend(::SOAP::Mapping::MappedException)
+ return @cause
+ elsif @cause.respond_to?(:message) and @cause.respond_to?(:backtrace)
+ e = RuntimeError.new(@cause.message)
+ e.set_backtrace(@cause.backtrace)
+ return e
+ end
+ klass = Mapping.class_from_name(Mapping.elename2name(@excn_type_name.to_s))
+ if klass.nil? or not klass <= ::Exception
+ return RuntimeError.new(@cause.inspect)
+ end
+ obj = klass.new(@cause.message)
+ obj.extend(::SOAP::Mapping::MappedException)
+ obj
+ end
+end
+
+
+class EncodedRegistry
+ include TraverseSupport
+ include RegistrySupport
+
+ class Map
+ def initialize(registry)
+ @obj2soap = {}
+ @soap2obj = {}
+ @registry = registry
+ end
+
+ def obj2soap(obj)
+ klass = obj.class
+ if map = @obj2soap[klass]
+ map.each do |soap_class, factory, info|
+ ret = factory.obj2soap(soap_class, obj, info, @registry)
+ return ret if ret
+ end
+ end
+ klass.ancestors.each do |baseclass|
+ next if baseclass == klass
+ if map = @obj2soap[baseclass]
+ map.each do |soap_class, factory, info|
+ if info[:derived_class]
+ ret = factory.obj2soap(soap_class, obj, info, @registry)
+ return ret if ret
+ end
+ end
+ end
+ end
+ nil
+ end
+
+ def soap2obj(node, klass = nil)
+ if map = @soap2obj[node.class]
+ map.each do |obj_class, factory, info|
+ next if klass and obj_class != klass
+ conv, obj = factory.soap2obj(obj_class, node, info, @registry)
+ return true, obj if conv
+ end
+ end
+ return false, nil
+ end
+
+ # Give priority to former entry.
+ def init(init_map = [])
+ clear
+ init_map.reverse_each do |obj_class, soap_class, factory, info|
+ add(obj_class, soap_class, factory, info)
+ end
+ end
+
+ # Give priority to latter entry.
+ def add(obj_class, soap_class, factory, info)
+ info ||= {}
+ (@obj2soap[obj_class] ||= []).unshift([soap_class, factory, info])
+ (@soap2obj[soap_class] ||= []).unshift([obj_class, factory, info])
+ end
+
+ def clear
+ @obj2soap.clear
+ @soap2obj.clear
+ end
+
+ def find_mapped_soap_class(target_obj_class)
+ map = @obj2soap[target_obj_class]
+ map.empty? ? nil : map[0][1]
+ end
+
+ def find_mapped_obj_class(target_soap_class)
+ map = @soap2obj[target_soap_class]
+ map.empty? ? nil : map[0][0]
+ end
+ end
+
+ StringFactory = StringFactory_.new
+ BasetypeFactory = BasetypeFactory_.new
+ FixnumFactory = FixnumFactory_.new
+ DateTimeFactory = DateTimeFactory_.new
+ ArrayFactory = ArrayFactory_.new
+ Base64Factory = Base64Factory_.new
+ URIFactory = URIFactory_.new
+ TypedArrayFactory = TypedArrayFactory_.new
+ TypedStructFactory = TypedStructFactory_.new
+
+ HashFactory = HashFactory_.new
+
+ SOAPBaseMap = [
+ [::NilClass, ::SOAP::SOAPNil, BasetypeFactory],
+ [::TrueClass, ::SOAP::SOAPBoolean, BasetypeFactory],
+ [::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
+ [::String, ::SOAP::SOAPString, StringFactory,
+ {:derived_class => true}],
+ [::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
+ [::Date, ::SOAP::SOAPDate, DateTimeFactory],
+ [::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
+ [::Time, ::SOAP::SOAPTime, DateTimeFactory],
+ [::Float, ::SOAP::SOAPDouble, BasetypeFactory,
+ {:derived_class => true}],
+ [::Float, ::SOAP::SOAPFloat, BasetypeFactory,
+ {:derived_class => true}],
+ [::Fixnum, ::SOAP::SOAPInt, FixnumFactory],
+ [::Integer, ::SOAP::SOAPInt, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPLong, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPShort, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPByte, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNegativeInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPPositiveInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedLong, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedInt, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedShort, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedByte, BasetypeFactory,
+ {:derived_class => true}],
+ [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory,
+ {:derived_class => true}],
+ [::String, ::SOAP::SOAPBase64, Base64Factory],
+ [::String, ::SOAP::SOAPHexBinary, Base64Factory],
+ [::String, ::SOAP::SOAPDecimal, BasetypeFactory],
+ [::String, ::SOAP::SOAPDuration, BasetypeFactory],
+ [::String, ::SOAP::SOAPGYearMonth, BasetypeFactory],
+ [::String, ::SOAP::SOAPGYear, BasetypeFactory],
+ [::String, ::SOAP::SOAPGMonthDay, BasetypeFactory],
+ [::String, ::SOAP::SOAPGDay, BasetypeFactory],
+ [::String, ::SOAP::SOAPGMonth, BasetypeFactory],
+ [::String, ::SOAP::SOAPQName, BasetypeFactory],
+
+ [::Hash, ::SOAP::SOAPArray, HashFactory,
+ {:derived_class => true}],
+ [::Hash, ::SOAP::SOAPStruct, HashFactory,
+ {:derived_class => true}],
+
+ [::Array, ::SOAP::SOAPArray, ArrayFactory,
+ {:derived_class => true}],
+
+ [::SOAP::Mapping::SOAPException,
+ ::SOAP::SOAPStruct, TypedStructFactory,
+ {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
+ ]
+
+ RubyOriginalMap = [
+ [::NilClass, ::SOAP::SOAPNil, BasetypeFactory],
+ [::TrueClass, ::SOAP::SOAPBoolean, BasetypeFactory],
+ [::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
+ [::String, ::SOAP::SOAPString, StringFactory],
+ [::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
+ [::Date, ::SOAP::SOAPDate, DateTimeFactory],
+ [::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
+ [::Time, ::SOAP::SOAPTime, DateTimeFactory],
+ [::Float, ::SOAP::SOAPDouble, BasetypeFactory,
+ {:derived_class => true}],
+ [::Float, ::SOAP::SOAPFloat, BasetypeFactory,
+ {:derived_class => true}],
+ [::Fixnum, ::SOAP::SOAPInt, FixnumFactory],
+ [::Integer, ::SOAP::SOAPInt, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPLong, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPShort, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPByte, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNegativeInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPPositiveInteger, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedLong, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedInt, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedShort, BasetypeFactory,
+ {:derived_class => true}],
+ [::Integer, ::SOAP::SOAPUnsignedByte, BasetypeFactory,
+ {:derived_class => true}],
+ [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory,
+ {:derived_class => true}],
+ [::String, ::SOAP::SOAPBase64, Base64Factory],
+ [::String, ::SOAP::SOAPHexBinary, Base64Factory],
+ [::String, ::SOAP::SOAPDecimal, BasetypeFactory],
+ [::String, ::SOAP::SOAPDuration, BasetypeFactory],
+ [::String, ::SOAP::SOAPGYearMonth, BasetypeFactory],
+ [::String, ::SOAP::SOAPGYear, BasetypeFactory],
+ [::String, ::SOAP::SOAPGMonthDay, BasetypeFactory],
+ [::String, ::SOAP::SOAPGDay, BasetypeFactory],
+ [::String, ::SOAP::SOAPGMonth, BasetypeFactory],
+ [::String, ::SOAP::SOAPQName, BasetypeFactory],
+
+ [::Hash, ::SOAP::SOAPArray, HashFactory],
+ [::Hash, ::SOAP::SOAPStruct, HashFactory],
+
+ # Does not allow Array's subclass here.
+ [::Array, ::SOAP::SOAPArray, ArrayFactory],
+
+ [::SOAP::Mapping::SOAPException,
+ ::SOAP::SOAPStruct, TypedStructFactory,
+ {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
+ ]
+
+ attr_accessor :default_factory
+ attr_accessor :excn_handler_obj2soap
+ attr_accessor :excn_handler_soap2obj
+
+ def initialize(config = {})
+ super()
+ @config = config
+ @map = Map.new(self)
+ if @config[:allow_original_mapping]
+ @allow_original_mapping = true
+ @map.init(RubyOriginalMap)
+ else
+ @allow_original_mapping = false
+ @map.init(SOAPBaseMap)
+ end
+ @allow_untyped_struct = @config.key?(:allow_untyped_struct) ?
+ @config[:allow_untyped_struct] : true
+ @rubytype_factory = RubytypeFactory.new(
+ :allow_untyped_struct => @allow_untyped_struct,
+ :allow_original_mapping => @allow_original_mapping
+ )
+ @default_factory = @rubytype_factory
+ @excn_handler_obj2soap = nil
+ @excn_handler_soap2obj = nil
+ end
+
+ # initial mapping interface
+ # new interface Registry#register is defined in RegisterSupport
+ def add(obj_class, soap_class, factory, info = nil)
+ @map.add(obj_class, soap_class, factory, info)
+ end
+ alias set add
+
+ def obj2soap(obj, type_qname = nil)
+ soap = _obj2soap(obj, type_qname)
+ if @allow_original_mapping
+ addextend2soap(soap, obj)
+ end
+ soap
+ end
+
+ def soap2obj(node, klass = nil)
+ obj = _soap2obj(node, klass)
+ if @allow_original_mapping
+ addextend2obj(obj, node.extraattr[RubyExtendName])
+ addiv2obj(obj, node.extraattr[RubyIVarName])
+ end
+ obj
+ end
+
+ def find_mapped_soap_class(obj_class)
+ @map.find_mapped_soap_class(obj_class)
+ end
+
+ def find_mapped_obj_class(soap_class)
+ @map.find_mapped_obj_class(soap_class)
+ end
+
+private
+
+ def _obj2soap(obj, type_qname = nil)
+ ret = nil
+ if obj.is_a?(SOAPCompoundtype)
+ obj.replace do |ele|
+ Mapping._obj2soap(ele, self)
+ end
+ return obj
+ elsif obj.is_a?(SOAPBasetype)
+ return obj
+ elsif type_qname && type = TypeMap[type_qname]
+ return base2soap(obj, type)
+ end
+ cause = nil
+ begin
+ if definition = schema_definition_from_class(obj.class)
+ return stubobj2soap(obj, definition)
+ end
+ ret = @map.obj2soap(obj) ||
+ @default_factory.obj2soap(nil, obj, nil, self)
+ return ret if ret
+ rescue MappingError
+ cause = $!
+ end
+ if @excn_handler_obj2soap
+ ret = @excn_handler_obj2soap.call(obj) { |yield_obj|
+ Mapping._obj2soap(yield_obj, self)
+ }
+ return ret if ret
+ end
+ raise MappingError.new("Cannot map #{ obj.class.name } to SOAP/OM.", cause)
+ end
+
+ # Might return nil as a mapping result.
+ def _soap2obj(node, klass = nil)
+ definition = find_node_definition(node)
+ if klass
+ klass_definition = schema_definition_from_class(klass)
+ if definition and (definition.class_for < klass)
+ klass = definition.class_for
+ else
+ definition = klass_definition
+ end
+ else
+ klass = definition.class_for if definition
+ end
+ if definition and node.is_a?(::SOAP::SOAPNameAccessible)
+ return elesoap2stubobj(node, klass, definition)
+ end
+ if node.extraattr.key?(RubyTypeName)
+ conv, obj = @rubytype_factory.soap2obj(nil, node, nil, self)
+ return obj if conv
+ end
+ conv, obj = @map.soap2obj(node)
+ return obj if conv
+ conv, obj = @default_factory.soap2obj(nil, node, nil, self)
+ return obj if conv
+ cause = nil
+ if @excn_handler_soap2obj
+ begin
+ return @excn_handler_soap2obj.call(node) { |yield_node|
+ Mapping._soap2obj(yield_node, self)
+ }
+ rescue Exception
+ cause = $!
+ end
+ end
+ raise MappingError.new("Cannot map #{ node.type } to Ruby object.", cause)
+ end
+
+ def addiv2obj(obj, attr)
+ return unless attr
+ vars = {}
+ attr.__getobj__.each do |name, value|
+ vars[name] = Mapping._soap2obj(value, self)
+ end
+ Mapping.set_attributes(obj, vars)
+ end
+
+ def addextend2obj(obj, attr)
+ return unless attr
+ attr.split(/ /).reverse_each do |mstr|
+ obj.extend(Mapping.module_from_name(mstr))
+ end
+ end
+
+ def addextend2soap(node, obj)
+ return if obj.is_a?(Symbol) or obj.is_a?(Fixnum)
+ list = (class << obj; self; end).ancestors - obj.class.ancestors
+ unless list.empty?
+ node.extraattr[RubyExtendName] = list.collect { |c|
+ name = c.name
+ if name.nil? or name.empty?
+ raise TypeError.new("singleton can't be dumped #{ obj }")
+ end
+ name
+ }.join(" ")
+ end
+ end
+
+ def stubobj2soap(obj, definition)
+ case obj
+ when ::Array
+ array2soap(obj, definition)
+ else
+ unknownstubobj2soap(obj, definition)
+ end
+ end
+
+ def array2soap(obj, definition)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ eledef = definition.elements[0]
+ soap_obj = SOAPArray.new(ValueArrayName, 1, eledef.elename)
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |item|
+ soap_obj.add(typedobj2soap(item, eledef.mapped_class))
+ end
+ soap_obj
+ end
+
+ def unknownstubobj2soap(obj, definition)
+ return SOAPNil.new if obj.nil?
+ if definition.elements.size == 0
+ ele = Mapping.obj2soap(obj)
+ ele.elename = definition.elename if definition.elename
+ ele.extraattr[XSD::AttrTypeName] = definition.type if definition.type
+ return ele
+ else
+ ele = SOAPStruct.new(definition.type)
+ mark_marshalled_obj(obj, ele)
+ end
+ definition.elements.each do |eledef|
+ name = eledef.elename.name
+ if obj.respond_to?(:each) and eledef.as_array?
+ obj.each do |item|
+ ele.add(name, typedobj2soap(item, eledef.mapped_class))
+ end
+ else
+ child = Mapping.get_attribute(obj, eledef.varname)
+ if child.respond_to?(:each) and eledef.as_array?
+ child.each do |item|
+ ele.add(name, typedobj2soap(item, eledef.mapped_class))
+ end
+ else
+ ele.add(name, typedobj2soap(child, eledef.mapped_class))
+ end
+ end
+ end
+ ele
+ end
+
+ def typedobj2soap(value, klass)
+ if klass and klass.include?(::SOAP::SOAPBasetype)
+ base2soap(value, klass)
+ else
+ Mapping._obj2soap(value, self)
+ end
+ end
+
+ def elesoap2stubobj(node, obj_class, definition)
+ obj = Mapping.create_empty_object(obj_class)
+ add_elesoap2stubobj(node, obj, definition)
+ obj
+ end
+
+ # XXX consider to merge with the method in LiteralRegistry
+ def add_elesoap2stubobj(node, obj, definition)
+ vars = {}
+ node.each do |name, value|
+ item = definition.elements.find_element(value.elename)
+ if item
+ child = soap2typedobj(value, item.mapped_class)
+ else
+ # unknown element is treated as anyType.
+ child = Mapping._soap2obj(value, self)
+ end
+ if item and item.as_array?
+ (vars[name] ||= []) << child
+ elsif vars.key?(name)
+ vars[name] = [vars[name], child].flatten
+ else
+ vars[name] = child
+ end
+ end
+ if obj.is_a?(::Array) and is_stubobj_elements_for_array(vars)
+ Array.instance_method(:replace).bind(obj).call(vars.values[0])
+ else
+ Mapping.set_attributes(obj, vars)
+ end
+ end
+
+ def soap2typedobj(value, klass)
+ unless klass
+ raise MappingError.new("unknown class: #{klass}")
+ end
+ if klass.include?(::SOAP::SOAPBasetype)
+ obj = base2obj(value, klass)
+ else
+ obj = Mapping._soap2obj(value, self, klass)
+ end
+ obj
+ end
+end
+
+
+Registry = EncodedRegistry
+DefaultRegistry = EncodedRegistry.new
+RubyOriginalRegistry = EncodedRegistry.new(:allow_original_mapping => true)
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb
new file mode 100644
index 00000000..c4967a8b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb
@@ -0,0 +1,388 @@
+# SOAP4R - Mapping factory.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+module Mapping
+
+
+class Factory
+ include TraverseSupport
+
+ def initialize
+ # nothing to do
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ raise NotImplementError.new
+ # return soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ raise NotImplementError.new
+ # return convert_succeeded_or_not, obj
+ end
+
+ def setiv2obj(obj, node, map)
+ return if node.nil?
+ if obj.is_a?(Array)
+ setiv2ary(obj, node, map)
+ else
+ setiv2struct(obj, node, map)
+ end
+ end
+
+ def setiv2soap(node, obj, map)
+ if obj.class.class_variables.include?('@@schema_element')
+ setdefinediv2soap(node, obj, map)
+ else
+ # should we sort instance_variables? how?
+ obj.instance_variables.each do |var|
+ name = var.to_s.sub(/^@/, '').to_sym
+ elename = Mapping.name2elename(name)
+ node.add(elename,
+ Mapping._obj2soap(obj.instance_variable_get(var), map))
+ end
+ end
+ end
+
+private
+
+ def setdefinediv2soap(ele, obj, map)
+ definition = Mapping.schema_definition_classdef(obj.class)
+ definition.elements.each do |eledef|
+ child = Mapping.get_attribute(obj, eledef.varname)
+ # extract method
+ if child.nil?
+ value = SOAPNil.new
+ elsif child.is_a?(XSD::NSDBase)
+ value = child
+ else
+ klass = Mapping.class_from_name(eledef.type)
+ if klass && klass.include?(::SOAP::SOAPBasetype)
+ value = klass.new(child)
+ else
+ # should check klass matches an actual object?
+ value = Mapping._obj2soap(child, map)
+ end
+ end
+ ele.add(eledef.elename.name, value)
+ end
+ end
+
+ def setiv2ary(obj, node, map)
+ node.each do |name, value|
+ Array.instance_method(:<<).bind(obj).call(Mapping._soap2obj(value, map))
+ end
+ end
+
+ def setiv2struct(obj, node, map)
+ vars = {}
+ node.each do |name, value|
+ vars[Mapping.elename2name(name)] = Mapping._soap2obj(value, map)
+ end
+ Mapping.set_attributes(obj, vars)
+ end
+
+ def anonymous_class?(obj)
+ name = obj.class.name
+ name.nil? or name.empty? # 1.8 returns ""
+ end
+end
+
+class StringFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and !obj.instance_variables.empty?
+ return nil
+ end
+ begin
+ encoded = XSD::Charset.encoding_conv(obj, Mapping.external_ces,
+ XSD::Charset.encoding)
+ soap_obj = soap_class.new(encoded)
+ rescue XSD::ValueSpaceError
+ return nil
+ end
+ mark_marshalled_obj(obj, soap_obj)
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ obj = Mapping.create_empty_object(obj_class)
+ decoded = XSD::Charset.encoding_conv(node.data, XSD::Charset.encoding,
+ Mapping.external_ces)
+ obj.replace(decoded)
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
+ end
+end
+
+class FixnumFactory_ < Factory
+ def obj2soap(soap_class, obj, info, map)
+ soap_obj = nil
+ begin
+ soap_obj = soap_class.new(obj)
+ rescue XSD::ValueSpaceError
+ return nil
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ obj = node.data
+ return true, obj
+ end
+end
+
+class BasetypeFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and !obj.instance_variables.empty?
+ return nil
+ end
+ soap_obj = nil
+ begin
+ soap_obj = soap_class.new(obj)
+ rescue XSD::ValueSpaceError
+ return nil
+ end
+ if @allow_original_mapping
+ # Basetype except String should not be multiref-ed in SOAP/1.1.
+ mark_marshalled_obj(obj, soap_obj)
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ obj = node.data
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
+ end
+end
+
+class DateTimeFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and
+ Time === obj and !obj.instance_variables.empty?
+ return nil
+ end
+ soap_obj = nil
+ begin
+ soap_obj = soap_class.new(obj)
+ rescue XSD::ValueSpaceError
+ return nil
+ end
+ mark_marshalled_obj(obj, soap_obj)
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ if node.respond_to?(:to_obj)
+ obj = node.to_obj(obj_class)
+ return false if obj.nil?
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
+ else
+ return false
+ end
+ end
+end
+
+class Base64Factory_ < Factory
+ def obj2soap(soap_class, obj, info, map)
+ return nil unless obj.instance_variables.empty?
+ soap_obj = soap_class.new(obj)
+ mark_marshalled_obj(obj, soap_obj) if soap_obj
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ obj = node.string
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
+ end
+end
+
+class URIFactory_ < Factory
+ def obj2soap(soap_class, obj, info, map)
+ soap_obj = soap_class.new(obj)
+ mark_marshalled_obj(obj, soap_obj) if 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
+
+class ArrayFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ # [[1], [2]] is converted to Array of Array, not 2-D Array.
+ # To create M-D Array, you must call Mapping.ary2md.
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and !obj.instance_variables.empty?
+ return nil
+ end
+ arytype = Mapping.obj2element(obj)
+ if arytype.name
+ arytype.namespace ||= RubyTypeNamespace
+ else
+ arytype = XSD::AnyTypeName
+ end
+ soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |item|
+ soap_obj.add(Mapping._obj2soap(item, map))
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ obj = Mapping.create_empty_object(obj_class)
+ mark_unmarshalled_obj(node, obj)
+ node.soap2array(obj) do |elem|
+ elem ? Mapping._soap2obj(elem, map) : nil
+ end
+ return true, obj
+ end
+end
+
+class TypedArrayFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and !obj.instance_variables.empty?
+ return nil
+ end
+ arytype = info[:type] || info[0]
+ soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |var|
+ soap_obj.add(Mapping._obj2soap(var, map))
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ if node.rank > 1
+ return false
+ end
+ arytype = info[:type] || info[0]
+ unless node.arytype == arytype
+ return false
+ end
+ obj = Mapping.create_empty_object(obj_class)
+ mark_unmarshalled_obj(node, obj)
+ node.soap2array(obj) do |elem|
+ elem ? Mapping._soap2obj(elem, map) : nil
+ end
+ return true, obj
+ end
+end
+
+class TypedStructFactory_ < Factory
+ def obj2soap(soap_class, obj, info, map)
+ type = info[:type] || info[0]
+ soap_obj = soap_class.new(type)
+ mark_marshalled_obj(obj, soap_obj)
+ if obj.class <= SOAP::Marshallable
+ setiv2soap(soap_obj, obj, map)
+ else
+ # allow to serialize an instance of unmarked class
+ setiv2soap(soap_obj, obj, map)
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ type = info[:type] || info[0]
+ unless node.type == type
+ return false
+ end
+ obj = Mapping.create_empty_object(obj_class)
+ mark_unmarshalled_obj(node, obj)
+ setiv2obj(obj, node, map)
+ return true, obj
+ end
+end
+
+MapQName = XSD::QName.new(ApacheSOAPTypeNamespace, 'Map')
+class HashFactory_ < Factory
+ def initialize(allow_original_mapping = false)
+ super()
+ @allow_original_mapping = allow_original_mapping
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ if !@allow_original_mapping and !obj.instance_variables.empty?
+ return nil
+ end
+ if !obj.default.nil? or
+ (obj.respond_to?(:default_proc) and obj.default_proc)
+ return nil
+ end
+ soap_obj = SOAPStruct.new(MapQName)
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |key, value|
+ elem = SOAPStruct.new
+ elem.add("key", Mapping._obj2soap(key, map))
+ elem.add("value", Mapping._obj2soap(value, map))
+ # ApacheAxis allows only 'item' here.
+ soap_obj.add("item", elem)
+ end
+ soap_obj
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ unless node.type == MapQName
+ return false
+ end
+ if node.class == SOAPStruct and node.key?('default')
+ return false
+ end
+ obj = Mapping.create_empty_object(obj_class)
+ mark_unmarshalled_obj(node, obj)
+ if node.class == SOAPStruct
+ node.each do |key, value|
+ obj[Mapping._soap2obj(value['key'], map)] =
+ Mapping._soap2obj(value['value'], map)
+ end
+ else
+ node.each do |value|
+ obj[Mapping._soap2obj(value['key'], map)] =
+ Mapping._soap2obj(value['value'], map)
+ end
+ end
+ return true, obj
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb
new file mode 100644
index 00000000..06d16c66
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb
@@ -0,0 +1,391 @@
+# SOAP4R - literal mapping registry.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/mapping/mapping'
+require 'soap/mapping/typeMap'
+require 'xsd/codegen/gensupport'
+require 'xsd/namedelements'
+
+
+module SOAP
+module Mapping
+
+
+class LiteralRegistry
+ include RegistrySupport
+
+ attr_accessor :excn_handler_obj2soap
+ attr_accessor :excn_handler_soap2obj
+
+ def initialize
+ super()
+ @excn_handler_obj2soap = nil
+ @excn_handler_soap2obj = nil
+ end
+
+ def obj2soap(obj, qname, obj_class = nil)
+ soap_obj = nil
+ if obj.is_a?(SOAPElement)
+ soap_obj = obj
+ else
+ soap_obj = any2soap(obj, qname, obj_class)
+ end
+ return soap_obj if soap_obj
+ if @excn_handler_obj2soap
+ soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
+ Mapping.obj2soap(yield_obj, nil, nil, MAPPING_OPT)
+ }
+ return soap_obj if soap_obj
+ end
+ raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
+ end
+
+ # node should be a SOAPElement
+ def soap2obj(node, obj_class = nil)
+ cause = nil
+ begin
+ return any2obj(node, obj_class)
+ rescue MappingError
+ cause = $!
+ end
+ if @excn_handler_soap2obj
+ begin
+ return @excn_handler_soap2obj.call(node) { |yield_node|
+ Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT)
+ }
+ rescue Exception
+ end
+ end
+ raise MappingError.new("cannot map #{node.elename.name}/#{node.type.name} to Ruby object", cause)
+ end
+
+private
+
+ MAPPING_OPT = { :no_reference => true }
+
+ def definedobj2soap(obj, definition)
+ obj2soap(obj, definition.elename, definition.mapped_class)
+ end
+
+ def any2soap(obj, qname, obj_class)
+ ele = nil
+ if obj.is_a?(SOAP::Mapping::Object)
+ return mappingobj2soap(obj, qname)
+ end
+ class_definition = schema_definition_from_class(obj.class)
+ if class_definition.nil? and obj_class
+ class_definition = schema_definition_from_class(obj_class)
+ end
+ elename_definition = schema_definition_from_elename(qname)
+ if !class_definition and !elename_definition
+ # no definition found
+ return anyobj2soap(obj, qname)
+ end
+ if !class_definition or !elename_definition
+ # use found one
+ return stubobj2soap(obj, qname, class_definition || elename_definition)
+ end
+ # found both:
+ if class_definition.class_for == elename_definition.class_for
+ # if two definitions are for the same class, give qname a priority.
+ return stubobj2soap(obj, qname, elename_definition)
+ end
+ # it should be a derived class
+ return stubobj2soap(obj, qname, class_definition)
+ end
+
+ def anyobj2soap(obj, qname)
+ ele = nil
+ case obj
+ when Hash
+ ele = SOAPElement.from_obj(obj, nil)
+ ele.elename = qname
+ when Array
+ # treat as a list of simpletype
+ ele = SOAPElement.new(qname, obj.join(" "))
+ when XSD::QName
+ ele = SOAPElement.new(qname)
+ ele.text = obj
+ else
+ # expected to be a basetype or an anyType.
+ # SOAPStruct, etc. is used instead of SOAPElement.
+ begin
+ ele = Mapping.obj2soap(obj, nil, nil, MAPPING_OPT)
+ ele.elename = qname
+ rescue MappingError
+ ele = SOAPElement.new(qname, obj.to_s)
+ end
+ end
+ add_attributes2soap(obj, ele)
+ ele
+ end
+
+ def stubobj2soap(obj, qname, definition)
+ if obj.nil?
+ ele = SOAPNil.new
+ ele.elename = qname
+ elsif obj.is_a?(::String)
+ ele = SOAPElement.new(qname, obj)
+ else
+ ele = SOAPElement.new(qname)
+ end
+ ele.qualified = definition.qualified
+ if definition.type
+ ele.type = definition.type
+ if definition.basetype or Mapping.root_type_hint
+ Mapping.reset_root_type_hint
+ ele.force_typed = true
+ end
+ end
+ if qname.nil? and definition.elename
+ ele.elename = definition.elename
+ end
+ return ele if obj.nil?
+ stubobj2soap_elements(obj, ele, definition.elements)
+ add_definedattributes2soap(obj, ele, definition)
+ ele
+ end
+
+ def stubobj2soap_elements(obj, ele, definition, is_choice = false)
+ added = false
+ case definition
+ when SchemaSequenceDefinition, SchemaEmptyDefinition
+ definition.each do |eledef|
+ ele_added = stubobj2soap_elements(obj, ele, eledef, is_choice)
+ added = true if ele_added
+ end
+ when SchemaChoiceDefinition
+ definition.each do |eledef|
+ added = stubobj2soap_elements(obj, ele, eledef, true)
+ break if added
+ end
+ else
+ added = true
+ if definition.as_any?
+ any = Mapping.get_attributes_for_any(obj)
+ SOAPElement.from_objs(any).each do |child|
+ ele.add(child)
+ end
+ elsif obj.respond_to?(:each) and definition.as_array?
+ obj.each do |item|
+ ele.add(definedobj2soap(item, definition))
+ end
+ else
+ child = Mapping.get_attribute(obj, definition.varname)
+ if child.nil? and (is_choice or definition.minoccurs == 0)
+ added = false
+ else
+ if child.respond_to?(:each) and definition.as_array?
+ if child.empty?
+ added = false
+ else
+ child.each do |item|
+ ele.add(definedobj2soap(item, definition))
+ end
+ end
+ else
+ ele.add(definedobj2soap(child, definition))
+ end
+ end
+ end
+ end
+ added
+ end
+
+ def mappingobj2soap(obj, qname)
+ ele = SOAPElement.new(qname)
+ obj.__xmlele.each do |key, value|
+ if value.is_a?(::Array)
+ value.each do |item|
+ ele.add(obj2soap(item, key))
+ end
+ else
+ ele.add(obj2soap(value, key))
+ end
+ end
+ obj.__xmlattr.each do |key, value|
+ ele.extraattr[key] = value
+ end
+ ele
+ end
+
+ def any2obj(node, obj_class = nil)
+ is_compound = node.is_a?(::SOAP::SOAPCompoundtype)
+ # trust xsi:type first
+ if is_compound and node.type
+ definition = schema_definition_from_type(node.type)
+ end
+ # element name next
+ definition ||= schema_definition_from_elename(node.elename)
+ # class defined in parent type last
+ if obj_class
+ definition ||= schema_definition_from_class(obj_class)
+ end
+ if definition
+ obj_class = definition.class_for
+ end
+ if is_compound
+ if definition
+ return elesoap2stubobj(node, obj_class, definition)
+ elsif node.is_a?(::SOAP::SOAPNameAccessible)
+ return elesoap2plainobj(node)
+ end
+ end
+ obj = Mapping.soap2obj(node, nil, obj_class, MAPPING_OPT)
+ add_attributes2obj(node, obj)
+ obj
+ end
+
+ def elesoap2stubobj(node, obj_class, definition)
+ obj = nil
+ if obj_class == ::String
+ obj = node.text
+ elsif obj_class < ::String and node.respond_to?(:text)
+ obj = obj_class.new(node.text)
+ else
+ obj = Mapping.create_empty_object(obj_class)
+ add_elesoap2stubobj(node, obj, definition)
+ end
+ add_attributes2stubobj(node, obj, definition)
+ obj
+ end
+
+ def elesoap2plainobj(node)
+ obj = nil
+ if !node.have_member
+ obj = base2obj(node, ::SOAP::SOAPString)
+ else
+ obj = anytype2obj(node)
+ add_elesoap2plainobj(node, obj)
+ end
+ add_attributes2obj(node, obj)
+ obj
+ end
+
+ def anytype2obj(node)
+ if node.is_a?(::SOAP::SOAPBasetype)
+ return node.data
+ end
+ ::SOAP::Mapping::Object.new
+ end
+
+ def add_elesoap2stubobj(node, obj, definition)
+ vars = {}
+ node.each do |name, value|
+ item = definition.elements.find_element(value.elename)
+ if item
+ child = elesoapchild2obj(value, item)
+ else
+ # unknown element is treated as anyType.
+ child = any2obj(value)
+ end
+ if item and item.as_array?
+ (vars[name] ||= []) << child
+ elsif vars.key?(name)
+ vars[name] = [vars[name], child].flatten
+ else
+ vars[name] = child
+ end
+ end
+ if obj.is_a?(::Array) and is_stubobj_elements_for_array(vars)
+ Array.instance_method(:replace).bind(obj).call(vars.values[0])
+ else
+ Mapping.set_attributes(obj, vars)
+ end
+ end
+
+ def elesoapchild2obj(value, eledef)
+ if eledef.mapped_class
+ if eledef.mapped_class.include?(::SOAP::SOAPBasetype)
+ base2obj(value, eledef.mapped_class)
+ else
+ any2obj(value, eledef.mapped_class)
+ end
+ else
+ child_definition = schema_definition_from_elename(eledef.elename)
+ if child_definition
+ any2obj(value, child_definition.class_for)
+ else
+ # untyped element is treated as anyType.
+ any2obj(value)
+ end
+ end
+ end
+
+ def add_attributes2stubobj(node, obj, definition)
+ return if obj.nil? or node.extraattr.empty?
+ if attributes = definition.attributes
+ define_xmlattr(obj)
+ attributes.each do |qname, class_name|
+ child = node.extraattr[qname]
+ next if child.nil?
+ if class_name
+ klass = Mapping.class_from_name(class_name)
+ if klass.include?(::SOAP::SOAPBasetype)
+ child = klass.to_data(child)
+ end
+ end
+ obj.__xmlattr[qname] = child
+ define_xmlattr_accessor(obj, qname)
+ end
+ end
+ end
+
+ def add_elesoap2plainobj(node, obj)
+ node.each do |name, value|
+ obj.__add_xmlele_value(value.elename, any2obj(value))
+ end
+ end
+
+ def add_attributes2obj(node, obj)
+ return if obj.nil? or node.extraattr.empty?
+ define_xmlattr(obj)
+ node.extraattr.each do |qname, value|
+ obj.__xmlattr[qname] = value
+ define_xmlattr_accessor(obj, qname)
+ end
+ end
+
+ # Mapping.define_attr_accessor calls define_method with proc and it exhausts
+ # much memory for each singleton Object. just instance_eval instead of it.
+ def define_xmlattr_accessor(obj, qname)
+ # untaint depends GenSupport.safemethodname
+ name = Mapping.safemethodname('xmlattr_' + qname.name).untaint
+ unless obj.respond_to?(name)
+ # untaint depends QName#dump
+ qnamedump = qname.dump.untaint
+ obj.instance_eval <<-EOS
+ def #{name}
+ @__xmlattr[#{qnamedump}]
+ end
+
+ def #{name}=(value)
+ @__xmlattr[#{qnamedump}] = value
+ end
+ EOS
+ end
+ end
+
+ # Mapping.define_attr_accessor calls define_method with proc and it exhausts
+ # much memory for each singleton Object. just instance_eval instead of it.
+ def define_xmlattr(obj)
+ obj.instance_variable_set('@__xmlattr', {})
+ unless obj.respond_to?(:__xmlattr)
+ obj.instance_eval <<-EOS
+ def __xmlattr
+ @__xmlattr
+ end
+ EOS
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb
new file mode 100644
index 00000000..bd20534a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb
@@ -0,0 +1,577 @@
+# SOAP4R - Ruby type mapping utility.
+# Copyright (C) 2000-2007 NAKAMURA Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'soap/mapping/schemadefinition'
+
+
+module SOAP
+
+
+module Mapping
+ RubyTypeNamespace = 'http://www.ruby-lang.org/xmlns/ruby/type/1.6'
+ RubyTypeInstanceNamespace =
+ 'http://www.ruby-lang.org/xmlns/ruby/type-instance'
+ RubyCustomTypeNamespace = 'http://www.ruby-lang.org/xmlns/ruby/type/custom'
+ ApacheSOAPTypeNamespace = 'http://xml.apache.org/xml-soap'
+
+
+ module TraverseSupport
+ def mark_marshalled_obj(obj, soap_obj)
+ raise if obj.nil?
+ Thread.current[:SOAPMapping][:MarshalKey][obj.__id__] = soap_obj
+ end
+
+ def mark_unmarshalled_obj(node, obj)
+ return if obj.nil?
+ # node.id is not Object#id but SOAPReference#id
+ Thread.current[:SOAPMapping][:MarshalKey][node.id] = obj
+ end
+ end
+
+
+ EMPTY_OPT = {}.freeze
+ def self.obj2soap(obj, registry = nil, type = nil, opt = EMPTY_OPT)
+ registry ||= Mapping::DefaultRegistry
+ soap_obj = nil
+ protect_mapping(opt) do
+ soap_obj = _obj2soap(obj, registry, type)
+ end
+ soap_obj
+ end
+
+ def self.objs2soap(objs, registry = nil, types = nil, opt = EMPTY_OPT)
+ registry ||= Mapping::DefaultRegistry
+ ary = []
+ protect_mapping(opt) do
+ 0.upto(objs.length - 1) do |idx|
+ type = types ? types[idx] : nil
+ soap = _obj2soap(objs[idx], registry, type)
+ ary << soap
+ end
+ end
+ ary
+ end
+
+ def self.soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT)
+ registry ||= Mapping::DefaultRegistry
+ obj = nil
+ protect_mapping(opt) do
+ obj = _soap2obj(node, registry, klass)
+ end
+ obj
+ end
+
+ def self.ary2soap(ary, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
+ registry ||= Mapping::DefaultRegistry
+ type = XSD::QName.new(type_ns, typename)
+ soap_ary = SOAPArray.new(ValueArrayName, 1, type)
+ protect_mapping(opt) do
+ ary.each do |ele|
+ soap_ary.add(_obj2soap(ele, registry, type))
+ end
+ end
+ soap_ary
+ end
+
+ def self.ary2md(ary, rank, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
+ registry ||= Mapping::DefaultRegistry
+ type = XSD::QName.new(type_ns, typename)
+ md_ary = SOAPArray.new(ValueArrayName, rank, type)
+ protect_mapping(opt) do
+ add_md_ary(md_ary, ary, [], registry)
+ end
+ md_ary
+ end
+
+ def self.fault2exception(fault, registry = nil)
+ registry ||= Mapping::DefaultRegistry
+ detail = ""
+ if fault.detail
+ begin
+ fault.detail.type ||= XSD::QName::EMPTY
+ detail = soap2obj(fault.detail, registry) || ""
+ rescue MappingError
+ detail = fault.detail
+ end
+ end
+ if detail.is_a?(Mapping::SOAPException)
+ begin
+ e = detail.to_e
+ remote_backtrace = e.backtrace
+ e.set_backtrace(nil)
+ raise e # ruby sets current caller as local backtrace of e => e2.
+ rescue Exception => e
+ e.set_backtrace(remote_backtrace + e.backtrace[1..-1])
+ raise
+ end
+ else
+ fault.detail = detail
+ fault.set_backtrace(
+ if detail.is_a?(Array)
+ detail
+ else
+ [detail.to_s]
+ end
+ )
+ raise
+ end
+ end
+
+ def self._obj2soap(obj, registry, type = nil)
+ if obj.respond_to?(:to_xmlpart)
+ SOAPRawData.new(obj)
+ elsif defined?(::REXML) and obj.is_a?(::REXML::Element)
+ SOAPRawData.new(SOAPREXMLElementWrap.new(obj))
+ elsif referent = Thread.current[:SOAPMapping][:MarshalKey][obj.__id__] and
+ !Thread.current[:SOAPMapping][:NoReference]
+ SOAPReference.new(referent)
+ elsif registry
+ registry.obj2soap(obj, type)
+ else
+ raise MappingError.new("no mapping registry given")
+ end
+ end
+
+ def self._soap2obj(node, registry, klass = nil)
+ if node.nil?
+ return nil
+ elsif node.is_a?(SOAPReference)
+ target = node.__getobj__
+ # target.id is not Object#id but SOAPReference#id
+ if referent = Thread.current[:SOAPMapping][:MarshalKey][target.id] and
+ !Thread.current[:SOAPMapping][:NoReference]
+ return referent
+ else
+ return _soap2obj(target, registry, klass)
+ end
+ end
+ return registry.soap2obj(node, klass)
+ end
+
+ def self.create_empty_object(klass)
+ klass.allocate
+ end
+
+ # Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here.
+ # Caution: '.' is not allowed here.
+ # To follow XML spec., it should be NCName.
+ # (denied chars) => .[0-F][0-F]
+ # ex. a.b => a.2eb
+ #
+ def self.name2elename(name)
+ name = name.to_s
+ name.gsub(/([^a-zA-Z0-9:_\-]+)/n) {
+ '.' << $1.unpack('H2' * $1.size).join('.')
+ }.gsub(/::/n, '..').to_sym
+ end
+
+ def self.elename2name(name)
+ name.gsub(/\.\./n, '::').gsub(/((?:\.[0-9a-fA-F]{2})+)/n) {
+ [$1.delete('.')].pack('H*')
+ }
+ end
+
+ def self.const_from_name(name, lenient = false)
+ const = ::Object
+ name.sub(/\A::/, '').split('::').each do |const_str|
+ if /\A[A-Z]/ =~ const_str
+ begin
+ if const.const_defined?(const_str)
+ const = const.const_get(const_str)
+ next
+ end
+ rescue NameError
+ end
+ end
+ if lenient
+ const_str = Mapping.safeconstname(const_str)
+ if const.const_defined?(const_str)
+ const = const.const_get(const_str)
+ next
+ end
+ end
+ return nil
+ end
+ const
+ end
+
+ def self.class_from_name(name, lenient = false)
+ unless lenient
+ const = const_from_name_nonlenient(name)
+ else
+ const = const_from_name(name, true)
+ end
+ if const.is_a?(::Class)
+ const
+ else
+ nil
+ end
+ end
+
+ def self.module_from_name(name, lenient = false)
+ unless lenient
+ const = const_from_name_nonlenient(name)
+ else
+ const = const_from_name(name, true)
+ end
+ if const.is_a?(::Module)
+ const
+ else
+ nil
+ end
+ end
+
+ def self.const_from_name_nonlenient(name)
+ if Thread.current[:SOAPMapping]
+ Thread.current[:SOAPMapping][:ConstFromName][name] ||=
+ const_from_name(name)
+ else
+ const_from_name(name)
+ end
+ end
+
+ def self.class2qname(klass)
+ name = schema_type_definition(klass)
+ namespace = schema_ns_definition(klass)
+ XSD::QName.new(namespace, name)
+ end
+
+ def self.class2element(klass)
+ name = schema_type_definition(klass) ||
+ Mapping.name2elename(klass.name)
+ namespace = schema_ns_definition(klass) || RubyCustomTypeNamespace
+ XSD::QName.new(namespace, name)
+ end
+
+ def self.obj2element(obj)
+ name = namespace = nil
+ ivars = obj.instance_variables
+ if ivars.include?('@schema_type')
+ name = obj.instance_variable_get('@schema_type')
+ end
+ if ivars.include?('@schema_ns')
+ namespace = obj.instance_variable_get('@schema_ns')
+ end
+ if !name or !namespace
+ class2qname(obj.class)
+ else
+ XSD::QName.new(namespace, name)
+ end
+ end
+
+ def self.to_qname(obj, ns = nil)
+ if obj.is_a?(XSD::QName)
+ obj
+ else
+ XSD::QName.new(ns, obj)
+ end
+ end
+
+ def self.define_singleton_method(obj, name, &block)
+ sclass = (class << obj; self; end)
+ sclass.class_eval {
+ define_method(name, &block)
+ }
+ end
+
+ def self.get_attributes(obj)
+ if obj.is_a?(::Hash)
+ obj
+ else
+ rs = {}
+ obj.instance_variables.each do |ele|
+ rs[ele.sub(/^@/, '')] = obj.instance_variable_get(ele)
+ end
+ rs
+ end
+ end
+
+ EMPTY_ATTRIBUTES = {}.freeze
+ def self.get_attributes_for_any(obj)
+ if obj.respond_to?(:__xmlele_any)
+ obj.__xmlele_any || EMPTY_ATTRIBUTES
+ else
+ get_attributes(obj)
+ end
+ end
+
+ def self.get_attribute(obj, attr_name)
+ case obj
+ when ::SOAP::Mapping::Object
+ return obj[attr_name]
+ when ::Hash
+ return obj[attr_name] || obj[attr_name.intern]
+ else
+ if obj.respond_to?(attr_name)
+ return obj.__send__(attr_name)
+ end
+ iv = obj.instance_variables
+ name = Mapping.safevarname(attr_name)
+ if iv.include?("@#{name}")
+ return obj.instance_variable_get("@#{name}")
+ elsif iv.include?("@#{attr_name}")
+ return obj.instance_variable_get("@#{attr_name}")
+ end
+ if obj.respond_to?(name)
+ return obj.__send__(name)
+ end
+ nil
+ end
+ end
+
+ def self.set_attributes(obj, values)
+ case obj
+ when ::SOAP::Mapping::Object
+ values.each do |attr_name, value|
+ obj.__add_xmlele_value(attr_name, value)
+ end
+ else
+ values.each do |attr_name, value|
+ # untaint depends GenSupport.safevarname
+ name = Mapping.safevarname(attr_name).untaint
+ setter = name + "="
+ if obj.respond_to?(setter)
+ obj.__send__(setter, value)
+ else
+ obj.instance_variable_set('@' + name, value)
+ begin
+ unless obj.respond_to?(name)
+ obj.instance_eval <<-EOS
+ def #{name}
+ @#{name}
+ end
+ EOS
+ end
+ unless self.respond_to?(name + "=")
+ obj.instance_eval <<-EOS
+ def #{name}=(value)
+ @#{name} = value
+ end
+ EOS
+ end
+ rescue TypeError
+ # singleton class may not exist (e.g. Float)
+ end
+ end
+ end
+ end
+ end
+
+ def self.safeconstname(name)
+ Thread.current[:SOAPMapping][:SafeConstName][name] ||=
+ XSD::CodeGen::GenSupport.safeconstname(name)
+ end
+
+ def self.safemethodname(name)
+ Thread.current[:SOAPMapping][:SafeMethodName][name] ||=
+ XSD::CodeGen::GenSupport.safemethodname(name)
+ end
+
+ def self.safevarname(name)
+ Thread.current[:SOAPMapping][:SafeVarName][name] ||=
+ XSD::CodeGen::GenSupport.safevarname(name)
+ end
+
+ def self.root_type_hint
+ Thread.current[:SOAPMapping][:RootTypeHint]
+ end
+
+ def self.reset_root_type_hint
+ Thread.current[:SOAPMapping][:RootTypeHint] = false
+ end
+
+ def self.external_ces
+ Thread.current[:SOAPMapping][:ExternalCES]
+ end
+
+ def self.schema_ns_definition(klass)
+ class_schema_variable(:schema_ns, klass)
+ end
+
+ def self.schema_name_definition(klass)
+ class_schema_variable(:schema_name, klass)
+ end
+
+ def self.schema_type_definition(klass)
+ class_schema_variable(:schema_type, klass)
+ end
+
+ def self.schema_qualified_definition(klass)
+ class_schema_variable(:schema_qualified, klass)
+ end
+
+ def self.schema_element_definition(klass)
+ class_schema_variable(:schema_element, klass)
+ end
+
+ def self.schema_attribute_definition(klass)
+ class_schema_variable(:schema_attribute, klass)
+ end
+
+ def self.schema_definition_classdef(klass)
+ if Thread.current[:SOAPMapping][:SchemaDefinition].key?(klass)
+ return Thread.current[:SOAPMapping][:SchemaDefinition][klass]
+ end
+ schema_ns = schema_ns_definition(klass)
+ schema_name = schema_name_definition(klass)
+ schema_type = schema_type_definition(klass)
+ qualified = schema_qualified_definition(klass)
+ elements = schema_element_definition(klass)
+ attributes = schema_attribute_definition(klass)
+ return nil if schema_name.nil? and schema_type.nil?
+ schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name
+ schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type
+ definition = create_schema_definition(klass,
+ :schema_name => schema_name,
+ :schema_type => schema_type,
+ :is_anonymous => false,
+ :schema_qualified => qualified,
+ :schema_element => elements,
+ :schema_attribute => attributes
+ )
+ Thread.current[:SOAPMapping][:SchemaDefinition][klass] = definition
+ definition
+ end
+
+ def self.create_schema_definition(klass, definition)
+ schema_ns = definition[:schema_ns]
+ schema_name = definition[:schema_name]
+ schema_type = definition[:schema_type]
+ is_anonymous = definition[:is_anonymous]
+ schema_basetype = definition[:schema_basetype]
+ schema_qualified = definition[:schema_qualified]
+ schema_element = definition[:schema_element]
+ schema_attributes = definition[:schema_attribute]
+ definition = SchemaDefinition.new(klass, schema_name, schema_type, is_anonymous, schema_qualified)
+ definition.basetype = schema_basetype
+ definition.attributes = schema_attributes
+ if schema_element
+ if schema_element.respond_to?(:is_concrete_definition) and
+ schema_element.is_concrete_definition
+ definition.elements = schema_element
+ else
+ default_ns = schema_name.namespace if schema_name
+ default_ns ||= schema_type.namespace if schema_type
+ definition.elements = parse_schema_definition(schema_element, default_ns)
+ if klass < ::Array
+ definition.elements.set_array
+ end
+ end
+ end
+ definition
+ end
+
+ # returns SchemaComplexTypeDefinition
+ def self.parse_schema_definition(schema_element, default_ns)
+ definition = nil
+ if schema_element[0] == :choice
+ schema_element.shift
+ definition = SchemaChoiceDefinition.new
+ else
+ definition = SchemaSequenceDefinition.new
+ end
+ schema_element.each do |ele|
+ element_definition = parse_schema_element_definition(ele, default_ns)
+ definition << element_definition
+ end
+ definition
+ end
+
+ # returns SchemaElementDefinition
+ def self.parse_schema_element_definition(schema_element, default_ns)
+ if schema_element[0] == :choice
+ parse_schema_definition(schema_element, default_ns)
+ elsif schema_element[0].is_a?(Array)
+ parse_schema_definition(schema_element, default_ns)
+ else
+ varname, info, occurrence = schema_element
+ mapped_class_str, elename = info
+ if occurrence
+ minoccurs, maxoccurs = occurrence
+ else
+ minoccurs, maxoccurs = 1, 1
+ end
+ as_any = as_array = false
+ if /\[\]$/ =~ mapped_class_str
+ mapped_class_str = mapped_class_str.sub(/\[\]$/, '')
+ if mapped_class_str.empty?
+ mapped_class_str = nil
+ end
+ as_array = true
+ end
+ if mapped_class_str
+ mapped_class = Mapping.class_from_name(mapped_class_str)
+ if mapped_class.nil?
+ warn("cannot find mapped class: #{mapped_class_str}")
+ end
+ end
+ if elename == XSD::AnyTypeName
+ as_any = true
+ elsif elename.nil?
+ elename = XSD::QName.new(default_ns, varname)
+ end
+ SchemaElementDefinition.new(
+ varname, mapped_class, elename, minoccurs, maxoccurs, as_any, as_array)
+ end
+ end
+
+ class << Mapping
+ public
+
+ def protect_threadvars(*symbols)
+ backup = {}
+ begin
+ symbols.each do |sym|
+ backup[sym] = Thread.current[sym]
+ end
+ yield
+ ensure
+ symbols.each do |sym|
+ Thread.current[sym] = backup[sym]
+ end
+ end
+ end
+
+ private
+
+ def class_schema_variable(sym, klass)
+ var = "@@#{sym}"
+ klass.class_variables.include?(var) ? klass.class_eval(var) : nil
+ end
+
+ def protect_mapping(opt)
+ protect_threadvars(:SOAPMapping) do
+ data = Thread.current[:SOAPMapping] = {}
+ data[:MarshalKey] = {}
+ data[:ExternalCES] = opt[:external_ces] || XSD::Charset.encoding
+ data[:NoReference] = opt[:no_reference]
+ data[:RootTypeHint] = opt[:root_type_hint]
+ data[:SchemaDefinition] = {}
+ data[:SafeConstName] = {}
+ data[:SafeMethodName] = {}
+ data[:SafeVarName] = {}
+ data[:ConstFromName] = {}
+ yield
+ end
+ end
+
+ def add_md_ary(md_ary, ary, indices, registry)
+ for idx in 0..(ary.size - 1)
+ if ary[idx].is_a?(Array)
+ add_md_ary(md_ary, ary[idx], indices + [idx], registry)
+ else
+ md_ary[*(indices + [idx])] = _obj2soap(ary[idx], registry)
+ end
+ end
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb
new file mode 100644
index 00000000..09ad8a70
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb
@@ -0,0 +1,295 @@
+# SOAP4R - Mapping registry.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/mapping/mapping'
+
+
+module SOAP
+
+
+module Marshallable
+ # @@type_ns = Mapping::RubyCustomTypeNamespace
+end
+
+
+module Mapping
+
+
+module MappedException; end
+
+
+RubyTypeName = XSD::QName.new(RubyTypeInstanceNamespace, 'rubyType')
+RubyExtendName = XSD::QName.new(RubyTypeInstanceNamespace, 'extends')
+RubyIVarName = XSD::QName.new(RubyTypeInstanceNamespace, 'ivars')
+
+
+# For anyType object: SOAP::Mapping::Object not ::Object
+class Object
+ def initialize
+ @__xmlele_type = {}
+ @__xmlele = []
+ @__xmlattr = {}
+ end
+
+ def inspect
+ sprintf("#<%s:0x%x%s>", self.class.name, __id__,
+ @__xmlele.collect { |name, value| " #{name}=#{value.inspect}" }.join)
+ end
+
+ def __xmlattr
+ @__xmlattr
+ end
+
+ def __xmlele
+ @__xmlele
+ end
+
+ def [](qname)
+ qname = Mapping.to_qname(qname)
+ @__xmlele.each do |k, v|
+ return v if k == qname
+ end
+ # fallback
+ @__xmlele.each do |k, v|
+ return v if k.name == qname.name
+ end
+ nil
+ end
+
+ def []=(qname, value)
+ qname = Mapping.to_qname(qname)
+ found = false
+ @__xmlele.each do |pair|
+ if pair[0] == qname
+ found = true
+ pair[1] = value
+ end
+ end
+ unless found
+ __define_attr_accessor(qname)
+ @__xmlele << [qname, value]
+ end
+ @__xmlele_type[qname] = :single
+ end
+
+ def __add_xmlele_value(qname, value)
+ found = false
+ @__xmlele.map! do |k, v|
+ if k == qname
+ found = true
+ [k, __set_xmlele_value(k, v, value)]
+ else
+ [k, v]
+ end
+ end
+ unless found
+ __define_attr_accessor(qname)
+ @__xmlele << [qname, value]
+ @__xmlele_type[qname] = :single
+ end
+ value
+ end
+
+ def marshal_load(dumpobj)
+ __import(dumpobj)
+ end
+
+private
+
+ # Mapping.define_attr_accessor calls define_method with proc and it exhausts
+ # much memory for each singleton Object. just instance_eval instead of it.
+ def __define_attr_accessor(qname)
+ # untaint depends GenSupport.safemethodname
+ name = Mapping.safemethodname(qname.name).untaint
+ # untaint depends on QName#dump
+ qnamedump = qname.dump.untaint
+ singleton = false
+ unless self.respond_to?(name)
+ singleton = true
+ instance_eval <<-EOS
+ def #{name}
+ self[#{qnamedump}]
+ end
+ EOS
+ end
+ unless self.respond_to?(name + "=")
+ singleton = true
+ instance_eval <<-EOS
+ def #{name}=(value)
+ self[#{qnamedump}] = value
+ end
+ EOS
+ end
+ if singleton && !self.respond_to?(:marshal_dump)
+ instance_eval <<-EOS
+ def marshal_dump
+ __export
+ end
+ EOS
+ end
+ end
+
+ def __set_xmlele_value(key, org, value)
+ case @__xmlele_type[key]
+ when :multi
+ org << value
+ org
+ when :single
+ @__xmlele_type[key] = :multi
+ [org, value]
+ else
+ raise RuntimeError.new("unknown type")
+ end
+ end
+
+ def __export
+ dumpobj = ::SOAP::Mapping::Object.new
+ dumpobj.__xmlele.replace(@__xmlele)
+ dumpobj.__xmlattr.replace(@__xmlattr)
+ dumpobj
+ end
+
+ def __import(dumpobj)
+ @__xmlele_type = {}
+ @__xmlele = []
+ @__xmlattr = {}
+ dumpobj.__xmlele.each do |qname, value|
+ __add_xmlele_value(qname, value)
+ end
+ @__xmlattr.replace(dumpobj.__xmlattr)
+ end
+end
+
+
+class MappingError < Error; end
+
+
+module RegistrySupport
+ def initialize
+ super()
+ @class_schema_definition = {}
+ @class_elename_schema_definition = {}
+ @elename_schema_definition = {}
+ @type_schema_definition = {}
+ end
+
+ def register(definition)
+ obj_class = definition[:class]
+ definition = Mapping.create_schema_definition(obj_class, definition)
+ # give complexType definition a priority explicitly
+ if !@class_schema_definition[obj_class] or definition.type
+ @class_schema_definition[obj_class] = definition
+ end
+ if definition.elename and !definition.is_anonymous?
+ @class_elename_schema_definition[obj_class] = definition
+ @elename_schema_definition[definition.elename] = definition
+ end
+ if definition.type
+ @type_schema_definition[definition.type] = definition
+ end
+ end
+
+ def schema_definition_from_class(klass)
+ @class_schema_definition[klass] || Mapping.schema_definition_classdef(klass)
+ end
+
+ def elename_schema_definition_from_class(klass)
+ @class_elename_schema_definition[klass]
+ end
+
+ def schema_definition_from_elename(qname)
+ @elename_schema_definition[qname]
+ end
+
+ def schema_definition_from_type(type)
+ @type_schema_definition[type]
+ end
+
+ def find_node_definition(node)
+ schema_definition_from_type(node.type) ||
+ schema_definition_from_elename(node.elename) ||
+ find_schema_definition(node.elename.name) ||
+ find_schema_definition(node.type.name)
+ end
+
+ def find_schema_definition(name)
+ return nil unless name
+ typestr = Mapping.safeconstname(name)
+ obj_class = Mapping.class_from_name(typestr)
+ if obj_class
+ schema_definition_from_class(obj_class)
+ end
+ end
+
+ def add_attributes2soap(obj, ele)
+ if definition = Mapping.schema_definition_classdef(obj.class)
+ add_definedattributes2soap(obj, ele, definition)
+ elsif obj.respond_to?(:__xmlattr)
+ obj.__xmlattr.each do |key, value|
+ ele.extraattr[key] = value
+ end
+ end
+ end
+
+ def add_definedattributes2soap(obj, ele, typedef)
+ if typedef.attributes
+ typedef.attributes.each do |qname, param|
+ value = get_xmlattr_value(obj, qname)
+ ele.extraattr[qname] = value unless value.nil?
+ end
+ end
+ end
+
+ def get_xmlattr_value(obj, qname)
+ attrname = 'xmlattr_' + qname.name
+ value = Mapping.get_attribute(obj, attrname)
+ if value.nil?
+ attrname = Mapping.safemethodname('xmlattr_' + qname.name)
+ value = Mapping.get_attribute(obj, attrname)
+ end
+ value
+ end
+
+ def base2soap(obj, type, qualified = nil)
+ return SOAPNil.new if obj.nil?
+ soap_obj = nil
+ if type <= XSD::XSDString
+ str = XSD::Charset.encoding_conv(obj.to_s, Mapping.external_ces,
+ XSD::Charset.encoding)
+ soap_obj = type.new(str)
+ else
+ soap_obj = type.new(obj)
+ end
+ soap_obj.qualified = qualified
+ soap_obj
+ end
+
+ def base2obj(value, klass)
+ v = if value.respond_to?(:data)
+ value.data
+ elsif value.respond_to?(:text)
+ value.text
+ else
+ nil
+ end
+ if value.is_a?(klass)
+ v
+ else
+ klass.to_data(v)
+ end
+ end
+
+ def is_stubobj_elements_for_array(vars)
+ vars.keys.size == 1 and vars.values[0].is_a?(::Array)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb
new file mode 100644
index 00000000..8b5f7c04
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb
@@ -0,0 +1,446 @@
+# SOAP4R - Ruby type mapping factory.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'continuation'
+
+module SOAP
+module Mapping
+
+
+class RubytypeFactory < Factory
+ TYPE_STRING = XSD::QName.new(RubyTypeNamespace, 'String')
+ TYPE_TIME = XSD::QName.new(RubyTypeNamespace, 'Time')
+ TYPE_ARRAY = XSD::QName.new(RubyTypeNamespace, 'Array')
+ TYPE_REGEXP = XSD::QName.new(RubyTypeNamespace, 'Regexp')
+ TYPE_RANGE = XSD::QName.new(RubyTypeNamespace, 'Range')
+ TYPE_CLASS = XSD::QName.new(RubyTypeNamespace, 'Class')
+ TYPE_MODULE = XSD::QName.new(RubyTypeNamespace, 'Module')
+ TYPE_SYMBOL = XSD::QName.new(RubyTypeNamespace, 'Symbol')
+ TYPE_STRUCT = XSD::QName.new(RubyTypeNamespace, 'Struct')
+ TYPE_HASH = XSD::QName.new(RubyTypeNamespace, 'Map')
+
+ def initialize(config = {})
+ @config = config
+ @allow_untyped_struct = @config.key?(:allow_untyped_struct) ?
+ @config[:allow_untyped_struct] : true
+ @allow_original_mapping = @config.key?(:allow_original_mapping) ?
+ @config[:allow_original_mapping] : false
+ @string_factory = StringFactory_.new(true)
+ @basetype_factory = BasetypeFactory_.new(true)
+ @datetime_factory = DateTimeFactory_.new(true)
+ @array_factory = ArrayFactory_.new(true)
+ @hash_factory = HashFactory_.new(true)
+ end
+
+ def obj2soap(soap_class, obj, info, map)
+ param = nil
+ case obj
+ when ::String
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @string_factory.obj2soap(SOAPString, obj, info, map)
+ if obj.class != String
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ addiv2soapattr(param, obj, map)
+ when ::Time
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @datetime_factory.obj2soap(SOAPDateTime, obj, info, map)
+ if obj.class != Time
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ addiv2soapattr(param, obj, map)
+ when ::Array
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @array_factory.obj2soap(nil, obj, info, map)
+ if obj.class != Array
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ addiv2soapattr(param, obj, map)
+ when ::NilClass
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @basetype_factory.obj2soap(SOAPNil, obj, info, map)
+ addiv2soapattr(param, obj, map)
+ when ::FalseClass, ::TrueClass
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @basetype_factory.obj2soap(SOAPBoolean, obj, info, map)
+ addiv2soapattr(param, obj, map)
+ when ::Integer
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @basetype_factory.obj2soap(SOAPInt, obj, info, map)
+ param ||= @basetype_factory.obj2soap(SOAPInteger, obj, info, map)
+ param ||= @basetype_factory.obj2soap(SOAPDecimal, obj, info, map)
+ addiv2soapattr(param, obj, map)
+ when ::Float
+ unless @allow_original_mapping
+ return nil
+ end
+ param = @basetype_factory.obj2soap(SOAPDouble, obj, info, map)
+ if obj.class != Float
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ addiv2soapattr(param, obj, map)
+ when ::Hash
+ unless @allow_original_mapping
+ return nil
+ end
+ if obj.respond_to?(:default_proc) && obj.default_proc
+ raise TypeError.new("cannot dump hash with default proc")
+ end
+ param = SOAPStruct.new(TYPE_HASH)
+ mark_marshalled_obj(obj, param)
+ if obj.class != Hash
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ obj.each do |key, value|
+ elem = SOAPStruct.new # Undefined type.
+ elem.add("key", Mapping._obj2soap(key, map))
+ elem.add("value", Mapping._obj2soap(value, map))
+ param.add("item", elem)
+ end
+ param.add('default', Mapping._obj2soap(obj.default, map))
+ addiv2soapattr(param, obj, map)
+ when ::Regexp
+ unless @allow_original_mapping
+ return nil
+ end
+ param = SOAPStruct.new(TYPE_REGEXP)
+ mark_marshalled_obj(obj, param)
+ if obj.class != Regexp
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ param.add('source', SOAPBase64.new(obj.source))
+ options = obj.options
+ param.add('options', SOAPInt.new(options))
+ addiv2soapattr(param, obj, map)
+ when ::Range
+ unless @allow_original_mapping
+ return nil
+ end
+ param = SOAPStruct.new(TYPE_RANGE)
+ mark_marshalled_obj(obj, param)
+ if obj.class != Range
+ param.extraattr[RubyTypeName] = obj.class.name
+ end
+ param.add('begin', Mapping._obj2soap(obj.begin, map))
+ param.add('end', Mapping._obj2soap(obj.end, map))
+ param.add('exclude_end', SOAP::SOAPBoolean.new(obj.exclude_end?))
+ addiv2soapattr(param, obj, map)
+ when ::Class
+ unless @allow_original_mapping
+ return nil
+ end
+ if obj.to_s[0] == ?#
+ raise TypeError.new("can't dump anonymous class #{obj}")
+ end
+ param = SOAPStruct.new(TYPE_CLASS)
+ mark_marshalled_obj(obj, param)
+ param.add('name', SOAPString.new(obj.name))
+ addiv2soapattr(param, obj, map)
+ when ::Module
+ unless @allow_original_mapping
+ return nil
+ end
+ if obj.to_s[0] == ?#
+ raise TypeError.new("can't dump anonymous module #{obj}")
+ end
+ param = SOAPStruct.new(TYPE_MODULE)
+ mark_marshalled_obj(obj, param)
+ param.add('name', SOAPString.new(obj.name))
+ addiv2soapattr(param, obj, map)
+ when ::Symbol
+ unless @allow_original_mapping
+ return nil
+ end
+ param = SOAPStruct.new(TYPE_SYMBOL)
+ mark_marshalled_obj(obj, param)
+ param.add('id', SOAPString.new(obj.id2name))
+ addiv2soapattr(param, obj, map)
+ when ::Struct
+ unless @allow_original_mapping
+ # treat it as an user defined class. [ruby-talk:104980]
+ #param = unknownobj2soap(soap_class, obj, info, map)
+ param = SOAPStruct.new(XSD::AnyTypeName)
+ mark_marshalled_obj(obj, param)
+ obj.members.each do |member|
+ param.add(Mapping.name2elename(member),
+ Mapping._obj2soap(obj[member], map))
+ end
+ else
+ param = SOAPStruct.new(TYPE_STRUCT)
+ mark_marshalled_obj(obj, param)
+ param.add('type', ele_type = SOAPString.new(obj.class.to_s))
+ ele_member = SOAPStruct.new
+ obj.members.each do |member|
+ ele_member.add(Mapping.name2elename(member),
+ Mapping._obj2soap(obj[member], map))
+ end
+ param.add('member', ele_member)
+ addiv2soapattr(param, obj, map)
+ end
+ when ::IO, ::Binding, ::Continuation, ::Data, ::Dir, ::File::Stat,
+ ::MatchData, Method, ::Proc, ::Process::Status, ::Thread,
+ ::ThreadGroup, ::UnboundMethod
+ return nil
+ when ::SOAP::Mapping::Object
+ param = SOAPStruct.new(XSD::AnyTypeName)
+ mark_marshalled_obj(obj, param)
+ obj.__xmlele.each do |key, value|
+ param.add(key.name, Mapping._obj2soap(value, map))
+ end
+ obj.__xmlattr.each do |key, value|
+ param.extraattr[key] = value
+ end
+ when ::Exception
+ typestr = Mapping.name2elename(obj.class.to_s)
+ param = SOAPStruct.new(XSD::QName.new(RubyTypeNamespace, typestr))
+ mark_marshalled_obj(obj, param)
+ param.add('message', Mapping._obj2soap(obj.message, map))
+ param.add('backtrace', Mapping._obj2soap(obj.backtrace, map))
+ addiv2soapattr(param, obj, map)
+ else
+ param = unknownobj2soap(soap_class, obj, info, map)
+ end
+ param
+ end
+
+ def soap2obj(obj_class, node, info, map)
+ rubytype = node.extraattr[RubyTypeName]
+ if rubytype or node.type.namespace == RubyTypeNamespace
+ rubytype2obj(node, info, map, rubytype)
+ elsif node.type == XSD::AnyTypeName or node.type == XSD::AnySimpleTypeName
+ anytype2obj(node, info, map)
+ else
+ unknowntype2obj(node, info, map)
+ end
+ end
+
+private
+
+ def addiv2soapattr(node, obj, map)
+ return if obj.instance_variables.empty?
+ ivars = SOAPStruct.new # Undefined type.
+ setiv2soap(ivars, obj, map)
+ node.extraattr[RubyIVarName] = ivars
+ end
+
+ def unknownobj2soap(soap_class, obj, info, map)
+ if anonymous_class?(obj)
+ raise TypeError.new("can't dump anonymous class #{obj}")
+ end
+ singleton_class = class << obj; self; end
+ if !obj.singleton_methods(true).empty? or
+ !singleton_class.instance_variables.empty?
+ raise TypeError.new("singleton can't be dumped #{obj}")
+ end
+ if !(singleton_class.ancestors - obj.class.ancestors).empty?
+ typestr = Mapping.name2elename(obj.class.to_s)
+ type = XSD::QName.new(RubyTypeNamespace, typestr)
+ else
+ type = Mapping.class2element(obj.class)
+ end
+ param = SOAPStruct.new(type)
+ mark_marshalled_obj(obj, param)
+ setiv2soap(param, obj, map)
+ param
+ end
+
+ def rubytype2obj(node, info, map, rubytype)
+ klass = rubytype ? Mapping.class_from_name(rubytype) : nil
+ obj = nil
+ case node
+ when SOAPString
+ return @string_factory.soap2obj(klass || String, node, info, map)
+ when SOAPDateTime
+ #return @datetime_factory.soap2obj(klass || Time, node, info, map)
+ klass ||= Time
+ t = node.to_time
+ arg = [t.year, t.month, t.mday, t.hour, t.min, t.sec, t.usec]
+ obj = t.gmt? ? klass.gm(*arg) : klass.local(*arg)
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
+ when SOAPArray
+ return @array_factory.soap2obj(klass || Array, node, info, map)
+ when SOAPNil, SOAPBoolean, SOAPInt, SOAPInteger, SOAPDecimal, SOAPDouble
+ return @basetype_factory.soap2obj(nil, node, info, map)
+ when SOAPStruct
+ return rubytypestruct2obj(node, info, map, rubytype)
+ else
+ raise
+ end
+ end
+
+ def rubytypestruct2obj(node, info, map, rubytype)
+ klass = rubytype ? Mapping.class_from_name(rubytype) : nil
+ obj = nil
+ case node.type
+ when TYPE_HASH
+ klass = rubytype ? Mapping.class_from_name(rubytype) : Hash
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ node.each do |key, value|
+ next unless key == 'item'
+ obj[Mapping._soap2obj(value['key'], map)] =
+ Mapping._soap2obj(value['value'], map)
+ end
+ if node.key?('default')
+ obj.default = Mapping._soap2obj(node['default'], map)
+ end
+ when TYPE_REGEXP
+ klass = rubytype ? Mapping.class_from_name(rubytype) : Regexp
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ source = node['source'].string
+ options = node['options'].data || 0
+ Regexp.instance_method(:initialize).bind(obj).call(source, options)
+ when TYPE_RANGE
+ klass = rubytype ? Mapping.class_from_name(rubytype) : Range
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ first = Mapping._soap2obj(node['begin'], map)
+ last = Mapping._soap2obj(node['end'], map)
+ exclude_end = node['exclude_end'].data
+ Range.instance_method(:initialize).bind(obj).call(first, last, exclude_end)
+ when TYPE_CLASS
+ obj = Mapping.class_from_name(node['name'].data)
+ when TYPE_MODULE
+ obj = Mapping.class_from_name(node['name'].data)
+ when TYPE_SYMBOL
+ obj = node['id'].data.intern
+ when TYPE_STRUCT
+ typestr = Mapping.elename2name(node['type'].data)
+ klass = Mapping.class_from_name(typestr)
+ if klass.nil?
+ return false
+ end
+ unless klass <= ::Struct
+ return false
+ end
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ node['member'].each do |name, value|
+ obj[Mapping.elename2name(name)] = Mapping._soap2obj(value, map)
+ end
+ else
+ return unknowntype2obj(node, info, map)
+ end
+ return true, obj
+ end
+
+ def anytype2obj(node, info, map)
+ case node
+ when SOAPBasetype
+ return true, node.data
+ when SOAPStruct
+ klass = ::SOAP::Mapping::Object
+ obj = klass.new
+ mark_unmarshalled_obj(node, obj)
+ node.each do |name, value|
+ obj.__add_xmlele_value(XSD::QName.new(nil, name),
+ Mapping._soap2obj(value, map))
+ end
+ unless node.extraattr.empty?
+ obj.instance_variable_set('@__xmlattr', node.extraattr)
+ end
+ return true, obj
+ else
+ return false
+ end
+ end
+
+ def unknowntype2obj(node, info, map)
+ case node
+ when SOAPBasetype
+ return true, node.data
+ when SOAPArray
+ return @array_factory.soap2obj(Array, node, info, map)
+ when SOAPStruct
+ obj = unknownstruct2obj(node, info, map)
+ return true, obj if obj
+ if !@allow_untyped_struct
+ return false
+ end
+ return anytype2obj(node, info, map)
+ else
+ # Basetype which is not defined...
+ return false
+ end
+ end
+
+ def unknownstruct2obj(node, info, map)
+ unless node.type.name
+ return nil
+ end
+ typestr = Mapping.elename2name(node.type.name)
+ klass = Mapping.class_from_name(typestr)
+ if klass.respond_to?(:soap_marshallable) and !klass.soap_marshallable
+ return nil
+ end
+ if klass.nil? and @allow_untyped_struct
+ klass = Mapping.class_from_name(typestr, true) # lenient
+ end
+ if klass.nil?
+ return nil
+ end
+ if klass <= ::Exception
+ return exception2obj(klass, node, map)
+ end
+ klass_type = Mapping.class2qname(klass)
+ return nil unless node.type.match(klass_type)
+ obj = nil
+ begin
+ obj = Mapping.create_empty_object(klass)
+ rescue
+ # type name "data" tries Data.new which raises TypeError
+ nil
+ end
+ mark_unmarshalled_obj(node, obj)
+ setiv2obj(obj, node, map)
+ obj
+ end
+
+ def exception2obj(klass, node, map)
+ message = Mapping._soap2obj(node['message'], map)
+ backtrace = Mapping._soap2obj(node['backtrace'], map)
+ obj = Mapping.create_empty_object(klass)
+ obj = obj.exception(message)
+ mark_unmarshalled_obj(node, obj)
+ obj.set_backtrace(backtrace)
+ obj
+ end
+
+ # Only creates empty array. Do String#replace it with real string.
+ def array2obj(node, map, rubytype)
+ klass = rubytype ? Mapping.class_from_name(rubytype) : Array
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ obj
+ end
+
+ # Only creates empty string. Do String#replace it with real string.
+ def string2obj(node, map, rubytype)
+ klass = rubytype ? Mapping.class_from_name(rubytype) : String
+ obj = Mapping.create_empty_object(klass)
+ mark_unmarshalled_obj(node, obj)
+ obj
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb
new file mode 100644
index 00000000..d024794e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb
@@ -0,0 +1,170 @@
+# SOAP4R - Ruby type mapping schema definition utility.
+# Copyright (C) 2000-2007 NAKAMURA Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+
+
+module SOAP
+module Mapping
+
+
+class SchemaElementDefinition
+ attr_reader :varname, :mapped_class, :elename, :minoccurs, :maxoccurs
+
+ def initialize(varname, mapped_class, elename, minoccurs, maxoccurs,
+ as_any, as_array)
+ @varname = varname
+ @mapped_class = mapped_class
+ @elename = elename
+ @minoccurs = minoccurs
+ @maxoccurs = maxoccurs
+ @as_any = as_any
+ @as_array = as_array
+ end
+
+ def as_any?
+ @as_any
+ end
+
+ def as_array?
+ @as_array
+ end
+end
+
+module SchemaComplexTypeDefinition
+ include Enumerable
+
+ def initialize
+ @content = []
+ @element_cache = {}
+ end
+
+ def is_concrete_definition
+ true
+ end
+
+ def <<(ele)
+ @content << ele
+ end
+
+ def each
+ @content.each do |ele|
+ yield ele
+ end
+ end
+
+ def size
+ @content.size
+ end
+
+ def as_any?
+ false
+ end
+
+ def as_array?
+ false
+ end
+
+ def find_element(qname)
+ @element_cache[qname] ||= search_element(qname)
+ end
+
+private
+
+ def search_element(qname)
+ each do |ele|
+ if ele.respond_to?(:find_element)
+ found = ele.find_element(qname)
+ return found if found
+ else
+ # relaxed match
+ if ele.elename == qname or
+ (qname.namespace.nil? and ele.elename.name == qname.name)
+ return ele
+ end
+ end
+ end
+ nil
+ end
+end
+
+class SchemaEmptyDefinition
+ include SchemaComplexTypeDefinition
+
+ def initialize
+ super()
+ @content.freeze
+ end
+end
+
+class SchemaSequenceDefinition
+ include SchemaComplexTypeDefinition
+
+ def initialize
+ super()
+ end
+
+ def choice?
+ false
+ end
+
+ # override
+ def as_array?
+ @as_array ||= false
+ end
+
+ def set_array
+ @as_array = true
+ end
+end
+
+class SchemaChoiceDefinition
+ include SchemaComplexTypeDefinition
+
+ def initialize
+ super()
+ end
+
+ def choice?
+ true
+ end
+end
+
+class SchemaDefinition
+ EMPTY = SchemaEmptyDefinition.new
+
+ attr_reader :class_for
+ attr_reader :elename, :type
+ attr_reader :qualified
+ attr_accessor :basetype
+ attr_accessor :attributes
+ attr_accessor :elements
+
+ def initialize(class_for, elename, type, anonymous, qualified)
+ @class_for = class_for
+ @elename = elename
+ @type = type
+ @anonymous = anonymous
+ @qualified = qualified
+ @basetype = nil
+ @elements = EMPTY
+ @attributes = nil
+ end
+
+ def is_anonymous?
+ @anonymous
+ end
+
+ def choice?
+ @elements.choice?
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb
new file mode 100644
index 00000000..691c4d49
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb
@@ -0,0 +1,105 @@
+# SOAP4R - Base type mapping definition
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+
+
+TypeMap = {
+ XSD::XSDAnySimpleType::Type => SOAPAnySimpleType,
+
+ XSD::XSDString::Type => SOAPString,
+ XSD::XSDNormalizedString::Type => SOAPNormalizedString,
+ XSD::XSDToken::Type => SOAPToken,
+ XSD::XSDLanguage::Type => SOAPLanguage,
+ XSD::XSDNMTOKEN::Type => SOAPNMTOKEN,
+ XSD::XSDNMTOKENS::Type => SOAPNMTOKENS,
+ XSD::XSDName::Type => SOAPName,
+ XSD::XSDNCName::Type => SOAPNCName,
+ XSD::XSDID::Type => SOAPID,
+ XSD::XSDIDREF::Type => SOAPIDREF,
+ XSD::XSDIDREFS::Type => SOAPIDREFS,
+ XSD::XSDENTITY::Type => SOAPENTITY,
+ XSD::XSDENTITIES::Type => SOAPENTITIES,
+ XSD::XSDBoolean::Type => SOAPBoolean,
+ XSD::XSDDecimal::Type => SOAPDecimal,
+ XSD::XSDFloat::Type => SOAPFloat,
+ XSD::XSDDouble::Type => SOAPDouble,
+ XSD::XSDDuration::Type => SOAPDuration,
+ XSD::XSDDateTime::Type => SOAPDateTime,
+ XSD::XSDTime::Type => SOAPTime,
+ XSD::XSDDate::Type => SOAPDate,
+ XSD::XSDGYearMonth::Type => SOAPGYearMonth,
+ XSD::XSDGYear::Type => SOAPGYear,
+ XSD::XSDGMonthDay::Type => SOAPGMonthDay,
+ XSD::XSDGDay::Type => SOAPGDay,
+ XSD::XSDGMonth::Type => SOAPGMonth,
+ XSD::XSDHexBinary::Type => SOAPHexBinary,
+ XSD::XSDBase64Binary::Type => SOAPBase64,
+ XSD::XSDAnyURI::Type => SOAPAnyURI,
+ XSD::XSDQName::Type => SOAPQName,
+ XSD::XSDInteger::Type => SOAPInteger,
+ XSD::XSDNonPositiveInteger::Type => SOAPNonPositiveInteger,
+ XSD::XSDNegativeInteger::Type => SOAPNegativeInteger,
+ XSD::XSDLong::Type => SOAPLong,
+ XSD::XSDInt::Type => SOAPInt,
+ XSD::XSDShort::Type => SOAPShort,
+ XSD::XSDByte::Type => SOAPByte,
+ XSD::XSDNonNegativeInteger::Type => SOAPNonNegativeInteger,
+ XSD::XSDUnsignedLong::Type => SOAPUnsignedLong,
+ XSD::XSDUnsignedInt::Type => SOAPUnsignedInt,
+ XSD::XSDUnsignedShort::Type => SOAPUnsignedShort,
+ XSD::XSDUnsignedByte::Type => SOAPUnsignedByte,
+ XSD::XSDPositiveInteger::Type => SOAPPositiveInteger,
+
+ # soap4r does not use soapenc types actively but it should be accepted.
+ SOAP::SOAPString::SOAPENCType => SOAPString,
+ SOAP::SOAPNormalizedString::Type => SOAPNormalizedString,
+ SOAP::SOAPToken::Type => SOAPToken,
+ SOAP::SOAPLanguage::Type => SOAPLanguage,
+ SOAP::SOAPNMTOKEN::Type => SOAPNMTOKEN,
+ SOAP::SOAPNMTOKENS::Type => SOAPNMTOKENS,
+ SOAP::SOAPName::Type => SOAPName,
+ SOAP::SOAPNCName::Type => SOAPNCName,
+ SOAP::SOAPID::Type => SOAPID,
+ SOAP::SOAPIDREF::Type => SOAPIDREF,
+ SOAP::SOAPIDREFS::Type => SOAPIDREFS,
+ SOAP::SOAPENTITY::Type => SOAPENTITY,
+ SOAP::SOAPENTITIES::Type => SOAPENTITIES,
+ SOAP::SOAPBoolean::SOAPENCType => SOAPBoolean,
+ SOAP::SOAPDecimal::SOAPENCType => SOAPDecimal,
+ SOAP::SOAPFloat::SOAPENCType => SOAPFloat,
+ SOAP::SOAPDouble::SOAPENCType => SOAPDouble,
+ SOAP::SOAPDuration::SOAPENCType => SOAPDuration,
+ SOAP::SOAPDateTime::SOAPENCType => SOAPDateTime,
+ SOAP::SOAPTime::SOAPENCType => SOAPTime,
+ SOAP::SOAPDate::SOAPENCType => SOAPDate,
+ SOAP::SOAPGYearMonth::SOAPENCType => SOAPGYearMonth,
+ SOAP::SOAPGYear::SOAPENCType => SOAPGYear,
+ SOAP::SOAPGMonthDay::SOAPENCType => SOAPGMonthDay,
+ SOAP::SOAPGDay::SOAPENCType => SOAPGDay,
+ SOAP::SOAPGMonth::SOAPENCType => SOAPGMonth,
+ SOAP::SOAPHexBinary::SOAPENCType => SOAPHexBinary,
+ SOAP::SOAPBase64::SOAPENCType => SOAPBase64,
+ SOAP::SOAPAnyURI::SOAPENCType => SOAPAnyURI,
+ SOAP::SOAPQName::SOAPENCType => SOAPQName,
+ SOAP::SOAPInteger::SOAPENCType => SOAPInteger,
+ SOAP::SOAPNonPositiveInteger::SOAPENCType => SOAPNonPositiveInteger,
+ SOAP::SOAPNegativeInteger::SOAPENCType => SOAPNegativeInteger,
+ SOAP::SOAPLong::SOAPENCType => SOAPLong,
+ SOAP::SOAPInt::SOAPENCType => SOAPInt,
+ SOAP::SOAPShort::SOAPENCType => SOAPShort,
+ SOAP::SOAPByte::SOAPENCType => SOAPByte,
+ SOAP::SOAPNonNegativeInteger::SOAPENCType => SOAPNonNegativeInteger,
+ SOAP::SOAPUnsignedLong::SOAPENCType => SOAPUnsignedLong,
+ SOAP::SOAPUnsignedInt::SOAPENCType => SOAPUnsignedInt,
+ SOAP::SOAPUnsignedShort::SOAPENCType => SOAPUnsignedShort,
+ SOAP::SOAPUnsignedByte::SOAPENCType => SOAPUnsignedByte,
+ SOAP::SOAPPositiveInteger::SOAPENCType => SOAPPositiveInteger,
+}
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb
new file mode 100644
index 00000000..d12e44d8
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb
@@ -0,0 +1,211 @@
+# SOAP4R - WSDL encoded mapping registry.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'xsd/namedelements'
+require 'soap/baseData'
+require 'soap/mapping/mapping'
+require 'soap/mapping/typeMap'
+
+
+module SOAP
+module Mapping
+
+
+class WSDLEncodedRegistry < EncodedRegistry
+ attr_reader :definedelements
+ attr_reader :definedtypes
+
+ def initialize(definedtypes = XSD::NamedElements::Empty)
+ super()
+ @definedtypes = definedtypes
+ # @definedelements = definedelements needed?
+ # For mapping AnyType element.
+ @rubytype_factory = RubytypeFactory.new(
+ :allow_untyped_struct => true,
+ :allow_original_mapping => true
+ )
+ end
+
+ def obj2soap(obj, qname = nil)
+ soap_obj = nil
+ if type = @definedtypes[qname]
+ soap_obj = obj2typesoap(obj, type)
+ else
+ soap_obj = any2soap(obj, qname)
+ end
+ return soap_obj if soap_obj
+ if @excn_handler_obj2soap
+ soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
+ Mapping._obj2soap(yield_obj, self)
+ }
+ return soap_obj if soap_obj
+ end
+ if qname
+ raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
+ else
+ raise MappingError.new("cannot map #{obj.class.name} to SOAP/OM")
+ end
+ end
+
+ # map anything for now: must refer WSDL while mapping. [ToDo]
+ def soap2obj(node, obj_class = nil)
+ cause = nil
+ begin
+ unless obj_class
+ typestr = Mapping.safeconstname(node.elename.name)
+ obj_class = Mapping.class_from_name(typestr)
+ end
+ return Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class)
+ rescue MappingError
+ cause = $!
+ end
+ if @excn_handler_soap2obj
+ begin
+ return @excn_handler_soap2obj.call(node) { |yield_node|
+ Mapping._soap2obj(yield_node, self)
+ }
+ rescue Exception
+ end
+ end
+ raise MappingError.new("cannot map #{node.type.name} to Ruby object", cause)
+ end
+
+private
+
+ def any2soap(obj, qname)
+ ele = nil
+ if obj.nil?
+ ele = SOAPNil.new
+ elsif qname.nil? or qname == XSD::AnyTypeName
+ ele = @rubytype_factory.obj2soap(nil, obj, nil, self)
+ elsif obj.is_a?(XSD::NSDBase)
+ ele = soap2soap(obj, qname)
+ elsif type = TypeMap[qname]
+ ele = base2soap(obj, type)
+ end
+ add_attributes2soap(obj, ele) unless ele.nil?
+ ele
+ end
+
+ def soap2soap(obj, type_qname)
+ if obj.is_a?(SOAPBasetype)
+ obj
+ elsif obj.is_a?(SOAPStruct) && (type = @definedtypes[type_qname])
+ soap_obj = obj
+ mark_marshalled_obj(obj, soap_obj)
+ elements2soap(obj, soap_obj, type.elements)
+ soap_obj
+ elsif obj.is_a?(SOAPArray) && (type = @definedtypes[type_qname])
+ soap_obj = obj
+ contenttype = type.child_type
+ mark_marshalled_obj(obj, soap_obj)
+ obj.replace do |ele|
+ Mapping._obj2soap(ele, self, contenttype)
+ end
+ soap_obj
+ else
+ nil
+ end
+ end
+
+ def obj2typesoap(obj, type)
+ if type.is_a?(::WSDL::XMLSchema::SimpleType)
+ simpleobj2soap(obj, type)
+ else
+ complexobj2soap(obj, type)
+ end
+ end
+
+ def simpleobj2soap(obj, type)
+ return SOAPNil.new unless obj
+ type.check_lexical_format(obj)
+ if type.base
+ ele = base2soap(obj, TypeMap[type.base])
+ ele.type = type.name
+ elsif type.list
+ value = obj.is_a?(Array) ? obj.join(" ") : obj.to_s
+ ele = base2soap(value, SOAP::SOAPString)
+ else
+ raise MappingError.new("unsupported simpleType: #{type}")
+ end
+ ele
+ end
+
+ def complexobj2soap(obj, type)
+ case type.compoundtype
+ when :TYPE_STRUCT
+ struct2soap(obj, type.name, type)
+ when :TYPE_ARRAY
+ array2soap(obj, type.name, type)
+ when :TYPE_MAP
+ map2soap(obj, type.name, type)
+ when :TYPE_SIMPLE
+ simpleobj2soap(obj, type.simplecontent)
+ when :TYPE_EMPTY
+ raise MappingError.new("should be empty") unless obj.nil?
+ SOAPNil.new
+ else
+ raise MappingError.new("unknown compound type: #{type.compoundtype}")
+ end
+ end
+
+ def struct2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ soap_obj = SOAPStruct.new(type_qname)
+ mark_marshalled_obj(obj, soap_obj)
+ elements2soap(obj, soap_obj, type.elements)
+ soap_obj
+ end
+
+ def array2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ arytype = type.child_type
+ soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
+ unless obj.nil?
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |item|
+ soap_obj.add(Mapping._obj2soap(item, self, arytype))
+ end
+ end
+ soap_obj
+ end
+
+ MapKeyName = XSD::QName.new(nil, "key")
+ MapValueName = XSD::QName.new(nil, "value")
+ def map2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ keytype = type.child_type(MapKeyName) || XSD::AnyTypeName
+ valuetype = type.child_type(MapValueName) || XSD::AnyTypeName
+ soap_obj = SOAPStruct.new(MapQName)
+ unless obj.nil?
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |key, value|
+ elem = SOAPStruct.new
+ elem.add("key", Mapping._obj2soap(key, self, keytype))
+ elem.add("value", Mapping._obj2soap(value, self, valuetype))
+ # ApacheAxis allows only 'item' here.
+ soap_obj.add("item", elem)
+ end
+ end
+ soap_obj
+ end
+
+ def elements2soap(obj, soap_obj, elements)
+ elements.each do |element|
+ name = element.name.name
+ child_obj = Mapping.get_attribute(obj, name)
+ soap_obj.add(name,
+ Mapping._obj2soap(child_obj, self, element.type || element.name))
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb
new file mode 100644
index 00000000..1c4b4f2e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb
@@ -0,0 +1,248 @@
+# SOAP4R - WSDL literal mapping registry.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/mapping/mapping'
+require 'soap/mapping/literalregistry'
+require 'soap/mapping/typeMap'
+require 'xsd/codegen/gensupport'
+require 'xsd/namedelements'
+
+
+module SOAP
+module Mapping
+
+
+class WSDLLiteralRegistry < LiteralRegistry
+ attr_reader :definedelements
+ attr_reader :definedtypes
+
+ def initialize(definedtypes = XSD::NamedElements::Empty,
+ definedelements = XSD::NamedElements::Empty)
+ super()
+ @definedtypes = definedtypes
+ @definedelements = definedelements
+ end
+
+ def obj2soap(obj, qname, obj_class = nil)
+ soap_obj = nil
+ if obj.is_a?(SOAPElement)
+ soap_obj = obj
+ elsif eledef = @definedelements[qname]
+ soap_obj = obj2elesoap(obj, eledef)
+ elsif type = @definedtypes[qname]
+ soap_obj = obj2typesoap(obj, type)
+ else
+ soap_obj = any2soap(obj, qname, obj_class)
+ end
+ return soap_obj if soap_obj
+ if @excn_handler_obj2soap
+ soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
+ Mapping.obj2soap(yield_obj, nil, nil, MAPPING_OPT)
+ }
+ return soap_obj if soap_obj
+ end
+ raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
+ end
+
+ # node should be a SOAPElement
+ def soap2obj(node, obj_class = nil)
+ cause = nil
+ begin
+ return any2obj(node, obj_class)
+ rescue MappingError
+ cause = $!
+ end
+ if @excn_handler_soap2obj
+ begin
+ return @excn_handler_soap2obj.call(node) { |yield_node|
+ Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT)
+ }
+ rescue Exception
+ end
+ end
+ if node.respond_to?(:type)
+ raise MappingError.new("cannot map #{node.type.name} to Ruby object", cause)
+ else
+ raise MappingError.new("cannot map #{node.elename.name} to Ruby object", cause)
+ end
+ end
+
+private
+
+ def obj2elesoap(obj, eledef)
+ ele = nil
+ qualified = (eledef.elementform == 'qualified')
+ if obj.is_a?(SOAPNil)
+ ele = obj
+ elsif eledef.type
+ if type = @definedtypes[eledef.type]
+ ele = obj2typesoap(obj, type)
+ elsif type = TypeMap[eledef.type]
+ ele = base2soap(obj, type)
+ else
+ raise MappingError.new("cannot find type #{eledef.type}")
+ end
+ elsif eledef.local_complextype
+ ele = obj2typesoap(obj, eledef.local_complextype)
+ elsif eledef.local_simpletype
+ ele = obj2typesoap(obj, eledef.local_simpletype)
+ else
+ raise MappingError.new('illegal schema?')
+ end
+ ele.elename = eledef.name
+ ele.qualified = qualified
+ ele
+ end
+
+ def obj2typesoap(obj, type)
+ ele = nil
+ if type.is_a?(::WSDL::XMLSchema::SimpleType)
+ ele = simpleobj2soap(obj, type)
+ else # complexType
+ if type.simplecontent
+ ele = simpleobj2soap(obj, type.simplecontent)
+ else
+ ele = complexobj2soap(obj, type)
+ end
+ ele.type = type.name
+ if type.base or Mapping.root_type_hint
+ Mapping.reset_root_type_hint
+ ele.force_typed = true
+ end
+ add_definedattributes2soap(obj, ele, type)
+ end
+ ele
+ end
+
+ def simpleobj2soap(obj, type)
+ type.check_lexical_format(obj)
+ return SOAPNil.new if obj.nil?
+ if type.base
+ ele = base2soap(obj, TypeMap[type.base])
+ elsif type.list
+ value = obj.is_a?(Array) ? obj.join(" ") : obj.to_s
+ ele = base2soap(value, SOAP::SOAPString)
+ else
+ raise MappingError.new("unsupported simpleType: #{type}")
+ end
+ ele
+ end
+
+ def complexobj2soap(obj, type)
+ ele = SOAPElement.new(type.name)
+ complexobj2sequencesoap(obj, ele, type, type.choice?, type.choice?)
+ ele
+ end
+
+ def complexobj2sequencesoap(obj, soap, type, nillable, is_choice)
+ added = false
+ type.elements.each do |child_ele|
+ case child_ele
+ when WSDL::XMLSchema::Any
+ any = Mapping.get_attributes_for_any(obj)
+ SOAPElement.from_objs(any).each do |child|
+ soap.add(child)
+ end
+ ele_added = true
+ when WSDL::XMLSchema::Element
+ ele_added = complexobj2soapchildren(obj, soap, child_ele, nillable)
+ when WSDL::XMLSchema::Sequence
+ ele_added = complexobj2sequencesoap(obj, soap, child_ele, nillable, false)
+ when WSDL::XMLSchema::Choice
+ ele_added = complexobj2sequencesoap(obj, soap, child_ele, true, true)
+ else
+ raise MappingError.new("unknown type: #{child_ele}")
+ end
+ added = true if ele_added
+ break if is_choice and ele_added
+ end
+ added
+ end
+
+ def complexobj2soapchildren(obj, soap, child_ele, nillable = false)
+ if child_ele.map_as_array?
+ complexobj2soapchildren_array(obj, soap, child_ele, nillable)
+ else
+ complexobj2soapchildren_single(obj, soap, child_ele, nillable)
+ end
+ end
+
+ def complexobj2soapchildren_array(obj, soap, child_ele, nillable)
+ child = Mapping.get_attribute(obj, child_ele.name.name)
+ if child.nil? and obj.is_a?(::Array)
+ child = obj
+ end
+ if child.nil?
+ return false if nillable
+ if child_soap = nil2soap(child_ele)
+ soap.add(child_soap)
+ return true
+ else
+ return false
+ end
+ end
+ unless child.respond_to?(:each)
+ return false
+ end
+ child.each do |item|
+ if item.is_a?(SOAPElement)
+ soap.add(item)
+ else
+ child_soap = obj2elesoap(item, child_ele)
+ soap.add(child_soap)
+ end
+ end
+ true
+ end
+
+ def complexobj2soapchildren_single(obj, soap, child_ele, nillable)
+ child = Mapping.get_attribute(obj, child_ele.name.name)
+ case child
+ when NilClass
+ return false if nillable
+ if child_soap = nil2soap(child_ele)
+ soap.add(child_soap)
+ true
+ else
+ false
+ end
+ when SOAPElement
+ soap.add(child)
+ true
+ else
+ child_soap = obj2elesoap(child, child_ele)
+ soap.add(child_soap)
+ true
+ end
+ end
+
+ def nil2soap(ele)
+ if ele.nillable
+ obj2elesoap(nil, ele) # add an empty element
+ elsif ele.minoccurs == 0
+ nil # intends no element
+ else
+ warn("nil not allowed: #{ele.name.name}")
+ nil
+ end
+ end
+
+ def add_definedattributes2soap(obj, ele, typedef)
+ if typedef.attributes
+ typedef.attributes.each do |at|
+ value = get_xmlattr_value(obj, at.name)
+ ele.extraattr[at.name] = value unless value.nil?
+ end
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb b/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb
new file mode 100644
index 00000000..a74f98d4
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb
@@ -0,0 +1,59 @@
+# SOAP4R - Marshalling/Unmarshalling Ruby's object using SOAP Encoding.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 "soap/mapping"
+require "soap/processor"
+
+
+module SOAP
+
+
+module Marshal
+ # Trying xsd:dateTime data to be recovered as aTime.
+ MarshalMappingRegistry = Mapping::EncodedRegistry.new(
+ :allow_original_mapping => true)
+ MarshalMappingRegistry.add(
+ Time,
+ ::SOAP::SOAPDateTime,
+ ::SOAP::Mapping::EncodedRegistry::DateTimeFactory
+ )
+
+ class << self
+ public
+ def dump(obj, io = nil)
+ marshal(obj, MarshalMappingRegistry, io)
+ end
+
+ def load(stream)
+ unmarshal(stream, MarshalMappingRegistry)
+ end
+
+ def marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil)
+ elename = Mapping.name2elename(obj.class.to_s)
+ soap_obj = Mapping.obj2soap(obj, mapping_registry)
+ body = SOAPBody.new
+ body.add(elename, soap_obj)
+ env = SOAPEnvelope.new(nil, body)
+ SOAP::Processor.marshal(env, {}, io)
+ end
+
+ def unmarshal(stream, mapping_registry = MarshalMappingRegistry)
+ env = SOAP::Processor.unmarshal(stream)
+ if env.nil?
+ raise ArgumentError.new("Illegal SOAP marshal format.")
+ end
+ Mapping.soap2obj(env.body.root_node, mapping_registry)
+ end
+ end
+end
+
+
+end
+
+
+SOAPMarshal = SOAP::Marshal
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb
new file mode 100644
index 00000000..f3f26c9b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb
@@ -0,0 +1,241 @@
+# SOAP4R - MIME Message implementation.
+# Copyright (C) 2002 Jamie Herre.
+
+# 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 'soap/attachment'
+
+
+module SOAP
+
+
+# Classes for MIME message handling. Should be put somewhere else!
+# Tried using the 'tmail' module but found that I needed something
+# lighter in weight.
+
+
+class MIMEMessage
+ class MIMEMessageError < StandardError; end
+
+ MultipartContentType = 'multipart/\w+'
+
+ class Header
+ attr_accessor :str, :key, :root
+
+ def initialize
+ @attrs = {}
+ end
+
+ def [](key)
+ @attrs[key]
+ end
+
+ def []=(key, value)
+ @attrs[key] = value
+ end
+
+ def to_s
+ @key + ": " + @str
+ end
+ end
+
+ class Headers < Hash
+ def self.parse(str)
+ new.parse(str)
+ end
+
+ def parse(str)
+ header_cache = nil
+ str.each do |line|
+ case line
+ when /^\A[^\: \t]+:\s*.+$/
+ parse_line(header_cache) if header_cache
+ header_cache = line.sub(/\r?\n\z/, '')
+ when /^\A\s+(.*)$/
+ # a continuous line at the beginning line crashes here.
+ header_cache << line
+ else
+ raise RuntimeError.new("unexpected header: #{line.inspect}")
+ end
+ end
+ parse_line(header_cache) if header_cache
+ self
+ end
+
+ def parse_line(line)
+ if /^\A([^\: \t]+):\s*(.+)\z/ =~ line
+ header = parse_rhs($2.strip)
+ header.key = $1.strip
+ self[header.key.downcase] = header
+ else
+ raise RuntimeError.new("unexpected header line: #{line.inspect}")
+ end
+ end
+
+ def parse_rhs(str)
+ a = str.split(/;+\s+/)
+ header = Header.new
+ header.str = str
+ header.root = a.shift
+ a.each do |pair|
+ if pair =~ /(\w+)\s*=\s*"?([^"]+)"?/
+ header[$1.downcase] = $2
+ else
+ raise RuntimeError.new("unexpected header component: #{pair.inspect}")
+ end
+ end
+ header
+ end
+
+ def add(key, value)
+ if key != nil and value != nil
+ header = parse_rhs(value)
+ header.key = key
+ self[key.downcase] = header
+ end
+ end
+
+ def to_s
+ self.values.collect { |hdr|
+ hdr.to_s
+ }.join("\r\n")
+ end
+ end
+
+ class Part
+ attr_accessor :headers, :body
+
+ def initialize
+ @headers = Headers.new
+ @headers.add("Content-Transfer-Encoding", "8bit")
+ @body = nil
+ @contentid = nil
+ end
+
+ def self.parse(str)
+ new.parse(str)
+ end
+
+ def parse(str)
+ headers, body = str.split(/\r\n\r\n/, 2)
+ if headers != nil and body != nil
+ @headers = Headers.parse(headers)
+ @body = body.sub(/\r\n\z/, '')
+ else
+ raise RuntimeError.new("unexpected part: #{str.inspect}")
+ end
+ self
+ end
+
+ def contentid
+ if @contentid == nil and @headers.key?('content-id')
+ @contentid = @headers['content-id'].str
+ @contentid = $1 if @contentid =~ /^<(.+)>$/
+ end
+ @contentid
+ end
+
+ alias content body
+
+ def to_s
+ @headers.to_s + "\r\n\r\n" + @body
+ end
+ end
+
+ def initialize
+ @parts = []
+ @headers = Headers.new
+ @root = nil
+ @boundary = nil
+ end
+
+ def self.parse(head, str)
+ new.parse(head, str)
+ end
+
+ attr_reader :parts, :headers
+
+ def close
+ @headers.add(
+ "Content-Type",
+ "multipart/related; type=\"text/xml\"; boundary=\"#{boundary}\"; start=\"#{@parts[0].contentid}\""
+ )
+ end
+
+ def parse(head, str)
+ @headers = Headers.parse(head + "\r\n" + "From: jfh\r\n")
+ boundary = @headers['content-type']['boundary']
+ if boundary != nil
+ parts = str.split(/--#{Regexp.quote(boundary)}\s*(?:\r\n|--\r\n)/)
+ part = parts.shift # preamble must be ignored.
+ @parts = parts.collect { |part| Part.parse(part) }
+ else
+ @parts = [Part.parse(str)]
+ end
+ if @parts.length < 1
+ raise MIMEMessageError.new("This message contains no valid parts!")
+ end
+ self
+ end
+
+ def root
+ if @root == nil
+ start = @headers['content-type']['start']
+ @root = (start && @parts.find { |prt| prt.contentid == start }) ||
+ @parts[0]
+ end
+ @root
+ end
+
+ def boundary
+ if @boundary == nil
+ @boundary = "----=Part_" + __id__.to_s + rand.to_s
+ end
+ @boundary
+ end
+
+ def add_part(content)
+ part = Part.new
+ part.headers.add("Content-Type",
+ "text/xml; charset=" + XSD::Charset.xml_encoding_label)
+ part.headers.add("Content-ID", Attachment.contentid(part))
+ part.body = content
+ @parts.unshift(part)
+ end
+
+ def add_attachment(attach)
+ part = Part.new
+ part.headers.add("Content-Type", attach.contenttype)
+ part.headers.add("Content-ID", attach.mime_contentid)
+ part.body = attach.content
+ @parts.unshift(part)
+ end
+
+ def has_parts?
+ (@parts.length > 0)
+ end
+
+ def headers_str
+ @headers.to_s
+ end
+
+ def content_str
+ str = ''
+ @parts.each do |prt|
+ str << "--" + boundary + "\r\n"
+ str << prt.to_s + "\r\n"
+ end
+ str << '--' + boundary + "--\r\n"
+ str
+ end
+
+ def to_s
+ str = headers_str + "\r\n\r\n" + conent_str
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb b/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb
new file mode 100644
index 00000000..a36c3dd1
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb
@@ -0,0 +1,42 @@
+# SOAP4R - Nested exception implementation
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+
+
+module NestedException
+ attr_reader :cause
+ attr_reader :original_backtraace
+
+ def initialize(msg = nil, cause = nil)
+ super(msg)
+ @cause = cause
+ @original_backtrace = nil
+ end
+
+ def set_backtrace(backtrace)
+ if @cause and @cause.respond_to?(:backtrace)
+ @original_backtrace = backtrace
+=begin
+ # for agressive backtrace abstraction: 'here' only should not be good
+ here = @original_backtrace[0]
+ backtrace = Array[*@cause.backtrace]
+ backtrace[0] = "#{backtrace[0]}: #{@cause} (#{@cause.class})"
+ backtrace.unshift(here)
+=end
+ # just join the nested backtrace at the tail of backtrace
+ caused = Array[*@cause.backtrace]
+ caused[0] = "#{caused[0]}: #{@cause} (#{@cause.class}) [NESTED]"
+ backtrace += caused
+ end
+ super(backtrace)
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb b/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb
new file mode 100644
index 00000000..acaaf2b1
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb
@@ -0,0 +1,241 @@
+# SOAP4R - net/http wrapper
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'net/http'
+require 'soap/filter/filterchain'
+
+
+module SOAP
+
+
+class NetHttpClient
+
+ SSLEnabled = begin
+ require 'net/https'
+ true
+ rescue LoadError
+ false
+ end
+
+ attr_reader :proxy
+ attr_accessor :no_proxy
+ attr_accessor :debug_dev
+ attr_accessor :ssl_config # ignored for now.
+ attr_accessor :protocol_version # ignored for now.
+ attr_accessor :connect_timeout
+ attr_accessor :send_timeout # ignored for now.
+ attr_accessor :receive_timeout
+ attr_reader :test_loopback_response
+ attr_reader :request_filter # ignored for now.
+
+ def initialize(proxy = nil, agent = nil)
+ @proxy = proxy ? URI.parse(proxy) : nil
+ @agent = agent
+ @debug_dev = nil
+ @test_loopback_response = []
+ @request_filter = Filter::FilterChain.new
+ @session_manager = SessionManager.new
+ @no_proxy = @ssl_config = @protocol_version = nil
+ @connect_timeout = @send_timeout = @receive_timeout = nil
+ end
+
+ def proxy=(proxy)
+ if proxy.nil?
+ @proxy = nil
+ else
+ if proxy.is_a?(URI)
+ @proxy = proxy
+ else
+ @proxy = URI.parse(proxy)
+ end
+ if @proxy.scheme == nil or @proxy.scheme.downcase != 'http' or
+ @proxy.host == nil or @proxy.port == nil
+ raise ArgumentError.new("unsupported proxy `#{proxy}'")
+ end
+ end
+ reset_all
+ @proxy
+ end
+
+ def set_auth(uri, user_id, passwd)
+ raise NotImplementedError.new("auth is not supported under soap4r + net/http.")
+ end
+
+ def set_basic_auth(uri, user_id, passwd)
+ # net/http does not handle url.
+ @basic_auth = [user_id, passwd]
+ raise NotImplementedError.new("basic_auth is not supported under soap4r + net/http.")
+ end
+
+ def set_cookie_store(filename)
+ raise NotImplementedError.new
+ end
+
+ def save_cookie_store(filename)
+ raise NotImplementedError.new
+ end
+
+ def reset(url)
+ # no persistent connection. ignored.
+ end
+
+ def reset_all
+ # no persistent connection. ignored.
+ end
+
+ def post(url, req_body, header = {})
+ post_redirect(url, req_body, header, 10)
+ end
+
+ def get_content(url, header = {})
+ if str = @test_loopback_response.shift
+ return str
+ end
+ unless url.is_a?(URI)
+ url = URI.parse(url)
+ end
+ extra = header.dup
+ extra['User-Agent'] = @agent if @agent
+ res = start(url) { |http|
+ http.get(url.request_uri, extra)
+ }
+ res.body
+ end
+
+private
+
+ def post_redirect(url, req_body, header, redirect_count)
+ if str = @test_loopback_response.shift
+ if @debug_dev
+ @debug_dev << "= Request\n\n"
+ @debug_dev << req_body
+ @debug_dev << "\n\n= Response\n\n"
+ @debug_dev << str
+ end
+ status = 200
+ reason = nil
+ contenttype = 'text/xml'
+ content = str
+ return Response.new(status, reason, contenttype, content)
+ return str
+ end
+ unless url.is_a?(URI)
+ url = URI.parse(url)
+ end
+ extra = header.dup
+ extra['User-Agent'] = @agent if @agent
+ res = start(url) { |http|
+ if @debug_dev
+ @debug_dev << "= Request\n\n"
+ @debug_dev << req_body << "\n"
+ end
+ http.post(url.request_uri, req_body, extra)
+ }
+ case res
+ when Net::HTTPRedirection
+ if redirect_count > 0
+ post_redirect(res['location'], req_body, header,
+ redirect_count - 1)
+ else
+ raise ArgumentError.new("Too many redirects")
+ end
+ else
+ Response.from_httpresponse(res)
+ end
+ end
+
+ def start(url)
+ http = create_connection(url)
+ response = nil
+ http.start { |worker|
+ response = yield(worker)
+ worker.finish
+ }
+ if @debug_dev
+ @debug_dev << "\n\n= Response\n\n"
+ @debug_dev << response.body << "\n"
+ end
+ response
+ end
+
+ def create_connection(url)
+ proxy_host = proxy_port = nil
+ unless no_proxy?(url)
+ proxy_host = @proxy.host
+ proxy_port = @proxy.port
+ end
+ http = Net::HTTP::Proxy(proxy_host, proxy_port).new(url.host, url.port)
+ if http.respond_to?(:set_debug_output)
+ http.set_debug_output(@debug_dev)
+ end
+ http.open_timeout = @connect_timeout if @connect_timeout
+ http.read_timeout = @receive_timeout if @receive_timeout
+ case url
+ when URI::HTTPS then
+ if SSLEnabled
+ http.use_ssl = true
+ else
+ raise RuntimeError.new("Cannot connect to #{url} (OpenSSL is not installed.)")
+ end
+ when URI::HTTP then
+ # OK
+ else
+ raise RuntimeError.new("Cannot connect to #{url} (Not HTTP.)")
+ end
+ http
+ end
+
+ NO_PROXY_HOSTS = ['localhost']
+
+ def no_proxy?(uri)
+ if !@proxy or NO_PROXY_HOSTS.include?(uri.host)
+ return true
+ end
+ unless @no_proxy
+ return false
+ end
+ @no_proxy.scan(/([^:,]+)(?::(\d+))?/) do |host, port|
+ if /(\A|\.)#{Regexp.quote(host)}\z/i =~ uri.host &&
+ (!port || uri.port == port.to_i)
+ return true
+ end
+ end
+ false
+ end
+
+ class SessionManager
+ attr_accessor :connect_timeout
+ attr_accessor :send_timeout
+ attr_accessor :receive_timeout
+ end
+
+ class Response
+ attr_reader :status
+ attr_reader :reason
+ attr_reader :contenttype
+ attr_reader :content
+
+ def initialize(status, reason, contenttype, content)
+ @status = status
+ @reason = reason
+ @contenttype = contenttype
+ @content = content
+ end
+
+ def self.from_httpresponse(res)
+ status = res.code.to_i
+ reason = res.message
+ contenttype = res['content-type']
+ content = res.body
+ new(status, reason, contenttype, content)
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb b/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb
new file mode 100644
index 00000000..74321a87
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb
@@ -0,0 +1,34 @@
+# SOAP4R - SOAP Namespace library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+require 'xsd/ns'
+require 'soap/soap'
+
+
+module SOAP
+
+
+class NS < XSD::NS
+ KNOWN_TAG = XSD::NS::KNOWN_TAG.dup.update(
+ SOAP::EnvelopeNamespace => 'env'
+ )
+
+ def initialize(tag2ns = nil)
+ super(tag2ns)
+ end
+
+private
+
+ def default_known_tag
+ KNOWN_TAG
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb b/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb
new file mode 100644
index 00000000..bdd28fdc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb
@@ -0,0 +1,252 @@
+# SOAP4R - SOAP XML Instance Parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser'
+require 'soap/soap'
+require 'soap/ns'
+require 'soap/baseData'
+require 'soap/encodingstyle/handler'
+
+
+module SOAP
+
+
+class Parser
+ include SOAP
+
+ class ParseError < Error; end
+ class FormatDecodeError < ParseError; end
+ class UnexpectedElementError < ParseError; end
+
+private
+
+ class ParseFrame
+ attr_reader :node
+ attr_reader :name
+ attr_reader :ns
+ attr_reader :encodingstyle
+ attr_reader :handler
+
+ class NodeContainer
+ def initialize(node)
+ @node = node
+ end
+
+ def node
+ @node
+ end
+
+ def replace_node(node)
+ @node = node
+ end
+ end
+
+ public
+
+ def initialize(ns, name, node, encodingstyle, handler)
+ @ns = ns
+ @name = name
+ @node = NodeContainer.new(node)
+ @encodingstyle = encodingstyle
+ @handler = handler
+ end
+
+ # to avoid memory consumption
+ def update(ns, name, node, encodingstyle, handler)
+ @ns = ns
+ @name = name
+ @node.replace_node(node)
+ @encodingstyle = encodingstyle
+ @handler = handler
+ self
+ end
+ end
+
+public
+
+ attr_accessor :envelopenamespace
+ attr_accessor :default_encodingstyle
+ attr_accessor :decode_typemap
+ attr_accessor :allow_unqualified_element
+
+ def initialize(opt = {})
+ @opt = opt
+ @parser = XSD::XMLParser.create_parser(self, opt)
+ @parsestack = nil
+ @recycleframe = nil
+ @lastnode = nil
+ @handlers = {}
+ @envelopenamespace = opt[:envelopenamespace] || EnvelopeNamespace
+ @default_encodingstyle = opt[:default_encodingstyle] || EncodingNamespace
+ @decode_typemap = opt[:decode_typemap] || nil
+ @allow_unqualified_element = opt[:allow_unqualified_element] || false
+ end
+
+ def charset
+ @parser.charset
+ end
+
+ def parse(string_or_readable)
+ @parsestack = []
+ @lastnode = nil
+
+ @handlers.each do |uri, handler|
+ handler.decode_prologue
+ end
+
+ @parser.do_parse(string_or_readable)
+
+ unless @parsestack.empty?
+ raise FormatDecodeError.new("Unbalanced tag in XML.")
+ end
+
+ @handlers.each do |uri, handler|
+ handler.decode_epilogue
+ end
+
+ @lastnode
+ end
+
+ def start_element(name, raw_attrs)
+ lastframe = @parsestack.last
+ ns = parent = parent_encodingstyle = nil
+ if lastframe
+ ns = lastframe.ns
+ parent = lastframe.node
+ parent_encodingstyle = lastframe.encodingstyle
+ else
+ ns = SOAP::NS.new
+ parent = ParseFrame::NodeContainer.new(nil)
+ parent_encodingstyle = nil
+ end
+ # ns might be the same
+ ns, raw_attrs = XSD::XMLParser.filter_ns(ns, raw_attrs)
+ attrs = decode_attrs(ns, raw_attrs)
+ encodingstyle = attrs[AttrEncodingStyleName]
+ # Children's encodingstyle is derived from its parent.
+ if encodingstyle.nil?
+ if parent.node.is_a?(SOAPHeader)
+ encodingstyle = LiteralNamespace
+ else
+ encodingstyle = parent_encodingstyle || @default_encodingstyle
+ end
+ end
+ handler = find_handler(encodingstyle)
+ unless handler
+ raise FormatDecodeError.new("Unknown encodingStyle: #{ encodingstyle }.")
+ end
+ node = decode_tag(ns, name, attrs, parent, handler)
+ if @recycleframe
+ @parsestack << @recycleframe.update(ns, name, node, encodingstyle, handler)
+ @recycleframe = nil
+ else
+ @parsestack << ParseFrame.new(ns, name, node, encodingstyle, handler)
+ end
+ end
+
+ def characters(text)
+ # Ignore Text outside of SOAP Envelope.
+ if lastframe = @parsestack.last
+ # Need not to be cloned because character does not have attr.
+ decode_text(lastframe.ns, text, lastframe.handler)
+ end
+ end
+
+ def end_element(name)
+ lastframe = @parsestack.pop
+ unless name == lastframe.name
+ raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.")
+ end
+ decode_tag_end(lastframe.ns, lastframe.node, lastframe.handler)
+ @lastnode = lastframe.node.node
+ @recycleframe = lastframe
+ end
+
+private
+
+ def decode_tag(ns, name, attrs, parent, handler)
+ ele = ns.parse(name)
+ # Envelope based parsing.
+ if ((ele.namespace == @envelopenamespace) ||
+ (@allow_unqualified_element && ele.namespace.nil?))
+ o = decode_soap_envelope(ns, ele, attrs, parent)
+ return o if o
+ end
+ # Encoding based parsing.
+ return handler.decode_tag(ns, ele, attrs, parent)
+ end
+
+ def decode_tag_end(ns, node, handler)
+ return handler.decode_tag_end(ns, node)
+ end
+
+ def decode_attrs(ns, attrs)
+ extraattr = {}
+ attrs.each do |key, value|
+ qname = ns.parse_local(key)
+ extraattr[qname] = value
+ end
+ extraattr
+ end
+
+ def decode_text(ns, text, handler)
+ handler.decode_text(ns, text)
+ end
+
+ def decode_soap_envelope(ns, ele, attrs, parent)
+ o = nil
+ if ele.name == EleEnvelope
+ o = SOAPEnvelope.new
+ if ext = @opt[:external_content]
+ ext.each do |k, v|
+ o.external_content[k] = v
+ end
+ end
+ elsif ele.name == EleHeader
+ return nil unless parent.node.is_a?(SOAPEnvelope)
+ o = SOAPHeader.new
+ parent.node.header = o
+ elsif ele.name == EleBody
+ return nil unless parent.node.is_a?(SOAPEnvelope)
+ o = SOAPBody.new
+ parent.node.body = o
+ elsif ele.name == EleFault
+ if parent.node.is_a?(SOAPBody)
+ o = SOAPFault.new
+ parent.node.fault = o
+ elsif parent.node.is_a?(SOAPEnvelope)
+ # live.com server returns SOAPFault as a direct child of SOAPEnvelope.
+ # support it even if it's not spec compliant.
+ warn("Fault must be a child of Body.")
+ body = SOAPBody.new
+ parent.node.body = body
+ o = SOAPFault.new
+ body.fault = o
+ else
+ return nil
+ end
+ end
+ o.extraattr.update(attrs) if o
+ o
+ end
+
+ def find_handler(encodingstyle)
+ unless @handlers.key?(encodingstyle)
+ handler_factory = SOAP::EncodingStyle::Handler.handler(encodingstyle) ||
+ SOAP::EncodingStyle::Handler.handler(EncodingNamespace)
+ handler = handler_factory.new(@parser.charset)
+ handler.decode_typemap = @decode_typemap
+ handler.decode_prologue
+ @handlers[encodingstyle] = handler
+ end
+ @handlers[encodingstyle]
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb b/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb
new file mode 100644
index 00000000..c78fc5d8
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb
@@ -0,0 +1,66 @@
+# SOAP4R - marshal/unmarshal interface.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+require 'soap/soap'
+require 'soap/element'
+require 'soap/parser'
+require 'soap/generator'
+require 'soap/encodingstyle/soapHandler'
+require 'soap/encodingstyle/literalHandler'
+require 'soap/encodingstyle/aspDotNetHandler'
+
+
+module SOAP
+
+
+module Processor
+ @@default_parser_option = {}
+
+ class << self
+ public
+
+ def marshal(env, opt = {}, io = nil)
+ generator = create_generator(opt)
+ marshalled_str = generator.generate(env, io)
+ unless env.external_content.empty?
+ opt[:external_content] = env.external_content
+ end
+ marshalled_str
+ end
+
+ def unmarshal(stream, opt = {})
+ parser = create_parser(opt)
+ parser.parse(stream)
+ end
+
+ def default_parser_option=(rhs)
+ @@default_parser_option = rhs
+ end
+
+ def default_parser_option
+ @@default_parser_option
+ end
+
+ private
+
+ def create_generator(opt)
+ Generator.new(opt)
+ end
+
+ def create_parser(opt)
+ if opt.empty?
+ opt = @@default_parser_option
+ end
+ ::SOAP::Parser.new(opt)
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/property.rb b/vendor/gems/soap4r-1.5.8/lib/soap/property.rb
new file mode 100644
index 00000000..7008a224
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/property.rb
@@ -0,0 +1,333 @@
+# soap/property.rb: SOAP4R - Property implementation.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+
+
+# Property stream format:
+#
+# line separator is \r?\n. 1 line per a property.
+# line which begins with '#' is a comment line. empty line is ignored, too.
+# key/value separator is ':' or '='.
+# '\' as escape character. but line separator cannot be escaped.
+# \s at the head/tail of key/value are trimmed.
+#
+# '[' + key + ']' indicates property section. for example,
+#
+# [aaa.bbb]
+# ccc = ddd
+# eee.fff = ggg
+# []
+# aaa.hhh = iii
+#
+# is the same as;
+#
+# aaa.bbb.ccc = ddd
+# aaa.bbb.eee.fff = ggg
+# aaa.hhh = iii
+#
+class Property
+ FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
+
+ include Enumerable
+
+ module Util
+ def const_from_name(fqname)
+ fqname.split("::").inject(Kernel) { |klass, name| klass.const_get(name) }
+ end
+ module_function :const_from_name
+
+ def require_from_name(fqname)
+ require File.join(fqname.split("::").collect { |ele| ele.downcase })
+ end
+ module_function :require_from_name
+ end
+
+ def self.load(stream)
+ new.load(stream)
+ end
+
+ def self.loadproperty(propname)
+ new.loadproperty(propname)
+ end
+
+ def initialize
+ @store = Hash.new
+ @hook = Hash.new
+ @self_hook = Array.new
+ @locked = false
+ end
+
+ KEY_REGSRC = '([^=:\\\\]*(?:\\\\.[^=:\\\\]*)*)'
+ DEF_REGSRC = '\\s*' + KEY_REGSRC + '\\s*[=:]\\s*(.*)'
+ COMMENT_REGEXP = Regexp.new("^(?:#.*|)$")
+ CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$")
+ LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$")
+ def load(stream)
+ key_prefix = ""
+ stream.readlines.each_with_index do |line, lineno|
+ line.sub!(/\r?\n\z/u, '')
+ case line
+ when COMMENT_REGEXP
+ next
+ when CATDEF_REGEXP
+ key_prefix = $1.strip
+ when LINE_REGEXP
+ key, value = $1.strip, $2.strip
+ key = "#{key_prefix}.#{key}" unless key_prefix.empty?
+ key, value = loadstr(key), loadstr(value)
+ self[key] = value
+ else
+ raise TypeError.new(
+ "property format error at line #{lineno + 1}: `#{line}'")
+ end
+ end
+ self
+ end
+
+ # find property from $:.
+ def loadproperty(propname)
+ return loadpropertyfile(propname) if File.file?(propname)
+ $:.each do |path|
+ if File.file?(file = File.join(path, propname))
+ return loadpropertyfile(file)
+ end
+ end
+ nil
+ end
+
+ # name: a Symbol, String or an Array
+ def [](name)
+ referent(name_to_a(name))
+ end
+
+ # name: a Symbol, String or an Array
+ # value: an Object
+ def []=(name, value)
+ name_pair = name_to_a(name).freeze
+ hooks = assign(name_pair, value)
+ hooks.each do |hook|
+ hook.call(name_pair, value)
+ end
+ value
+ end
+
+ # value: an Object
+ # key is generated by property
+ def <<(value)
+ self[generate_new_key] = value
+ end
+
+ # name: a Symbol, String or an Array; nil means hook to the root
+ # cascade: true/false; for cascading hook of sub key
+ # hook: block which will be called with 2 args, name and value
+ def add_hook(name = nil, cascade = false, &hook)
+ if name == nil or name == true or name == false
+ cascade = name
+ assign_self_hook(cascade, &hook)
+ else
+ assign_hook(name_to_a(name), cascade, &hook)
+ end
+ end
+
+ def each
+ @store.each do |key, value|
+ yield(key, value)
+ end
+ end
+
+ def empty?
+ @store.empty?
+ end
+
+ def keys
+ @store.keys
+ end
+
+ def values
+ @store.values
+ end
+
+ def lock(cascade = false)
+ if cascade
+ each_key do |key|
+ key.lock(cascade)
+ end
+ end
+ @locked = true
+ self
+ end
+
+ def unlock(cascade = false)
+ @locked = false
+ if cascade
+ each_key do |key|
+ key.unlock(cascade)
+ end
+ end
+ self
+ end
+
+ def locked?
+ @locked
+ end
+
+protected
+
+ def deref_key(key)
+ check_lock(key)
+ ref = @store[key] ||= self.class.new
+ unless propkey?(ref)
+ raise ArgumentError.new("key `#{key}' already defined as a value")
+ end
+ ref
+ end
+
+ def local_referent(key)
+ check_lock(key)
+ if propkey?(@store[key]) and @store[key].locked?
+ raise FrozenError.new("cannot split any key from locked property")
+ end
+ @store[key]
+ end
+
+ def local_assign(key, value)
+ check_lock(key)
+ if @locked
+ if propkey?(value)
+ raise FrozenError.new("cannot add any key to locked property")
+ elsif propkey?(@store[key])
+ raise FrozenError.new("cannot override any key in locked property")
+ end
+ end
+ @store[key] = value
+ end
+
+ def local_hook(key, direct)
+ hooks = []
+ (@self_hook + (@hook[key] || NO_HOOK)).each do |hook, cascade|
+ hooks << hook if direct or cascade
+ end
+ hooks
+ end
+
+ def local_assign_hook(key, cascade, &hook)
+ check_lock(key)
+ @store[key] ||= nil
+ (@hook[key] ||= []) << [hook, cascade]
+ end
+
+private
+
+ NO_HOOK = [].freeze
+
+ def referent(ary)
+ ary[0..-2].inject(self) { |ref, name|
+ ref.deref_key(to_key(name))
+ }.local_referent(to_key(ary.last))
+ end
+
+ def assign(ary, value)
+ ref = self
+ hook = NO_HOOK
+ ary[0..-2].each do |name|
+ key = to_key(name)
+ hook += ref.local_hook(key, false)
+ ref = ref.deref_key(key)
+ end
+ last_key = to_key(ary.last)
+ ref.local_assign(last_key, value)
+ hook + ref.local_hook(last_key, true)
+ end
+
+ def assign_hook(ary, cascade, &hook)
+ ary[0..-2].inject(self) { |ref, name|
+ ref.deref_key(to_key(name))
+ }.local_assign_hook(to_key(ary.last), cascade, &hook)
+ end
+
+ def assign_self_hook(cascade, &hook)
+ check_lock(nil)
+ @self_hook << [hook, cascade]
+ end
+
+ def each_key
+ self.each do |key, value|
+ if propkey?(value)
+ yield(value)
+ end
+ end
+ end
+
+ def check_lock(key)
+ if @locked and (key.nil? or !@store.key?(key))
+ raise FrozenError.new("cannot add any key to locked property")
+ end
+ end
+
+ def propkey?(value)
+ value.is_a?(::SOAP::Property)
+ end
+
+ def name_to_a(name)
+ case name
+ when Symbol
+ [name]
+ when String
+ name.scan(/[^.\\]+(?:\\.[^.\\])*/u) # split with unescaped '.'
+ when Array
+ name
+ else
+ raise ArgumentError.new("Unknown name #{name}(#{name.class})")
+ end
+ end
+
+ def to_key(name)
+ name.to_s.downcase
+ end
+
+ def generate_new_key
+ if @store.empty?
+ "0"
+ else
+ (key_max + 1).to_s
+ end
+ end
+
+ def key_max
+ (@store.keys.max { |l, r| l.to_s.to_i <=> r.to_s.to_i }).to_s.to_i
+ end
+
+ def loadpropertyfile(file)
+ puts "find property at #{file}" if $DEBUG
+ File.open(file) do |f|
+ load(f)
+ end
+ end
+
+ def loadstr(str)
+ str.gsub(/\\./u) { |c| eval("\"#{c}\"") }
+ end
+end
+
+
+end
+
+
+# for ruby/1.6.
+unless Enumerable.method_defined?(:inject)
+ module Enumerable
+ def inject(init)
+ result = init
+ each do |item|
+ result = yield(result, item)
+ end
+ result
+ end
+ end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb b/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb
new file mode 100644
index 00000000..35ac400c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb
@@ -0,0 +1,14 @@
+# SOAP4R - Proxy library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/rpc/proxy'
+
+
+module SOAP
+ SOAPProxy = RPC::Proxy
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb
new file mode 100644
index 00000000..233f59f6
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb
@@ -0,0 +1,247 @@
+# SOAP4R - CGI/mod_ruby stub library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/streamHandler'
+require 'webrick/httpresponse'
+require 'webrick/httpstatus'
+require 'logger'
+require 'soap/rpc/soaplet'
+
+
+module SOAP
+module RPC
+
+
+###
+# SYNOPSIS
+# CGIStub.new
+#
+# DESCRIPTION
+# To be written...
+#
+class CGIStub < Logger::Application
+ include SOAP
+ include WEBrick
+
+ class SOAPRequest
+ attr_reader :body
+
+ def [](var); end
+
+ def meta_vars; end
+
+ EMPTY_COOKIES = [].freeze
+ def cookies; EMPTY_COOKIES; end
+
+ def user; end
+ end
+
+ class SOAPStdinRequest < SOAPRequest
+ attr_reader :body
+
+ def initialize(stream)
+ size = ENV['CONTENT_LENGTH'].to_i || 0
+ @body = stream.read(size)
+ end
+
+ def [](var)
+ ENV[var.gsub(/-/, '_').upcase]
+ end
+
+ def meta_vars
+ {
+ 'HTTP_SOAPACTION' => ENV['HTTP_SOAPAction']
+ }
+ end
+
+ def cookies
+ if cookie = ENV['HTTP_Cookie'] || ENV['Cookie']
+ [WEBrick::Cookie.parse(cookie)]
+ else
+ EMPTY_COOKIES
+ end
+ end
+
+ def user
+ ENV['REMOTE_USER']
+ end
+ end
+
+ class SOAPFCGIRequest < SOAPRequest
+ attr_reader :body
+
+ def initialize(request)
+ @request = request
+ @body = @request.in.read
+ end
+
+ def [](var)
+ @request.env[var.gsub(/-/, '_').upcase]
+ end
+
+ def meta_vars
+ {
+ 'HTTP_SOAPACTION' => @request.env['HTTP_SOAPAction']
+ }
+ end
+
+ def cookies
+ if cookie = @request.env['HTTP_Cookie'] || @request.env['Cookie']
+ [WEBrick::Cookie.parse(cookie)]
+ else
+ EMPTY_COOKIES
+ end
+ end
+
+ def user
+ @request.env['REMOTE_USER']
+ end
+ end
+
+ def initialize(appname, default_namespace)
+ super(appname)
+ set_log(STDERR)
+ self.level = ERROR
+ @default_namespace = default_namespace
+ @remote_host = ENV['REMOTE_HOST'] || ENV['REMOTE_ADDR'] || 'unknown'
+ @router = ::SOAP::RPC::Router.new(self.class.name)
+ @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
+ on_init
+ end
+
+ def on_init
+ # do extra initialization in a derived class if needed.
+ end
+
+ def mapping_registry
+ @router.mapping_registry
+ end
+
+ def mapping_registry=(mapping_registry)
+ @router.mapping_registry = mapping_registry
+ end
+
+ def literal_mapping_registry
+ @router.literal_mapping_registry
+ end
+
+ def literal_mapping_registry=(literal_mapping_registry)
+ @router.literal_mapping_registry = literal_mapping_registry
+ end
+
+ def generate_explicit_type
+ @router.generate_explicit_type
+ end
+
+ def generate_explicit_type=(generate_explicit_type)
+ @router.generate_explicit_type = generate_explicit_type
+ end
+
+ # servant entry interface
+
+ def add_rpc_servant(obj, namespace = @default_namespace)
+ @router.add_rpc_servant(obj, namespace)
+ end
+ alias add_servant add_rpc_servant
+
+ def add_headerhandler(obj)
+ @router.add_headerhandler(obj)
+ end
+ alias add_rpc_headerhandler add_headerhandler
+
+ def filterchain
+ @router.filterchain
+ end
+
+ # method entry interface
+
+ def add_rpc_method(obj, name, *param)
+ add_rpc_method_with_namespace_as(@default_namespace, obj, name, name, *param)
+ end
+ alias add_method add_rpc_method
+
+ def add_rpc_method_as(obj, name, name_as, *param)
+ add_rpc_method_with_namespace_as(@default_namespace, obj, name, name_as, *param)
+ end
+ alias add_method_as add_rpc_method_as
+
+ def add_rpc_method_with_namespace(namespace, obj, name, *param)
+ add_rpc_method_with_namespace_as(namespace, obj, name, name, *param)
+ end
+ alias add_method_with_namespace add_rpc_method_with_namespace
+
+ def add_rpc_method_with_namespace_as(namespace, obj, name, name_as, *param)
+ qname = XSD::QName.new(namespace, name_as)
+ soapaction = nil
+ param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
+ end
+ alias add_method_with_namespace_as add_rpc_method_with_namespace_as
+
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
+ end
+
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ @router.add_document_operation(receiver, soapaction, name, param_def, opt)
+ end
+
+ def set_fcgi_request(request)
+ @fcgi = request
+ end
+
+private
+
+ HTTPVersion = WEBrick::HTTPVersion.new('1.0') # dummy; ignored
+
+ def run
+ res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion})
+ begin
+ @log.info { "received a request from '#{ @remote_host }'" }
+ if @fcgi
+ req = SOAPFCGIRequest.new(@fcgi)
+ else
+ req = SOAPStdinRequest.new($stdin)
+ end
+ @soaplet.do_POST(req, res)
+ rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
+ res.set_error(ex)
+ rescue HTTPStatus::Error => ex
+ res.set_error(ex)
+ rescue HTTPStatus::Status => ex
+ res.status = ex.code
+ rescue StandardError, NameError => ex # for Ruby 1.6
+ res.set_error(ex, true)
+ ensure
+ if defined?(MOD_RUBY)
+ r = Apache.request
+ r.status = res.status
+ r.content_type = res.content_type
+ r.send_http_header
+ buf = res.body
+ else
+ buf = ''
+ res.send_response(buf)
+ buf.sub!(/^[^\r]+\r\n/, '') # Trim status line.
+ end
+ @log.debug { "SOAP CGI Response:\n#{ buf }" }
+ if @fcgi
+ @fcgi.out.print buf
+ @fcgi.finish
+ @fcgi = nil
+ else
+ print buf
+ end
+ end
+ 0
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb
new file mode 100644
index 00000000..30c595c0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb
@@ -0,0 +1,221 @@
+# SOAP4R - SOAP RPC driver
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/attrproxy'
+require 'soap/mapping'
+require 'soap/rpc/rpc'
+require 'soap/rpc/proxy'
+require 'soap/rpc/element'
+require 'soap/streamHandler'
+require 'soap/property'
+require 'soap/header/handlerset'
+
+
+module SOAP
+module RPC
+
+
+class Driver
+ include AttrProxy
+
+ attr_proxy :endpoint_url, true
+ attr_proxy :mapping_registry, true
+ attr_proxy :literal_mapping_registry, true
+ attr_proxy :allow_unqualified_element, true
+ attr_proxy :default_encodingstyle, true
+ attr_proxy :generate_explicit_type, true
+ attr_proxy :use_default_namespace, true
+ attr_proxy :return_response_as_xml, true
+ attr_proxy :headerhandler
+ attr_proxy :filterchain
+ attr_proxy :streamhandler
+ attr_proxy :test_loopback_response
+ attr_proxy :reset_stream
+
+ attr_reader :proxy
+ attr_reader :options
+ attr_accessor :soapaction
+
+ def inspect
+ "#<#{self.class}:#{@proxy.inspect}>"
+ end
+
+ def httpproxy
+ options["protocol.http.proxy"]
+ end
+
+ def httpproxy=(httpproxy)
+ options["protocol.http.proxy"] = httpproxy
+ end
+
+ def wiredump_dev
+ options["protocol.http.wiredump_dev"]
+ end
+
+ def wiredump_dev=(wiredump_dev)
+ options["protocol.http.wiredump_dev"] = wiredump_dev
+ end
+
+ def mandatorycharset
+ options["protocol.mandatorycharset"]
+ end
+
+ def mandatorycharset=(mandatorycharset)
+ options["protocol.mandatorycharset"] = mandatorycharset
+ end
+
+ def wiredump_file_base
+ options["protocol.wiredump_file_base"]
+ end
+
+ def wiredump_file_base=(wiredump_file_base)
+ options["protocol.wiredump_file_base"] = wiredump_file_base
+ end
+
+ def initialize(endpoint_url, namespace = nil, soapaction = nil)
+ @namespace = namespace
+ @soapaction = soapaction
+ @options = setup_options
+ @wiredump_file_base = nil
+ @proxy = Proxy.new(endpoint_url, @soapaction, @options)
+ end
+
+ def loadproperty(propertyname)
+ unless options.loadproperty(propertyname)
+ raise LoadError.new("No such property to load -- #{propertyname}")
+ end
+ end
+
+ def add_rpc_method(name, *params)
+ add_rpc_method_with_soapaction_as(name, name, @soapaction, *params)
+ end
+
+ def add_rpc_method_as(name, name_as, *params)
+ add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params)
+ end
+
+ def add_rpc_method_with_soapaction(name, soapaction, *params)
+ add_rpc_method_with_soapaction_as(name, name, soapaction, *params)
+ end
+
+ def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
+ param_def = SOAPMethod.create_rpc_param_def(params)
+ qname = XSD::QName.new(@namespace, name_as)
+ @proxy.add_rpc_method(qname, soapaction, name, param_def)
+ add_rpc_method_interface(name, param_def)
+ end
+
+ # add_method is for shortcut of typical rpc/encoded method definition.
+ alias add_method add_rpc_method
+ alias add_method_as add_rpc_method_as
+ alias add_method_with_soapaction add_rpc_method_with_soapaction
+ alias add_method_with_soapaction_as add_rpc_method_with_soapaction_as
+
+ def add_document_method(name, soapaction, req_qname, res_qname)
+ param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
+ @proxy.add_document_method(soapaction, name, param_def)
+ add_document_method_interface(name, param_def)
+ end
+
+ def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
+ @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt)
+ add_rpc_method_interface(name, param_def)
+ end
+
+ def add_document_operation(soapaction, name, param_def, opt = {})
+ @proxy.add_document_operation(soapaction, name, param_def, opt)
+ add_document_method_interface(name, param_def)
+ end
+
+ def invoke(headers, body)
+ if headers and !headers.is_a?(SOAPHeader)
+ headers = create_header(headers)
+ end
+ set_wiredump_file_base(body.elename.name)
+ env = @proxy.invoke(headers, body)
+ if env.nil?
+ return nil, nil
+ else
+ return env.header, env.body
+ end
+ end
+
+ def call(name, *params)
+ set_wiredump_file_base(name)
+ @proxy.call(name, *params)
+ end
+
+private
+
+ def attrproxy
+ @proxy
+ end
+
+ def set_wiredump_file_base(name)
+ if @wiredump_file_base
+ @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}")
+ end
+ end
+
+ def create_header(headers)
+ header = SOAPHeader.new()
+ headers.each do |content, mustunderstand, encodingstyle|
+ header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
+ end
+ header
+ end
+
+ def setup_options
+ if opt = Property.loadproperty(::SOAP::PropertyName)
+ opt = opt["client"]
+ end
+ opt ||= Property.new
+ opt.add_hook("protocol.mandatorycharset") do |key, value|
+ @proxy.mandatorycharset = value
+ end
+ opt.add_hook("protocol.wiredump_file_base") do |key, value|
+ @wiredump_file_base = value
+ end
+ opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label
+ opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
+ opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
+ opt
+ end
+
+ def add_rpc_method_interface(name, param_def)
+ param_count = RPC::SOAPMethod.param_count(param_def,
+ RPC::SOAPMethod::IN, RPC::SOAPMethod::INOUT)
+ add_method_interface(name, param_count)
+ end
+
+ def add_document_method_interface(name, param_def)
+ param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN)
+ add_method_interface(name, param_count)
+ end
+
+ # Mapping.define_singleton_method calls define_method with proc and it
+ # exhausts much memory for each singleton Object. just instance_eval instead
+ # of it.
+ def add_method_interface(name, param_count)
+ instance_eval <<-EOS
+ def #{name}(*arg)
+ unless arg.size == #{param_count}
+ raise ArgumentError.new(
+ "wrong number of arguments (\#{arg.size} for #{param_count})")
+ end
+ call(#{name.dump}, *arg)
+ end
+ EOS
+ self.method(name)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb
new file mode 100644
index 00000000..9c4c5a52
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb
@@ -0,0 +1,374 @@
+# SOAP4R - RPC element definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/rpc/methodDef'
+
+
+module SOAP
+
+# Add method definitions for RPC to common definition in element.rb
+class SOAPBody < SOAPStruct
+ public
+
+ def request
+ root_node
+ end
+
+ def response
+ root = root_node
+ if !@is_fault
+ if root.nil?
+ nil
+ elsif root.is_a?(SOAPBasetype)
+ root
+ else
+ # Initial element is [retval].
+ root[0]
+ end
+ else
+ root
+ end
+ end
+
+ def outparams
+ root = root_node
+ if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
+ op = root[1..-1]
+ op = nil if op && op.empty?
+ op
+ else
+ nil
+ end
+ end
+
+ def fault
+ if @is_fault
+ self['fault']
+ else
+ nil
+ end
+ end
+
+ def fault=(fault)
+ @is_fault = true
+ add('fault', fault)
+ end
+end
+
+
+module RPC
+
+
+class RPCError < Error; end
+class MethodDefinitionError < RPCError; end
+class ParameterError < RPCError; end
+
+class SOAPMethod < SOAPStruct
+ RETVAL = :retval
+ IN = :in
+ OUT = :out
+ INOUT = :inout
+
+ attr_reader :param_def
+ attr_reader :inparam
+ attr_reader :outparam
+ attr_reader :retval_name
+ attr_reader :retval_class_name
+
+ def initialize(qname, param_def = nil)
+ super(nil)
+ @elename = qname
+ @encodingstyle = nil
+
+ @param_def = param_def
+
+ @signature = []
+ @inparam_names = []
+ @inoutparam_names = []
+ @outparam_names = []
+
+ @inparam = {}
+ @outparam = {}
+ @retval_name = nil
+ @retval_class_name = nil
+
+ init_params(@param_def) if @param_def
+ end
+
+ def have_member
+ true
+ end
+
+ def have_outparam?
+ @outparam_names.size > 0
+ end
+
+ def input_params
+ collect_params(IN, INOUT)
+ end
+
+ def output_params
+ collect_params(OUT, INOUT)
+ end
+
+ def input_param_types
+ collect_param_types(IN, INOUT)
+ end
+
+ def output_param_types
+ collect_param_types(OUT, INOUT)
+ end
+
+ def set_param(params)
+ params.each do |param, data|
+ @inparam[param] = data
+ data.elename = XSD::QName.new(data.elename.namespace, param)
+ data.parent = self
+ end
+ end
+
+ def set_outparam(params)
+ params.each do |param, data|
+ @outparam[param] = data
+ data.elename = XSD::QName.new(data.elename.namespace, param)
+ end
+ end
+
+ def get_paramtypes(names)
+ types = []
+ @signature.each do |io_type, name, type_qname|
+ if type_qname && idx = names.index(name)
+ types[idx] = type_qname
+ end
+ end
+ types
+ end
+
+ def SOAPMethod.param_count(param_def, *type)
+ count = 0
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ if type.include?(param.io_type.to_sym)
+ count += 1
+ end
+ end
+ count
+ end
+
+ def SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ if param.size == 1 and param[0].is_a?(Array)
+ return param[0]
+ end
+ if param.empty?
+ method = obj.method(name)
+ param_names = (1..method.arity.abs).collect { |i| "p#{i}" }
+ else
+ param_names = param
+ end
+ create_rpc_param_def(param_names)
+ end
+
+ def SOAPMethod.create_rpc_param_def(param_names)
+ param_def = []
+ param_names.each do |param_name|
+ param_def.push([IN, param_name, nil])
+ end
+ param_def.push([RETVAL, 'return', nil])
+ param_def
+ end
+
+ def SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
+ req_qnames = [req_qnames] if req_qnames.is_a?(XSD::QName)
+ res_qnames = [res_qnames] if res_qnames.is_a?(XSD::QName)
+ param_def = []
+ # req_qnames and res_qnames can be nil
+ if req_qnames
+ req_qnames.each do |qname|
+ param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ end
+ if res_qnames
+ res_qnames.each do |qname|
+ param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ end
+ param_def
+ end
+
+private
+
+ def collect_param_types(*type)
+ names = []
+ @signature.each do |io_type, name, type_qname|
+ names << type_qname if type.include?(io_type)
+ end
+ names
+ end
+
+ def collect_params(*type)
+ names = []
+ @signature.each do |io_type, name, type_qname|
+ names << name if type.include?(io_type)
+ end
+ names
+ end
+
+ def init_params(param_def)
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ init_param(param)
+ end
+ end
+
+ def init_param(param)
+ mapped_class = SOAPMethod.parse_mapped_class(param.mapped_class)
+ qname = param.qname
+ if qname.nil? and mapped_class
+ qname = TypeMap.key(mapped_class)
+ end
+ case param.io_type
+ when IN
+ @signature.push([IN, param.name, qname])
+ @inparam_names.push(param.name)
+ when OUT
+ @signature.push([OUT, param.name, qname])
+ @outparam_names.push(param.name)
+ when INOUT
+ @signature.push([INOUT, param.name, qname])
+ @inoutparam_names.push(param.name)
+ when RETVAL
+ if @retval_name
+ raise MethodDefinitionError.new('duplicated retval')
+ end
+ @retval_name = param.name
+ @retval_class_name = mapped_class
+ else
+ raise MethodDefinitionError.new("unknown type: #{param.io_type}")
+ end
+ end
+
+ def self.parse_mapped_class(mapped_class)
+ # the first element of typedef in param_def can be a String like
+ # "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if
+ # we can.
+ if mapped_class.is_a?(String)
+ if /\[\]\Z/ =~ mapped_class
+ # when '[]' is added, ignore this.
+ mapped_class = nil
+ else
+ mapped_class = Mapping.class_from_name(mapped_class)
+ end
+ end
+ mapped_class
+ end
+end
+
+
+class SOAPMethodRequest < SOAPMethod
+ attr_accessor :soapaction
+
+ def SOAPMethodRequest.create_request(qname, *params)
+ param_def = []
+ param_value = []
+ i = 0
+ params.each do |param|
+ param_name = "p#{i}"
+ i += 1
+ param_def << [IN, param_name, nil]
+ param_value << [param_name, param]
+ end
+ param_def << [RETVAL, 'return', nil]
+ o = new(qname, param_def)
+ o.set_param(param_value)
+ o
+ end
+
+ def initialize(qname, param_def = nil, soapaction = nil)
+ super(qname, param_def)
+ @soapaction = soapaction
+ end
+
+ def each
+ input_params.each do |name|
+ unless @inparam[name]
+ raise ParameterError.new("parameter: #{name} was not given")
+ end
+ yield(name, @inparam[name])
+ end
+ end
+
+ def dup
+ req = self.class.new(@elename.dup, @param_def, @soapaction)
+ req.encodingstyle = @encodingstyle
+ req
+ end
+
+ def create_method_response(response_name = nil)
+ response_name ||=
+ XSD::QName.new(@elename.namespace, @elename.name + 'Response')
+ SOAPMethodResponse.new(response_name, @param_def)
+ end
+end
+
+
+class SOAPMethodResponse < SOAPMethod
+
+ def initialize(qname, param_def = nil)
+ super(qname, param_def)
+ @retval = nil
+ end
+
+ def retval
+ @retval
+ end
+
+ def retval=(retval)
+ @retval = retval
+ @retval.elename = @retval.elename.dup_name(@retval_name || 'return')
+ retval.parent = self
+ retval
+ end
+
+ def each
+ if @retval_name and !@retval.is_a?(SOAPVoid)
+ yield(@retval_name, @retval)
+ end
+
+ output_params.each do |name|
+ unless @outparam[name]
+ raise ParameterError.new("parameter: #{name} was not given")
+ end
+ yield(name, @outparam[name])
+ end
+ end
+end
+
+
+# To return(?) void explicitly.
+# def foo(input_var)
+# ...
+# return SOAP::RPC::SOAPVoid.new
+# end
+class SOAPVoid < XSD::XSDAnySimpleType
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ Name = XSD::QName.new(Mapping::RubyCustomTypeNamespace, nil)
+
+public
+ def initialize()
+ @elename = Name
+ @id = nil
+ @precedents = []
+ @parent = nil
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb.orig b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb.orig
new file mode 100644
index 00000000..93b019a5
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb.orig
@@ -0,0 +1,374 @@
+# SOAP4R - RPC element definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/baseData'
+require 'soap/rpc/methodDef'
+
+
+module SOAP
+
+# Add method definitions for RPC to common definition in element.rb
+class SOAPBody < SOAPStruct
+ public
+
+ def request
+ root_node
+ end
+
+ def response
+ root = root_node
+ if !@is_fault
+ if root.nil?
+ nil
+ elsif root.is_a?(SOAPBasetype)
+ root
+ else
+ # Initial element is [retval].
+ root[0]
+ end
+ else
+ root
+ end
+ end
+
+ def outparams
+ root = root_node
+ if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
+ op = root[1..-1]
+ op = nil if op && op.empty?
+ op
+ else
+ nil
+ end
+ end
+
+ def fault
+ if @is_fault
+ self['fault']
+ else
+ nil
+ end
+ end
+
+ def fault=(fault)
+ @is_fault = true
+ add('fault', fault)
+ end
+end
+
+
+module RPC
+
+
+class RPCError < Error; end
+class MethodDefinitionError < RPCError; end
+class ParameterError < RPCError; end
+
+class SOAPMethod < SOAPStruct
+ RETVAL = :retval
+ IN = :in
+ OUT = :out
+ INOUT = :inout
+
+ attr_reader :param_def
+ attr_reader :inparam
+ attr_reader :outparam
+ attr_reader :retval_name
+ attr_reader :retval_class_name
+
+ def initialize(qname, param_def = nil)
+ super(nil)
+ @elename = qname
+ @encodingstyle = nil
+
+ @param_def = param_def
+
+ @signature = []
+ @inparam_names = []
+ @inoutparam_names = []
+ @outparam_names = []
+
+ @inparam = {}
+ @outparam = {}
+ @retval_name = nil
+ @retval_class_name = nil
+
+ init_params(@param_def) if @param_def
+ end
+
+ def have_member
+ true
+ end
+
+ def have_outparam?
+ @outparam_names.size > 0
+ end
+
+ def input_params
+ collect_params(IN, INOUT)
+ end
+
+ def output_params
+ collect_params(OUT, INOUT)
+ end
+
+ def input_param_types
+ collect_param_types(IN, INOUT)
+ end
+
+ def output_param_types
+ collect_param_types(OUT, INOUT)
+ end
+
+ def set_param(params)
+ params.each do |param, data|
+ @inparam[param] = data
+ data.elename = XSD::QName.new(data.elename.namespace, param)
+ data.parent = self
+ end
+ end
+
+ def set_outparam(params)
+ params.each do |param, data|
+ @outparam[param] = data
+ data.elename = XSD::QName.new(data.elename.namespace, param)
+ end
+ end
+
+ def get_paramtypes(names)
+ types = []
+ @signature.each do |io_type, name, type_qname|
+ if type_qname && idx = names.index(name)
+ types[idx] = type_qname
+ end
+ end
+ types
+ end
+
+ def SOAPMethod.param_count(param_def, *type)
+ count = 0
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ if type.include?(param.io_type.to_sym)
+ count += 1
+ end
+ end
+ count
+ end
+
+ def SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ if param.size == 1 and param[0].is_a?(Array)
+ return param[0]
+ end
+ if param.empty?
+ method = obj.method(name)
+ param_names = (1..method.arity.abs).collect { |i| "p#{i}" }
+ else
+ param_names = param
+ end
+ create_rpc_param_def(param_names)
+ end
+
+ def SOAPMethod.create_rpc_param_def(param_names)
+ param_def = []
+ param_names.each do |param_name|
+ param_def.push([IN, param_name, nil])
+ end
+ param_def.push([RETVAL, 'return', nil])
+ param_def
+ end
+
+ def SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
+ req_qnames = [req_qnames] if req_qnames.is_a?(XSD::QName)
+ res_qnames = [res_qnames] if res_qnames.is_a?(XSD::QName)
+ param_def = []
+ # req_qnames and res_qnames can be nil
+ if req_qnames
+ req_qnames.each do |qname|
+ param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ end
+ if res_qnames
+ res_qnames.each do |qname|
+ param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ end
+ param_def
+ end
+
+private
+
+ def collect_param_types(*type)
+ names = []
+ @signature.each do |io_type, name, type_qname|
+ names << type_qname if type.include?(io_type)
+ end
+ names
+ end
+
+ def collect_params(*type)
+ names = []
+ @signature.each do |io_type, name, type_qname|
+ names << name if type.include?(io_type)
+ end
+ names
+ end
+
+ def init_params(param_def)
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ init_param(param)
+ end
+ end
+
+ def init_param(param)
+ mapped_class = SOAPMethod.parse_mapped_class(param.mapped_class)
+ qname = param.qname
+ if qname.nil? and mapped_class
+ qname = TypeMap.index(mapped_class)
+ end
+ case param.io_type
+ when IN
+ @signature.push([IN, param.name, qname])
+ @inparam_names.push(param.name)
+ when OUT
+ @signature.push([OUT, param.name, qname])
+ @outparam_names.push(param.name)
+ when INOUT
+ @signature.push([INOUT, param.name, qname])
+ @inoutparam_names.push(param.name)
+ when RETVAL
+ if @retval_name
+ raise MethodDefinitionError.new('duplicated retval')
+ end
+ @retval_name = param.name
+ @retval_class_name = mapped_class
+ else
+ raise MethodDefinitionError.new("unknown type: #{param.io_type}")
+ end
+ end
+
+ def self.parse_mapped_class(mapped_class)
+ # the first element of typedef in param_def can be a String like
+ # "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if
+ # we can.
+ if mapped_class.is_a?(String)
+ if /\[\]\Z/ =~ mapped_class
+ # when '[]' is added, ignore this.
+ mapped_class = nil
+ else
+ mapped_class = Mapping.class_from_name(mapped_class)
+ end
+ end
+ mapped_class
+ end
+end
+
+
+class SOAPMethodRequest < SOAPMethod
+ attr_accessor :soapaction
+
+ def SOAPMethodRequest.create_request(qname, *params)
+ param_def = []
+ param_value = []
+ i = 0
+ params.each do |param|
+ param_name = "p#{i}"
+ i += 1
+ param_def << [IN, param_name, nil]
+ param_value << [param_name, param]
+ end
+ param_def << [RETVAL, 'return', nil]
+ o = new(qname, param_def)
+ o.set_param(param_value)
+ o
+ end
+
+ def initialize(qname, param_def = nil, soapaction = nil)
+ super(qname, param_def)
+ @soapaction = soapaction
+ end
+
+ def each
+ input_params.each do |name|
+ unless @inparam[name]
+ raise ParameterError.new("parameter: #{name} was not given")
+ end
+ yield(name, @inparam[name])
+ end
+ end
+
+ def dup
+ req = self.class.new(@elename.dup, @param_def, @soapaction)
+ req.encodingstyle = @encodingstyle
+ req
+ end
+
+ def create_method_response(response_name = nil)
+ response_name ||=
+ XSD::QName.new(@elename.namespace, @elename.name + 'Response')
+ SOAPMethodResponse.new(response_name, @param_def)
+ end
+end
+
+
+class SOAPMethodResponse < SOAPMethod
+
+ def initialize(qname, param_def = nil)
+ super(qname, param_def)
+ @retval = nil
+ end
+
+ def retval
+ @retval
+ end
+
+ def retval=(retval)
+ @retval = retval
+ @retval.elename = @retval.elename.dup_name(@retval_name || 'return')
+ retval.parent = self
+ retval
+ end
+
+ def each
+ if @retval_name and !@retval.is_a?(SOAPVoid)
+ yield(@retval_name, @retval)
+ end
+
+ output_params.each do |name|
+ unless @outparam[name]
+ raise ParameterError.new("parameter: #{name} was not given")
+ end
+ yield(name, @outparam[name])
+ end
+ end
+end
+
+
+# To return(?) void explicitly.
+# def foo(input_var)
+# ...
+# return SOAP::RPC::SOAPVoid.new
+# end
+class SOAPVoid < XSD::XSDAnySimpleType
+ include SOAPBasetype
+ extend SOAPModuleUtils
+ Name = XSD::QName.new(Mapping::RubyCustomTypeNamespace, nil)
+
+public
+ def initialize()
+ @elename = Name
+ @id = nil
+ @precedents = []
+ @parent = nil
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb
new file mode 100644
index 00000000..41e8f398
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb
@@ -0,0 +1,142 @@
+# SOAP4R - WEBrick HTTP Server
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'logger'
+require 'soap/attrproxy'
+require 'soap/rpc/soaplet'
+require 'soap/streamHandler'
+require 'webrick'
+
+
+module SOAP
+module RPC
+
+
+class HTTPServer < Logger::Application
+ include AttrProxy
+
+ attr_reader :server
+ attr_accessor :default_namespace
+
+ attr_proxy :mapping_registry, true
+ attr_proxy :literal_mapping_registry, true
+ attr_proxy :generate_explicit_type, true
+ attr_proxy :use_default_namespace, true
+
+ def initialize(config)
+ actor = config[:SOAPHTTPServerApplicationName] || self.class.name
+ super(actor)
+ @default_namespace = config[:SOAPDefaultNamespace]
+ @webrick_config = config.dup
+ self.level = Logger::Severity::ERROR # keep silent by default
+ @webrick_config[:Logger] ||= @log
+ @log = @webrick_config[:Logger] # sync logger of App and HTTPServer
+ @router = ::SOAP::RPC::Router.new(actor)
+ @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
+ on_init
+ @server = WEBrick::HTTPServer.new(@webrick_config)
+ @server.mount('/soaprouter', @soaplet)
+ if wsdldir = config[:WSDLDocumentDirectory]
+ @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir)
+ end
+ @server.mount('/', @soaplet)
+ end
+
+ def on_init
+ # do extra initialization in a derived class if needed.
+ end
+
+ def status
+ @server.status if @server
+ end
+
+ def shutdown
+ @server.shutdown if @server
+ end
+
+ def authenticator
+ @soaplet.authenticator
+ end
+
+ def authenticator=(authenticator)
+ @soaplet.authenticator = authenticator
+ end
+
+ # servant entry interface
+
+ def add_rpc_request_servant(factory, namespace = @default_namespace)
+ @router.add_rpc_request_servant(factory, namespace)
+ end
+
+ def add_rpc_servant(obj, namespace = @default_namespace)
+ @router.add_rpc_servant(obj, namespace)
+ end
+
+ def add_request_headerhandler(factory)
+ @router.add_request_headerhandler(factory)
+ end
+
+ def add_headerhandler(obj)
+ @router.add_headerhandler(obj)
+ end
+ alias add_rpc_headerhandler add_headerhandler
+
+ def filterchain
+ @router.filterchain
+ end
+
+ # method entry interface
+
+ def add_rpc_method(obj, name, *param)
+ add_rpc_method_as(obj, name, name, *param)
+ end
+ alias add_method add_rpc_method
+
+ def add_rpc_method_as(obj, name, name_as, *param)
+ qname = XSD::QName.new(@default_namespace, name_as)
+ soapaction = nil
+ param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
+ end
+ alias add_method_as add_rpc_method_as
+
+ def add_document_method(obj, soapaction, name, req_qnames, res_qnames)
+ param_def = SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
+ @router.add_document_operation(obj, soapaction, name, param_def)
+ end
+
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
+ end
+
+ def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt)
+ end
+
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ @router.add_document_operation(receiver, soapaction, name, param_def, opt)
+ end
+
+ def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
+ @router.add_document_request_operation(factory, soapaction, name, param_def, opt)
+ end
+
+private
+
+ def attrproxy
+ @router
+ end
+
+ def run
+ @server.start
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/methodDef.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/methodDef.rb
new file mode 100644
index 00000000..3878a815
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/methodDef.rb
@@ -0,0 +1,68 @@
+# SOAP4R - A method definition
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+module RPC
+
+
+class MethodDef
+ attr_reader :name
+ attr_reader :soapaction
+ attr_reader :qname
+ attr_accessor :style
+ attr_accessor :inputuse
+ attr_accessor :outputuse
+ attr_reader :parameters
+ attr_reader :faults
+
+ def initialize(name, soapaction, qname)
+ @name = name
+ @soapaction = soapaction
+ @qname = qname
+ @style = @inputuse = @outputuse = nil
+ @parameters = []
+ @faults = {}
+ end
+
+ def add_parameter(io_type, name, qname, mapped_class)
+ @parameters << Parameter.new(io_type, name, qname, mapped_class)
+ end
+
+ def self.to_param(param)
+ if param.respond_to?(:io_type)
+ param
+ else
+ io_type, name, param_type = param
+ mapped_class_str, nsdef, namedef = param_type
+ if nsdef && namedef
+ qname = XSD::QName.new(nsdef, namedef)
+ else
+ qname = nil
+ end
+ MethodDef::Parameter.new(io_type.to_sym, name, qname, mapped_class_str)
+ end
+ end
+
+ class Parameter
+ attr_reader :io_type
+ attr_reader :name
+ attr_reader :qname
+ attr_reader :mapped_class
+
+ def initialize(io_type, name, qname, mapped_class)
+ @io_type = io_type
+ @name = name
+ @qname = qname
+ @mapped_class = mapped_class
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb
new file mode 100644
index 00000000..f731ebfa
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb
@@ -0,0 +1,572 @@
+# SOAP4R - RPC Proxy library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/processor'
+require 'soap/mapping'
+require 'soap/mapping/literalregistry'
+require 'soap/rpc/rpc'
+require 'soap/rpc/element'
+require 'soap/header/handlerset'
+require 'soap/filter'
+require 'soap/streamHandler'
+require 'soap/mimemessage'
+
+
+module SOAP
+module RPC
+
+
+class Proxy
+ include SOAP
+
+public
+
+ attr_accessor :soapaction
+ attr_accessor :mandatorycharset
+ attr_accessor :allow_unqualified_element
+ attr_accessor :default_encodingstyle
+ attr_accessor :generate_explicit_type
+ attr_accessor :use_default_namespace
+ attr_accessor :return_response_as_xml
+ attr_reader :headerhandler
+ attr_reader :filterchain
+ attr_reader :streamhandler
+
+ attr_accessor :mapping_registry
+ attr_accessor :literal_mapping_registry
+
+ attr_reader :operation
+
+ def initialize(endpoint_url, soapaction, options)
+ @endpoint_url = endpoint_url
+ @soapaction = soapaction
+ @options = options
+ @protocol_option = options["protocol"] ||= ::SOAP::Property.new
+ initialize_streamhandler(@protocol_option)
+ @operation = {}
+ @operation_by_qname = {}
+ @operation_by_soapaction = {}
+ @mandatorycharset = nil
+ # TODO: set to false by default or drop thie option in 1.6.0
+ @allow_unqualified_element = true
+ @default_encodingstyle = nil
+ @generate_explicit_type = nil
+ @use_default_namespace = false
+ @return_response_as_xml = false
+ @headerhandler = Header::HandlerSet.new
+ @filterchain = Filter::FilterChain.new
+ @mapping_registry = nil
+ @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new
+ end
+
+ def inspect
+ "#<#{self.class}:#{@endpoint_url}>"
+ end
+
+ def endpoint_url
+ @endpoint_url
+ end
+
+ def endpoint_url=(endpoint_url)
+ @endpoint_url = endpoint_url
+ reset_stream
+ end
+
+ def reset_stream
+ @streamhandler.reset(@endpoint_url)
+ end
+
+ def set_wiredump_file_base(wiredump_file_base)
+ @streamhandler.wiredump_file_base = wiredump_file_base
+ end
+
+ def test_loopback_response
+ @streamhandler.test_loopback_response
+ end
+
+ def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :rpc, :encoded)
+ opt[:request_qname] = qname
+ op = Operation.new(soapaction, param_def, opt)
+ assign_operation(name, qname, soapaction, op)
+ end
+
+ def add_document_operation(soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :document, :literal)
+ op = Operation.new(soapaction, param_def, opt)
+ assign_operation(name, nil, soapaction, op)
+ end
+
+ # add_method is for shortcut of typical rpc/encoded method definition.
+ alias add_method add_rpc_operation
+ alias add_rpc_method add_rpc_operation
+ alias add_document_method add_document_operation
+
+ def invoke(req_header, req_body, opt = nil)
+ opt ||= create_encoding_opt
+ env = route(req_header, req_body, opt, opt)
+ if @return_response_as_xml
+ opt[:response_as_xml]
+ else
+ env
+ end
+ end
+
+ def call(name, *params)
+ # name must be used only for lookup
+ op_info = lookup_operation(name)
+ mapping_opt = create_mapping_opt
+ req_header = create_request_header
+ req_body = SOAPBody.new(
+ op_info.request_body(params, @mapping_registry,
+ @literal_mapping_registry, mapping_opt)
+ )
+ reqopt = create_encoding_opt(
+ :soapaction => op_info.soapaction || @soapaction,
+ :envelopenamespace => @options["soap.envelope.requestnamespace"],
+ :default_encodingstyle =>
+ @default_encodingstyle || op_info.request_default_encodingstyle,
+ :use_default_namespace =>
+ op_info.use_default_namespace || @use_default_namespace
+ )
+ resopt = create_encoding_opt(
+ :envelopenamespace => @options["soap.envelope.responsenamespace"],
+ :default_encodingstyle =>
+ @default_encodingstyle || op_info.response_default_encodingstyle
+ )
+ if reqopt[:generate_explicit_type].nil?
+ reqopt[:generate_explicit_type] = (op_info.request_use == :encoded)
+ end
+ if resopt[:generate_explicit_type].nil?
+ resopt[:generate_explicit_type] = (op_info.response_use == :encoded)
+ end
+ env = route(req_header, req_body, reqopt, resopt)
+ if op_info.response_use.nil?
+ return nil
+ end
+ raise EmptyResponseError unless env
+ receive_headers(env.header)
+ begin
+ check_fault(env.body)
+ rescue ::SOAP::FaultError => e
+ op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
+ end
+ if @return_response_as_xml
+ resopt[:response_as_xml]
+ else
+ op_info.response_obj(env.body, @mapping_registry,
+ @literal_mapping_registry, mapping_opt)
+ end
+ end
+
+ def route(req_header, req_body, reqopt, resopt)
+ req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
+ unless reqopt[:envelopenamespace].nil?
+ set_envelopenamespace(req_env, reqopt[:envelopenamespace])
+ end
+ reqopt[:external_content] = nil
+ conn_data = marshal(req_env, reqopt)
+ if ext = reqopt[:external_content]
+ mime = MIMEMessage.new
+ ext.each do |k, v|
+ mime.add_attachment(v.data)
+ end
+ mime.add_part(conn_data.send_string + "\r\n")
+ mime.close
+ conn_data.send_string = mime.content_str
+ conn_data.send_contenttype = mime.headers['content-type'].str
+ end
+ conn_data.soapaction = reqopt[:soapaction]
+ conn_data = @streamhandler.send(@endpoint_url, conn_data)
+ if conn_data.receive_string.empty?
+ return nil
+ end
+ unmarshal(conn_data, resopt)
+ end
+
+ def check_fault(body)
+ if body.fault
+ raise SOAP::FaultError.new(body.fault)
+ end
+ end
+
+private
+
+ def ensure_styleuse_option(opt, style, use)
+ if opt[:request_style] || opt[:response_style] || opt[:request_use] || opt[:response_use]
+ # do not edit
+ else
+ opt[:request_style] ||= style
+ opt[:response_style] ||= style
+ opt[:request_use] ||= use
+ opt[:response_use] ||= use
+ end
+ end
+
+ def initialize_streamhandler(options)
+ value = options["streamhandler"]
+ if value and !value.empty?
+ factory = Property::Util.const_from_name(value)
+ else
+ factory = HTTPStreamHandler
+ end
+ @streamhandler = factory.create(options)
+ options.add_hook("streamhandler") do |key, value|
+ @streamhandler.reset
+ if value.respond_to?(:create)
+ factory = value
+ elsif value and !value.to_str.empty?
+ factory = Property::Util.const_from_name(value.to_str)
+ else
+ factory = HTTPStreamHandler
+ end
+ options.unlock(true)
+ @streamhandler = factory.create(options)
+ end
+ end
+
+ def set_envelopenamespace(env, namespace)
+ env.elename = XSD::QName.new(namespace, env.elename.name)
+ if env.header
+ env.header.elename = XSD::QName.new(namespace, env.header.elename.name)
+ end
+ if env.body
+ env.body.elename = XSD::QName.new(namespace, env.body.elename.name)
+ end
+ end
+
+ def create_request_header
+ header = ::SOAP::SOAPHeader.new
+ items = @headerhandler.on_outbound(header)
+ items.each do |item|
+ header.add(item.elename.name, item)
+ end
+ header
+ end
+
+ def receive_headers(header)
+ @headerhandler.on_inbound(header) if header
+ end
+
+ def marshal(env, opt)
+ @filterchain.each do |filter|
+ env = filter.on_outbound(env, opt)
+ break unless env
+ end
+ send_string = Processor.marshal(env, opt)
+ StreamHandler::ConnectionData.new(send_string)
+ end
+
+ def unmarshal(conn_data, opt)
+ contenttype = conn_data.receive_contenttype
+ xml = nil
+ if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
+ opt[:external_content] = {}
+ mime = MIMEMessage.parse("Content-Type: " + contenttype,
+ conn_data.receive_string)
+ mime.parts.each do |part|
+ value = Attachment.new(part.content)
+ value.contentid = part.contentid
+ obj = SOAPAttachment.new(value)
+ opt[:external_content][value.contentid] = obj if value.contentid
+ end
+ opt[:charset] = @mandatorycharset ||
+ StreamHandler.parse_media_type(mime.root.headers['content-type'].str)
+ xml = mime.root.content
+ else
+ opt[:charset] = @mandatorycharset ||
+ ::SOAP::StreamHandler.parse_media_type(contenttype)
+ xml = conn_data.receive_string
+ end
+ @filterchain.reverse_each do |filter|
+ xml = filter.on_inbound(xml, opt)
+ break unless xml
+ end
+ env = Processor.unmarshal(xml, opt)
+ if @return_response_as_xml
+ opt[:response_as_xml] = xml
+ end
+ unless env.is_a?(::SOAP::SOAPEnvelope)
+ raise ResponseFormatError.new("response is not a SOAP envelope: #{env}")
+ end
+ env
+ end
+
+ def create_encoding_opt(hash = nil)
+ opt = {}
+ opt[:default_encodingstyle] = @default_encodingstyle
+ opt[:allow_unqualified_element] = @allow_unqualified_element
+ opt[:generate_explicit_type] = @generate_explicit_type
+ opt[:no_indent] = @options["soap.envelope.no_indent"]
+ opt[:use_numeric_character_reference] =
+ @options["soap.envelope.use_numeric_character_reference"]
+ opt.update(hash) if hash
+ opt
+ end
+
+ def create_mapping_opt(hash = nil)
+ opt = {
+ :external_ces => @options["soap.mapping.external_ces"]
+ }
+ opt.update(hash) if hash
+ opt
+ end
+
+ def assign_operation(name, qname, soapaction, op)
+ assigned = false
+ if name and !name.empty?
+ @operation[name] = op
+ assigned = true
+ end
+ if qname
+ @operation_by_qname[qname] = op
+ assigned = true
+ end
+ if soapaction and !soapaction.empty?
+ @operation_by_soapaction[soapaction] = op
+ assigned = true
+ end
+ unless assigned
+ raise MethodDefinitionError.new("cannot assign operation")
+ end
+ end
+
+ def lookup_operation(name_or_qname_or_soapaction)
+ if op = @operation[name_or_qname_or_soapaction]
+ return op
+ end
+ if op = @operation_by_qname[name_or_qname_or_soapaction]
+ return op
+ end
+ if op = @operation_by_soapaction[name_or_qname_or_soapaction]
+ return op
+ end
+ raise MethodDefinitionError.new(
+ "operation: #{name_or_qname_or_soapaction} not supported")
+ end
+
+ class Operation
+ attr_reader :soapaction
+ attr_reader :request_style
+ attr_reader :response_style
+ attr_reader :request_use
+ attr_reader :response_use
+ attr_reader :use_default_namespace
+
+ def initialize(soapaction, param_def, opt)
+ @soapaction = soapaction
+ @request_style = opt[:request_style]
+ @response_style = opt[:response_style]
+ @request_use = opt[:request_use]
+ @response_use = opt[:response_use]
+ @use_default_namespace =
+ opt[:use_default_namespace] || opt[:elementformdefault]
+ if opt.key?(:elementformdefault)
+ warn("option :elementformdefault is deprecated. use :use_default_namespace instead")
+ end
+ check_style(@request_style)
+ check_style(@response_style)
+ check_use(@request_use)
+ check_use(@response_use)
+ if @request_style == :rpc
+ @rpc_request_qname = opt[:request_qname]
+ if @rpc_request_qname.nil?
+ raise MethodDefinitionError.new("rpc_request_qname must be given")
+ end
+ @rpc_method_factory =
+ RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
+ else
+ @doc_request_qnames = []
+ @doc_response_qnames = []
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ case param.io_type
+ when SOAPMethod::IN
+ @doc_request_qnames << param.qname
+ when SOAPMethod::OUT
+ @doc_response_qnames << param.qname
+ else
+ raise MethodDefinitionError.new(
+ "illegal inout definition for document style: #{param.io_type}")
+ end
+ end
+ end
+ end
+
+ def request_default_encodingstyle
+ (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def response_default_encodingstyle
+ (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def request_body(values, mapping_registry, literal_mapping_registry, opt)
+ if @request_style == :rpc
+ request_rpc(values, mapping_registry, literal_mapping_registry, opt)
+ else
+ request_doc(values, mapping_registry, literal_mapping_registry, opt)
+ end
+ end
+
+ def response_obj(body, mapping_registry, literal_mapping_registry, opt)
+ if @response_style == :rpc
+ response_rpc(body, mapping_registry, literal_mapping_registry, opt)
+ else
+ unique_result_for_one_element_array(
+ response_doc(body, mapping_registry, literal_mapping_registry, opt))
+ end
+ end
+
+ def raise_fault(e, mapping_registry, literal_mapping_registry)
+ if @response_style == :rpc
+ Mapping.fault2exception(e, mapping_registry)
+ else
+ Mapping.fault2exception(e, literal_mapping_registry)
+ end
+ end
+
+ private
+
+ # nil for [] / 1 for [1] / [1, 2] for [1, 2]
+ def unique_result_for_one_element_array(ary)
+ ary.size <= 1 ? ary[0] : ary
+ end
+
+ def check_style(style)
+ unless [:rpc, :document].include?(style)
+ raise MethodDefinitionError.new("unknown style: #{style}")
+ end
+ end
+
+ # nil means oneway
+ def check_use(use)
+ unless [:encoded, :literal, nil].include?(use)
+ raise MethodDefinitionError.new("unknown use: #{use}")
+ end
+ end
+
+ def request_rpc(values, mapping_registry, literal_mapping_registry, opt)
+ if @request_use == :encoded
+ request_rpc_enc(values, mapping_registry, opt)
+ else
+ request_rpc_lit(values, literal_mapping_registry, opt)
+ end
+ end
+
+ def request_doc(values, mapping_registry, literal_mapping_registry, opt)
+ if @request_use == :encoded
+ request_doc_enc(values, mapping_registry, opt)
+ else
+ request_doc_lit(values, literal_mapping_registry, opt)
+ end
+ end
+
+ def request_rpc_enc(values, mapping_registry, opt)
+ method = @rpc_method_factory.dup
+ names = method.input_params
+ types = method.input_param_types
+ ary = Mapping.objs2soap(values, mapping_registry, types, opt)
+ soap = {}
+ 0.upto(ary.length - 1) do |idx|
+ soap[names[idx]] = ary[idx]
+ end
+ method.set_param(soap)
+ method
+ end
+
+ def request_rpc_lit(values, mapping_registry, opt)
+ method = @rpc_method_factory.dup
+ names = method.input_params
+ types = method.get_paramtypes(names)
+ params = {}
+ idx = 0
+ names.each do |name|
+ params[name] = Mapping.obj2soap(values[idx], mapping_registry,
+ types[idx], opt)
+ params[name].elename = XSD::QName.new(nil, name)
+ idx += 1
+ end
+ method.set_param(params)
+ method
+ end
+
+ def request_doc_enc(values, mapping_registry, opt)
+ (0...values.size).collect { |idx|
+ ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt)
+ ele.elename = @doc_request_qnames[idx]
+ ele
+ }
+ end
+
+ def request_doc_lit(values, mapping_registry, opt)
+ (0...values.size).collect { |idx|
+ ele = Mapping.obj2soap(values[idx], mapping_registry,
+ @doc_request_qnames[idx], opt)
+ ele.encodingstyle = LiteralNamespace
+ ele
+ }
+ end
+
+ def response_rpc(body, mapping_registry, literal_mapping_registry, opt)
+ if @response_use == :encoded
+ response_rpc_enc(body, mapping_registry, opt)
+ else
+ response_rpc_lit(body, literal_mapping_registry, opt)
+ end
+ end
+
+ def response_doc(body, mapping_registry, literal_mapping_registry, opt)
+ if @response_use == :encoded
+ response_doc_enc(body, mapping_registry, opt)
+ else
+ response_doc_lit(body, literal_mapping_registry, opt)
+ end
+ end
+
+ def response_rpc_enc(body, mapping_registry, opt)
+ ret = nil
+ if body.response
+ ret = Mapping.soap2obj(body.response, mapping_registry,
+ @rpc_method_factory.retval_class_name, opt)
+ end
+ if body.outparams
+ outparams = body.outparams.collect { |outparam|
+ Mapping.soap2obj(outparam, mapping_registry, nil, opt)
+ }
+ [ret].concat(outparams)
+ else
+ ret
+ end
+ end
+
+ def response_rpc_lit(body, mapping_registry, opt)
+ body.root_node.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry,
+ @rpc_method_factory.retval_class_name, opt)
+ }
+ end
+
+ def response_doc_enc(body, mapping_registry, opt)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry, nil, opt)
+ }
+ end
+
+ def response_doc_lit(body, mapping_registry, opt)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb
new file mode 100644
index 00000000..60971b97
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb
@@ -0,0 +1,662 @@
+# SOAP4R - RPC Routing library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/processor'
+require 'soap/mapping'
+require 'soap/mapping/literalregistry'
+require 'soap/rpc/rpc'
+require 'soap/rpc/element'
+require 'soap/header/handlerset'
+require 'soap/filter'
+require 'soap/streamHandler'
+require 'soap/mimemessage'
+require 'soap/header/handlerset'
+
+
+module SOAP
+module RPC
+
+
+class Router
+ include SOAP
+
+ attr_reader :actor
+ attr_accessor :mapping_registry
+ attr_accessor :literal_mapping_registry
+ attr_accessor :generate_explicit_type
+ attr_accessor :use_default_namespace
+ attr_accessor :external_ces
+ attr_reader :filterchain
+
+ def initialize(actor)
+ @actor = actor
+ @mapping_registry = nil
+ @headerhandler = Header::HandlerSet.new
+ @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new
+ @generate_explicit_type = true
+ @use_default_namespace = false
+ @external_ces = nil
+ @operation_by_soapaction = {}
+ @operation_by_qname = {}
+ @headerhandlerfactory = []
+ @filterchain = Filter::FilterChain.new
+ end
+
+ ###
+ ## header handler interface
+ #
+ def add_request_headerhandler(factory)
+ unless factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ @headerhandlerfactory << factory
+ end
+
+ def add_headerhandler(handler)
+ @headerhandler.add(handler)
+ end
+
+ ###
+ ## servant definition interface
+ #
+ def add_rpc_request_servant(factory, namespace)
+ unless factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ obj = factory.create # a dummy instance for introspection
+ ::SOAP::RPC.defined_methods(obj).each do |name|
+ begin
+ qname = XSD::QName.new(namespace, name)
+ param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
+ opt = create_styleuse_option(:rpc, :encoded)
+ add_rpc_request_operation(factory, qname, nil, name, param_def, opt)
+ rescue SOAP::RPC::MethodDefinitionError => e
+ p e if $DEBUG
+ end
+ end
+ end
+
+ def add_rpc_servant(obj, namespace)
+ ::SOAP::RPC.defined_methods(obj).each do |name|
+ begin
+ qname = XSD::QName.new(namespace, name)
+ param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
+ opt = create_styleuse_option(:rpc, :encoded)
+ add_rpc_operation(obj, qname, nil, name, param_def, opt)
+ rescue SOAP::RPC::MethodDefinitionError => e
+ p e if $DEBUG
+ end
+ end
+ end
+ alias add_servant add_rpc_servant
+
+ ###
+ ## operation definition interface
+ #
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :rpc, :encoded)
+ opt[:request_qname] = qname
+ op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
+ opt)
+ if opt[:request_style] != :rpc
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, qname, op)
+ end
+ alias add_method add_rpc_operation
+ alias add_rpc_method add_rpc_operation
+
+ def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :rpc, :encoded)
+ opt[:request_qname] = qname
+ op = RequestScopeOperation.new(soapaction, factory, name, param_def, opt)
+ if opt[:request_style] != :rpc
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, qname, op)
+ end
+
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ #
+ # adopt workaround for doc/lit wrapper method
+ # (you should consider to simply use rpc/lit service)
+ #
+ #unless soapaction
+ # raise RPCRoutingError.new("soapaction is a must for document method")
+ #end
+ ensure_styleuse_option(opt, :document, :literal)
+ op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
+ opt)
+ if opt[:request_style] != :document
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, first_input_part_qname(param_def), op)
+ end
+ alias add_document_method add_document_operation
+
+ def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
+ #
+ # adopt workaround for doc/lit wrapper method
+ # (you should consider to simply use rpc/lit service)
+ #
+ #unless soapaction
+ # raise RPCRoutingError.new("soapaction is a must for document method")
+ #end
+ ensure_styleuse_option(opt, :document, :literal)
+ op = RequestScopeOperation.new(soapaction, receiver, name, param_def, opt)
+ if opt[:request_style] != :document
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, first_input_part_qname(param_def), op)
+ end
+
+ def route(conn_data)
+ # we cannot set request_default_encodingsyle before parsing the content.
+ env = unmarshal(conn_data)
+ if env.nil?
+ raise ArgumentError.new("illegal SOAP marshal format")
+ end
+ op = lookup_operation(conn_data.soapaction, env.body)
+ headerhandler = @headerhandler.dup
+ @headerhandlerfactory.each do |f|
+ headerhandler.add(f.create)
+ end
+ soap_response = default_encodingstyle = nil
+ begin
+ receive_headers(headerhandler, env.header)
+ soap_response =
+ op.call(env.body, @mapping_registry, @literal_mapping_registry,
+ create_mapping_opt)
+ conn_data.is_fault = true if soap_response.is_a?(SOAPFault)
+ default_encodingstyle = op.response_default_encodingstyle
+ rescue Exception => e
+ # If a wsdl fault was raised by service, the fault declaration details
+ # is kept in wsdl_fault. Otherwise (exception is a program fault)
+ # wsdl_fault is nil
+ wsdl_fault_details = op.faults && op.faults[e.class.name]
+ soap_response = fault(e, wsdl_fault_details)
+ conn_data.is_fault = true
+ default_encodingstyle = nil
+ end
+ header = call_headers(headerhandler)
+ if op.response_use.nil?
+ conn_data.send_string = ''
+ conn_data.is_nocontent = true
+ conn_data
+ else
+ body = SOAPBody.new(soap_response, conn_data.is_fault)
+ env = SOAPEnvelope.new(header, body)
+ marshal(conn_data, env, default_encodingstyle)
+ end
+ end
+
+ # Create fault response string.
+ def create_fault_response(e)
+ env = SOAPEnvelope.new(SOAPHeader.new, SOAPBody.new(fault(e, nil), true))
+ opt = {}
+ opt[:external_content] = nil
+ @filterchain.reverse_each do |filter|
+ env = filter.on_outbound(env, opt)
+ break unless env
+ end
+ response_string = Processor.marshal(env, opt)
+ conn_data = StreamHandler::ConnectionData.new(response_string)
+ conn_data.is_fault = true
+ if ext = opt[:external_content]
+ mimeize(conn_data, ext)
+ end
+ conn_data
+ end
+
+private
+
+ def first_input_part_qname(param_def)
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ if param.io_type == SOAPMethod::IN
+ return param.qname
+ end
+ end
+ nil
+ end
+
+ def create_styleuse_option(style, use)
+ opt = {}
+ opt[:request_style] = opt[:response_style] = style
+ opt[:request_use] = opt[:response_use] = use
+ opt
+ end
+
+ def ensure_styleuse_option(opt, style, use)
+ if opt[:request_style] || opt[:response_style] || opt[:request_use] || opt[:response_use]
+ # do not edit
+ else
+ opt[:request_style] ||= style
+ opt[:response_style] ||= style
+ opt[:request_use] ||= use
+ opt[:response_use] ||= use
+ end
+ end
+
+ def assign_operation(soapaction, qname, op)
+ assigned = false
+ if soapaction and !soapaction.empty?
+ @operation_by_soapaction[soapaction] = op
+ assigned = true
+ end
+ if qname
+ @operation_by_qname[qname] = op
+ assigned = true
+ end
+ unless assigned
+ raise RPCRoutingError.new("cannot assign operation")
+ end
+ end
+
+ def lookup_operation(soapaction, body)
+ if op = @operation_by_soapaction[soapaction]
+ return op
+ end
+ qname = body.root_node.elename
+ if op = @operation_by_qname[qname]
+ return op
+ end
+ if soapaction
+ raise RPCRoutingError.new(
+ "operation: #{soapaction} #{qname} not supported")
+ else
+ raise RPCRoutingError.new("operation: #{qname} not supported")
+ end
+ end
+
+ def call_headers(headerhandler)
+ header = ::SOAP::SOAPHeader.new
+ items = headerhandler.on_outbound(header)
+ items.each do |item|
+ header.add(item.elename.name, item)
+ end
+ header
+ end
+
+ def receive_headers(headerhandler, header)
+ headerhandler.on_inbound(header) if header
+ end
+
+ def unmarshal(conn_data)
+ xml = nil
+ opt = {}
+ contenttype = conn_data.receive_contenttype
+ if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
+ opt[:external_content] = {}
+ mime = MIMEMessage.parse("Content-Type: " + contenttype,
+ conn_data.receive_string)
+ mime.parts.each do |part|
+ value = Attachment.new(part.content)
+ value.contentid = part.contentid
+ obj = SOAPAttachment.new(value)
+ opt[:external_content][value.contentid] = obj if value.contentid
+ end
+ opt[:charset] =
+ StreamHandler.parse_media_type(mime.root.headers['content-type'].str)
+ xml = mime.root.content
+ else
+ opt[:charset] = ::SOAP::StreamHandler.parse_media_type(contenttype)
+ xml = conn_data.receive_string
+ end
+ @filterchain.each do |filter|
+ xml = filter.on_inbound(xml, opt)
+ break unless xml
+ end
+ env = Processor.unmarshal(xml, opt)
+ charset = opt[:charset]
+ conn_data.send_contenttype = "text/xml; charset=\"#{charset}\""
+ env
+ end
+
+ def marshal(conn_data, env, default_encodingstyle = nil)
+ opt = {}
+ opt[:external_content] = nil
+ opt[:default_encodingstyle] = default_encodingstyle
+ opt[:generate_explicit_type] = @generate_explicit_type
+ opt[:use_default_namespace] = @use_default_namespace
+ @filterchain.reverse_each do |filter|
+ env = filter.on_outbound(env, opt)
+ break unless env
+ end
+ response_string = Processor.marshal(env, opt)
+ conn_data.send_string = response_string
+ if ext = opt[:external_content]
+ mimeize(conn_data, ext)
+ end
+ conn_data
+ end
+
+ def mimeize(conn_data, ext)
+ mime = MIMEMessage.new
+ ext.each do |k, v|
+ mime.add_attachment(v.data)
+ end
+ mime.add_part(conn_data.send_string + "\r\n")
+ mime.close
+ conn_data.send_string = mime.content_str
+ conn_data.send_contenttype = mime.headers['content-type'].str
+ conn_data
+ end
+
+ # Create fault response.
+ def fault(e, wsdl_fault_details)
+ if e.is_a?(UnhandledMustUnderstandHeaderError)
+ faultcode = FaultCode::MustUnderstand
+ else
+ faultcode = FaultCode::Server
+ end
+
+ # If the exception represents a WSDL fault, the fault element should
+ # be added as the SOAP fault element. If the exception is a
+ # normal program exception, it is wrapped inside a custom SOAP4R
+ # SOAP exception element.
+ detail = nil
+ begin
+ if (wsdl_fault_details)
+ registry = wsdl_fault_details[:use] == "literal" ?
+ @literal_mapping_registry : @mapping_registry
+ faultQName = XSD::QName.new(
+ wsdl_fault_details[:ns], wsdl_fault_details[:name]
+ )
+ detail = Mapping.obj2soap(e, registry, faultQName)
+ # wrap fault element (SOAPFault swallows top-level element)
+ wrapper = SOAP::SOAPElement.new(faultQName)
+ wrapper.add(detail)
+ detail = wrapper
+ else
+ # Exception is a normal program exception. Wrap it.
+ detail = Mapping.obj2soap(Mapping::SOAPException.new(e),
+ @mapping_registry)
+ detail.elename ||= XSD::QName::EMPTY # for literal mappingregstry
+ end
+ rescue
+ detail = SOAPString.new("failed to serialize detail object: #{$!}")
+ end
+
+ SOAPFault.new(
+ SOAPElement.new(nil, faultcode),
+ SOAPString.new(e.to_s),
+ SOAPString.new(@actor),
+ detail)
+ end
+
+ def create_mapping_opt
+ { :external_ces => @external_ces }
+ end
+
+ class Operation
+ attr_reader :name
+ attr_reader :soapaction
+ attr_reader :request_style
+ attr_reader :response_style
+ attr_reader :request_use
+ attr_reader :response_use
+ attr_reader :faults
+
+ def initialize(soapaction, name, param_def, opt)
+ @soapaction = soapaction
+ @name = name
+ @request_style = opt[:request_style]
+ @response_style = opt[:response_style]
+ @request_use = opt[:request_use]
+ @response_use = opt[:response_use]
+ @faults = opt[:faults]
+ check_style(@request_style)
+ check_style(@response_style)
+ check_use(@request_use)
+ check_use(@response_use)
+ if @response_style == :rpc
+ request_qname = opt[:request_qname] or raise
+ @rpc_method_factory =
+ RPC::SOAPMethodRequest.new(request_qname, param_def, @soapaction)
+ @rpc_response_qname = opt[:response_qname]
+ else
+ @doc_request_qnames = []
+ @doc_response_qnames = []
+ param_def.each do |param|
+ param = MethodDef.to_param(param)
+ case param.io_type
+ when SOAPMethod::IN
+ @doc_request_qnames << param.qname
+ when SOAPMethod::OUT
+ @doc_response_qnames << param.qname
+ else
+ raise ArgumentError.new(
+ "illegal inout definition for document style: #{param.io_type}")
+ end
+ end
+ end
+ end
+
+ def request_default_encodingstyle
+ (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def response_default_encodingstyle
+ (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def call(body, mapping_registry, literal_mapping_registry, opt)
+ if @request_style == :rpc
+ values = request_rpc(body, mapping_registry, literal_mapping_registry,
+ opt)
+ else
+ values = request_document(body, mapping_registry,
+ literal_mapping_registry, opt)
+ end
+ result = receiver.method(@name.intern).call(*values)
+ return result if result.is_a?(SOAPFault)
+ if @response_style == :rpc
+ response_rpc(result, mapping_registry, literal_mapping_registry, opt)
+ elsif @doc_response_qnames.empty?
+ # nothing to do
+ else
+ response_doc(result, mapping_registry, literal_mapping_registry, opt)
+ end
+ end
+
+ private
+
+ def receiver
+ raise NotImplementedError.new('must be defined in derived class')
+ end
+
+ def request_rpc(body, mapping_registry, literal_mapping_registry, opt)
+ request = body.request
+ unless request.is_a?(SOAPNameAccessible)
+ if request.is_a?(SOAPNil)
+ # SOAP::Lite/0.69 seems to send xsi:nil="true" element as a request.
+ request = SOAPStruct.new(request.elename)
+ else
+ raise RPCRoutingError.new("not an RPC style")
+ end
+ end
+ if @request_use == :encoded
+ request_rpc_enc(request, mapping_registry, opt)
+ else
+ request_rpc_lit(request, literal_mapping_registry, opt)
+ end
+ end
+
+ def request_document(body, mapping_registry, literal_mapping_registry, opt)
+ # ToDo: compare names with @doc_request_qnames
+ if @request_use == :encoded
+ request_doc_enc(body, mapping_registry, opt)
+ else
+ request_doc_lit(body, literal_mapping_registry, opt)
+ end
+ end
+
+ def request_rpc_enc(request, mapping_registry, opt)
+ param = Mapping.soap2obj(request, mapping_registry, nil, opt)
+ request.collect { |key, value|
+ param[key]
+ }
+ end
+
+ def request_rpc_lit(request, mapping_registry, opt)
+ request.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry, nil, opt)
+ }
+ end
+
+ def request_doc_enc(body, mapping_registry, opt)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry, nil, opt)
+ }
+ end
+
+ def request_doc_lit(body, mapping_registry, opt)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry, nil, opt)
+ }
+ end
+
+ def response_rpc(result, mapping_registry, literal_mapping_registry, opt)
+ if @response_use == :encoded
+ response_rpc_enc(result, mapping_registry, opt)
+ else
+ response_rpc_lit(result, literal_mapping_registry, opt)
+ end
+ end
+
+ def response_doc(result, mapping_registry, literal_mapping_registry, opt)
+ if @doc_response_qnames.size == 0
+ result = []
+ elsif @doc_response_qnames.size == 1
+ result = [result]
+ end
+ if result.size != @doc_response_qnames.size
+ raise "required #{@doc_response_qnames.size} responses " +
+ "but #{result.size} given"
+ end
+ if @response_use == :encoded
+ response_doc_enc(result, mapping_registry, opt)
+ else
+ response_doc_lit(result, literal_mapping_registry, opt)
+ end
+ end
+
+ def response_rpc_enc(result, mapping_registry, opt)
+ soap_response =
+ @rpc_method_factory.create_method_response(@rpc_response_qname)
+ if soap_response.have_outparam?
+ unless result.is_a?(Array)
+ raise RPCRoutingError.new("out parameter was not returned")
+ end
+ outparams = {}
+ i = 1
+ soap_response.output_params.each do |outparam|
+ outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry,
+ nil, opt)
+ i += 1
+ end
+ soap_response.set_outparam(outparams)
+ soap_response.retval = Mapping.obj2soap(result[0], mapping_registry,
+ nil, opt)
+ else
+ soap_response.retval = Mapping.obj2soap(result, mapping_registry, nil,
+ opt)
+ end
+ soap_response
+ end
+
+ def response_rpc_lit(result, mapping_registry, opt)
+ soap_response =
+ @rpc_method_factory.create_method_response(@rpc_response_qname)
+ if soap_response.have_outparam?
+ unless result.is_a?(Array)
+ raise RPCRoutingError.new("out parameter was not returned")
+ end
+ outparams = {}
+ i = 1
+ soap_response.output_params.each do |outparam|
+ outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry,
+ XSD::QName.new(nil, outparam), opt)
+ i += 1
+ end
+ soap_response.set_outparam(outparams)
+ soap_response.retval = Mapping.obj2soap(result[0], mapping_registry,
+ soap_response.elename, opt)
+ else
+ soap_response.retval = Mapping.obj2soap(result, mapping_registry,
+ soap_response.elename, opt)
+ end
+ soap_response
+ end
+
+ def response_doc_enc(result, mapping_registry, opt)
+ (0...result.size).collect { |idx|
+ ele = Mapping.obj2soap(result[idx], mapping_registry, nil, opt)
+ ele.elename = @doc_response_qnames[idx]
+ ele
+ }
+ end
+
+ def response_doc_lit(result, mapping_registry, opt)
+ (0...result.size).collect { |idx|
+ ele = Mapping.obj2soap(result[idx], mapping_registry,
+ @doc_response_qnames[idx])
+ ele.encodingstyle = LiteralNamespace
+ ele
+ }
+ end
+
+ def check_style(style)
+ unless [:rpc, :document].include?(style)
+ raise ArgumentError.new("unknown style: #{style}")
+ end
+ end
+
+ # nil means oneway
+ def check_use(use)
+ unless [:encoded, :literal, nil].include?(use)
+ raise ArgumentError.new("unknown use: #{use}")
+ end
+ end
+ end
+
+ class ApplicationScopeOperation < Operation
+ def initialize(soapaction, receiver, name, param_def, opt)
+ super(soapaction, name, param_def, opt)
+ @receiver = receiver
+ end
+
+ private
+
+ def receiver
+ @receiver
+ end
+ end
+
+ class RequestScopeOperation < Operation
+ def initialize(soapaction, receiver_factory, name, param_def, opt)
+ super(soapaction, name, param_def, opt)
+ unless receiver_factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ @receiver_factory = receiver_factory
+ end
+
+ private
+
+ def receiver
+ @receiver_factory.create
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb
new file mode 100644
index 00000000..521d001d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb
@@ -0,0 +1,25 @@
+# SOAP4R - RPC utility.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module SOAP
+
+
+module RPC
+ ServerException = Mapping::MappedException
+
+ def self.defined_methods(obj)
+ if obj.is_a?(Module)
+ obj.methods - Module.methods
+ else
+ obj.methods - Object.instance_methods(true)
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb
new file mode 100644
index 00000000..d9529274
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb
@@ -0,0 +1,200 @@
+# SOAP4R - SOAP handler servlet for WEBrick
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'webrick/httpservlet/abstract'
+require 'webrick/httpstatus'
+require 'soap/rpc/router'
+require 'soap/streamHandler'
+begin
+ require 'stringio'
+ require 'zlib'
+rescue LoadError
+ warn("Loading stringio or zlib failed. No gzipped response supported.") if $DEBUG
+end
+
+
+warn("Overriding WEBrick::Log#debug") if $DEBUG
+require 'webrick/log'
+module WEBrick
+ class Log < BasicLog
+ alias __debug debug
+ def debug(msg = nil)
+ if block_given? and msg.nil?
+ __debug(yield)
+ else
+ __debug(msg)
+ end
+ end
+ end
+end
+
+
+module SOAP
+module RPC
+
+
+class SOAPlet < WEBrick::HTTPServlet::AbstractServlet
+public
+ attr_reader :options
+ attr_accessor :authenticator
+
+ def initialize(router = nil)
+ @router = router || ::SOAP::RPC::Router.new(self.class.name)
+ @options = {}
+ @authenticator = nil
+ @config = {}
+ end
+
+ def allow_content_encoding_gzip=(allow)
+ @options[:allow_content_encoding_gzip] = allow
+ end
+
+ ###
+ ## Servlet interfaces for WEBrick.
+ #
+ def get_instance(config, *options)
+ @config = config
+ self
+ end
+
+ def require_path_info?
+ false
+ end
+
+ def do_GET(req, res)
+ res.header['Allow'] = 'POST'
+ raise WEBrick::HTTPStatus::MethodNotAllowed, "GET request not allowed"
+ end
+
+ def do_POST(req, res)
+ logger.debug { "SOAP request: " + req.body } if logger
+ if @authenticator
+ @authenticator.authenticate(req, res)
+ # you can check authenticated user with SOAP::RPC::SOAPlet.user
+ end
+ begin
+ conn_data = ::SOAP::StreamHandler::ConnectionData.new
+ setup_req(conn_data, req)
+ @router.external_ces = @options[:external_ces]
+ Mapping.protect_threadvars(:SOAPlet) do
+ SOAPlet.user = req.user
+ SOAPlet.cookies = req.cookies
+ conn_data = @router.route(conn_data)
+ setup_res(conn_data, req, res)
+ end
+ rescue Exception => e
+ conn_data = @router.create_fault_response(e)
+ res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
+ res.body = conn_data.send_string
+ res['content-type'] = conn_data.send_contenttype || "text/xml"
+ end
+ if res.body.is_a?(IO)
+ res.chunked = true
+ logger.debug { "SOAP response: (chunked response not logged)" } if logger
+ else
+ logger.debug { "SOAP response: " + res.body } if logger
+ end
+ end
+
+ def self.cookies
+ get_variable(:Cookies)
+ end
+
+ def self.cookies=(cookies)
+ set_variable(:Cookies, cookies)
+ end
+
+ def self.user
+ get_variable(:User)
+ end
+
+ def self.user=(user)
+ set_variable(:User, user)
+ end
+
+private
+
+ def self.get_variable(name)
+ if var = Thread.current[:SOAPlet]
+ var[name]
+ else
+ nil
+ end
+ end
+
+ def self.set_variable(name, value)
+ var = Thread.current[:SOAPlet] ||= {}
+ var[name] = value
+ end
+
+ def logger
+ @config[:Logger]
+ end
+
+ def setup_req(conn_data, req)
+ conn_data.receive_string = req.body
+ conn_data.receive_contenttype = req['content-type']
+ conn_data.soapaction = parse_soapaction(req.meta_vars['HTTP_SOAPACTION'])
+ end
+
+ def setup_res(conn_data, req, res)
+ res['content-type'] = conn_data.send_contenttype
+ cookies = SOAPlet.cookies
+ unless cookies.empty?
+ res['set-cookie'] = cookies.collect { |cookie| cookie.to_s }
+ end
+ if conn_data.is_nocontent
+ res.status = WEBrick::HTTPStatus::RC_ACCEPTED
+ res.body = ''
+ return
+ end
+ if conn_data.is_fault
+ res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
+ end
+ if outstring = encode_gzip(req, conn_data.send_string)
+ res['content-encoding'] = 'gzip'
+ res['content-length'] = outstring.size
+ res.body = outstring
+ else
+ res.body = conn_data.send_string
+ end
+ end
+
+ def parse_soapaction(soapaction)
+ if !soapaction.nil? and !soapaction.empty?
+ if /^"(.+)"$/ =~ soapaction
+ return $1
+ end
+ end
+ nil
+ end
+
+ def encode_gzip(req, outstring)
+ unless encode_gzip?(req)
+ return nil
+ end
+ begin
+ ostream = StringIO.new
+ gz = Zlib::GzipWriter.new(ostream)
+ gz.write(outstring)
+ ostream.string
+ ensure
+ gz.close
+ end
+ end
+
+ def encode_gzip?(req)
+ @options[:allow_content_encoding_gzip] and defined?(::Zlib) and
+ req['accept-encoding'] and
+ req['accept-encoding'].split(/,\s*/).include?('gzip')
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb
new file mode 100644
index 00000000..1652fa43
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb
@@ -0,0 +1,43 @@
+# SOAP4R - WEBrick Server
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/rpc/httpserver'
+
+
+module SOAP
+module RPC
+
+
+class StandaloneServer < HTTPServer
+ def initialize(appname, default_namespace, host = "0.0.0.0", port = 8089)
+ @appname = appname
+ @default_namespace = default_namespace
+ @host = host
+ @port = port
+ super(create_config)
+ end
+
+ alias add_servant add_rpc_servant
+ alias add_headerhandler add_rpc_headerhandler
+
+private
+
+ def create_config
+ {
+ :BindAddress => @host,
+ :Port => @port,
+ :AccessLog => [],
+ :SOAPDefaultNamespace => @default_namespace,
+ :SOAPHTTPServerApplicationName => @appname,
+ }
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/ruby18ext.rb b/vendor/gems/soap4r-1.5.8/lib/soap/ruby18ext.rb
new file mode 100644
index 00000000..70f0f499
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/ruby18ext.rb
@@ -0,0 +1,13 @@
+# SOAP4R - Extensions for Ruby 1.8.X compatibility
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+# 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.
+
+unless RUBY_VERSION >= "1.9.0"
+ class Hash
+ def key(value)
+ index(value)
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb b/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb
new file mode 100644
index 00000000..f0a82a8c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb
@@ -0,0 +1,151 @@
+# soap/soap.rb: SOAP4R - Base definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/ruby18ext'
+require 'xsd/qname'
+require 'xsd/charset'
+require 'soap/nestedexception'
+
+
+module SOAP
+
+
+VERSION = Version = '1.6.1-SNAPSHOT'
+PropertyName = 'soap/property'
+
+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'
+AttrHref = 'href'
+AttrId = 'id'
+ValueArray = 'Array'
+
+EleEnvelopeName = XSD::QName.new(EnvelopeNamespace, EleEnvelope).freeze
+EleHeaderName = XSD::QName.new(EnvelopeNamespace, EleHeader).freeze
+EleBodyName = XSD::QName.new(EnvelopeNamespace, EleBody).freeze
+EleFaultName = XSD::QName.new(EnvelopeNamespace, EleFault).freeze
+EleFaultStringName = XSD::QName.new(nil, EleFaultString).freeze
+EleFaultActorName = XSD::QName.new(nil, EleFaultActor).freeze
+EleFaultCodeName = XSD::QName.new(nil, EleFaultCode).freeze
+EleFaultDetailName = XSD::QName.new(nil, EleFaultDetail).freeze
+AttrActorName = XSD::QName.new(EnvelopeNamespace, AttrActor).freeze
+AttrMustUnderstandName = XSD::QName.new(EnvelopeNamespace, AttrMustUnderstand).freeze
+AttrEncodingStyleName = XSD::QName.new(EnvelopeNamespace, AttrEncodingStyle).freeze
+AttrRootName = XSD::QName.new(EncodingNamespace, AttrRoot).freeze
+AttrArrayTypeName = XSD::QName.new(EncodingNamespace, AttrArrayType).freeze
+AttrOffsetName = XSD::QName.new(EncodingNamespace, AttrOffset).freeze
+AttrPositionName = XSD::QName.new(EncodingNamespace, AttrPosition).freeze
+AttrHrefName = XSD::QName.new(nil, AttrHref).freeze
+AttrIdName = XSD::QName.new(nil, AttrId).freeze
+ValueArrayName = XSD::QName.new(EncodingNamespace, ValueArray).freeze
+
+Base64Literal = 'base64'
+
+MediaType = 'text/xml'
+
+class Error < StandardError; include NestedException; 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 EmptyResponseError < Error; end
+class ResponseFormatError < Error; end
+
+class UnhandledMustUnderstandHeaderError < Error; end
+
+
+module FaultCode
+ VersionMismatch = XSD::QName.new(EnvelopeNamespace, 'VersionMismatch').freeze
+ MustUnderstand = XSD::QName.new(EnvelopeNamespace, 'MustUnderstand').freeze
+ Client = XSD::QName.new(EnvelopeNamespace, 'Client').freeze
+ Server = XSD::QName.new(EnvelopeNamespace, 'Server').freeze
+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 and @faultstring.respond_to?('data')
+ str = @faultstring.data
+ end
+ str || '(No faultstring)'
+ end
+end
+
+
+module Env
+ def self.getenv(name)
+ ENV[name.downcase] || ENV[name.upcase]
+ end
+
+ is_cgi = !getenv('request_method').nil?
+ HTTP_PROXY = is_cgi ? getenv('cgi_http_proxy') : getenv('http_proxy')
+ NO_PROXY = getenv('no_proxy')
+end
+
+
+end
+
+
+unless Object.respond_to?(:instance_variable_get)
+ class Object
+ def instance_variable_get(ivarname)
+ instance_eval(ivarname)
+ end
+
+ def instance_variable_set(ivarname, value)
+ instance_eval("#{ivarname} = value")
+ end
+ end
+end
+
+
+unless Kernel.respond_to?(:warn)
+ module Kernel
+ def warn(msg)
+ STDERR.puts(msg + "\n") unless $VERBOSE.nil?
+ end
+ end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb
new file mode 100644
index 00000000..6b7e2651
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb
@@ -0,0 +1,301 @@
+# SOAP4R - Stream handler.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/httpconfigloader'
+require 'soap/filter/filterchain'
+begin
+ require 'stringio'
+ require 'zlib'
+rescue LoadError
+ warn("Loading stringio or zlib failed. No gzipped response support.") if $DEBUG
+end
+
+
+module SOAP
+
+
+class StreamHandler
+ RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]"
+
+ attr_reader :filterchain
+
+ class ConnectionData
+ attr_accessor :send_string
+ attr_accessor :send_contenttype
+ attr_accessor :receive_string
+ attr_accessor :receive_contenttype
+ attr_accessor :is_fault
+ attr_accessor :is_nocontent
+ attr_accessor :soapaction
+
+ def initialize(send_string = nil)
+ @send_string = send_string
+ @send_contenttype = nil
+ @receive_string = nil
+ @receive_contenttype = nil
+ @is_fault = false
+ @is_nocontent = false
+ @soapaction = nil
+ end
+ end
+
+ def initialize
+ @filterchain = Filter::FilterChain.new
+ end
+
+ def self.parse_media_type(str)
+ if /^#{ MediaType }(?:\s*;\s*charset=([^"]+|"[^"]+"))?$/i !~ str
+ return nil
+ end
+ charset = $1
+ charset.gsub!(/"/, '') if charset
+ charset || 'us-ascii'
+ end
+
+ def self.create_media_type(charset)
+ "#{ MediaType }; charset=#{ charset }"
+ end
+
+ def send(url, conn_data, soapaction = nil, charset = nil)
+ # send a ConnectionData to specified url.
+ # return value is a ConnectionData with receive_* property filled.
+ # You can fill values of given conn_data and return it.
+ end
+
+ def reset(url = nil)
+ # for initializing connection status if needed.
+ # return value is not expected.
+ end
+
+ def set_wiredump_file_base(wiredump_file_base)
+ # for logging. return value is not expected.
+ # Override it when you want.
+ raise NotImplementedError
+ end
+
+ def test_loopback_response
+ # for loopback testing. see HTTPStreamHandler for more detail.
+ # return value is an Array of loopback responses.
+ # Override it when you want.
+ raise NotImplementedError
+ end
+end
+
+
+class HTTPStreamHandler < StreamHandler
+ include SOAP
+
+ begin
+ require 'httpclient'
+ Client = HTTPClient
+ RETRYABLE = true
+ rescue LoadError
+ begin
+ require 'http-access2'
+ if HTTPAccess2::VERSION < "2.0"
+ raise LoadError.new("http-access/2.0 or later is required.")
+ end
+ Client = HTTPAccess2::Client
+ RETRYABLE = true
+ rescue LoadError
+ warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
+ require 'soap/netHttpClient'
+ Client = SOAP::NetHttpClient
+ RETRYABLE = false
+ end
+ end
+
+ class HttpPostRequestFilter
+ def initialize(filterchain)
+ @filterchain = filterchain
+ end
+
+ def filter_request(req)
+ @filterchain.each do |filter|
+ filter.on_http_outbound(req)
+ end
+ end
+
+ def filter_response(req, res)
+ @filterchain.each do |filter|
+ filter.on_http_inbound(req, res)
+ end
+ end
+ end
+
+public
+
+ attr_reader :client
+ attr_accessor :wiredump_file_base
+
+ MAX_RETRY_COUNT = 10 # [times]
+
+ def self.create(options)
+ new(options)
+ end
+
+ def initialize(options)
+ super()
+ @client = Client.new(nil, "SOAP4R/#{ Version }")
+ if @client.respond_to?(:request_filter)
+ @client.request_filter << HttpPostRequestFilter.new(@filterchain)
+ end
+ @wiredump_file_base = nil
+ @charset = @wiredump_dev = nil
+ @options = options
+ set_options
+ @client.debug_dev = @wiredump_dev
+ @cookie_store = nil
+ @accept_encoding_gzip = false
+ end
+
+ def test_loopback_response
+ @client.test_loopback_response
+ end
+
+ def accept_encoding_gzip=(allow)
+ @accept_encoding_gzip = allow
+ end
+
+ def inspect
+ "#<#{self.class}>"
+ end
+
+ def send(url, conn_data, charset = @charset)
+ conn_data = send_post(url, conn_data, charset)
+ @client.save_cookie_store if @cookie_store
+ conn_data
+ end
+
+ def reset(url = nil)
+ if url.nil?
+ @client.reset_all
+ else
+ @client.reset(url)
+ end
+ @client.save_cookie_store if @cookie_store
+ end
+
+private
+
+ def set_options
+ @options["http"] ||= ::SOAP::Property.new
+ HTTPConfigLoader.set_options(@client, @options["http"])
+ @charset = @options["http.charset"] || XSD::Charset.xml_encoding_label
+ @options.add_hook("http.charset") do |key, value|
+ @charset = value
+ end
+ @wiredump_dev = @options["http.wiredump_dev"]
+ @options.add_hook("http.wiredump_dev") do |key, value|
+ @wiredump_dev = value
+ @client.debug_dev = @wiredump_dev
+ end
+ set_cookie_store_file(@options["http.cookie_store_file"])
+ @options.add_hook("http.cookie_store_file") do |key, value|
+ set_cookie_store_file(value)
+ end
+ ssl_config = @options["http.ssl_config"]
+ basic_auth = @options["http.basic_auth"]
+ auth = @options["http.auth"]
+ @options["http"].lock(true)
+ ssl_config.unlock
+ basic_auth.unlock
+ auth.unlock
+ end
+
+ def set_cookie_store_file(value)
+ value = nil if value and value.empty?
+ @cookie_store = value
+ @client.set_cookie_store(@cookie_store) if @cookie_store
+ end
+
+ def send_post(url, conn_data, charset)
+ conn_data.send_contenttype ||= StreamHandler.create_media_type(charset)
+
+ if @wiredump_file_base
+ filename = @wiredump_file_base + '_request.xml'
+ f = File.open(filename, "w")
+ f << conn_data.send_string
+ f.close
+ end
+
+ extheader = {}
+ extheader['Content-Type'] = conn_data.send_contenttype
+ extheader['SOAPAction'] = "\"#{ conn_data.soapaction }\""
+ extheader['Accept-Encoding'] = 'gzip' if send_accept_encoding_gzip?
+ send_string = conn_data.send_string
+ @wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
+ begin
+ retry_count = 0
+ while true
+ res = @client.post(url, send_string, extheader)
+ if RETRYABLE and HTTP::Status.redirect?(res.status)
+ retry_count += 1
+ if retry_count >= MAX_RETRY_COUNT
+ raise HTTPStreamError.new("redirect count exceeded")
+ end
+ url = res.header["location"][0]
+ puts "redirected to #{url}" if $DEBUG
+ else
+ break
+ end
+ end
+ rescue
+ @client.reset(url)
+ raise
+ end
+ @wiredump_dev << "\n\n" if @wiredump_dev
+ receive_string = res.content
+ if @wiredump_file_base
+ filename = @wiredump_file_base + '_response.xml'
+ f = File.open(filename, "w")
+ f << receive_string
+ f.close
+ end
+ case res.status
+ when 405
+ raise PostUnavailableError.new("#{ res.status }: #{ res.reason }")
+ when 200, 202, 500
+ # Nothing to do. 202 is for oneway service.
+ else
+ raise HTTPStreamError.new("#{ res.status }: #{ res.reason }")
+ end
+
+ # decode gzipped content, if we know it's there from the headers
+ if res.respond_to?(:header) and !res.header['content-encoding'].empty? and
+ res.header['content-encoding'][0].downcase == 'gzip'
+ receive_string = decode_gzip(receive_string)
+ # otherwise check for the gzip header
+ elsif @accept_encoding_gzip && receive_string[0..1] == "\x1f\x8b"
+ receive_string = decode_gzip(receive_string)
+ end
+ conn_data.receive_string = receive_string
+ conn_data.receive_contenttype = res.contenttype
+ conn_data
+ end
+
+ def send_accept_encoding_gzip?
+ @accept_encoding_gzip and defined?(::Zlib)
+ end
+
+ def decode_gzip(instring)
+ unless send_accept_encoding_gzip?
+ raise HTTPStreamError.new("Gzipped response content.")
+ end
+ begin
+ gz = Zlib::GzipReader.new(StringIO.new(instring))
+ gz.read
+ ensure
+ gz.close
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb
new file mode 100644
index 00000000..1c4334a3
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb
@@ -0,0 +1,164 @@
+# SOAP4R - SOAP WSDL driver
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/ruby18ext'
+require 'wsdl/parser'
+require 'wsdl/importer'
+require 'xsd/qname'
+require 'xsd/codegen/gensupport'
+require 'soap/attrproxy'
+require 'soap/mapping/wsdlencodedregistry'
+require 'soap/mapping/wsdlliteralregistry'
+require 'soap/rpc/driver'
+require 'wsdl/soap/methodDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'wsdl/soap/classNameCreator'
+
+
+module SOAP
+
+
+class WSDLDriverFactory
+ include WSDL::SOAP::ClassDefCreatorSupport
+
+ class FactoryError < StandardError; end
+
+ attr_reader :wsdl
+
+ def initialize(wsdl)
+ @wsdl = import(wsdl)
+ end
+
+ def inspect
+ sprintf("#<%s:%s:0x%x\n\n%s>", self.class.name, @wsdl.name, __id__, dump_method_signatures)
+ end
+
+ def create_rpc_driver(servicename = nil, portname = nil)
+ port = find_port(servicename, portname)
+ drv = SOAP::RPC::Driver.new(port.soap_address.location)
+ if binding = port.find_binding
+ init_driver(drv, binding)
+ add_operation(drv, binding)
+ end
+ drv
+ end
+
+ def dump_method_signatures(servicename = nil, portname = nil)
+ targetservice = XSD::QName.new(@wsdl.targetnamespace, servicename) if servicename
+ targetport = XSD::QName.new(@wsdl.targetnamespace, portname) if portname
+ sig = []
+ element_definitions = @wsdl.collect_elements
+ @wsdl.services.each do |service|
+ next if targetservice and service.name != targetservice
+ service.ports.each do |port|
+ next if targetport and port.name != targetport
+ if porttype = port.porttype
+ assigned_method = collect_assigned_method(porttype.name)
+ if binding = port.porttype.find_binding
+ sig << binding.operations.collect { |op_bind|
+ operation = op_bind.find_operation
+ name = assigned_method[op_bind.boundid] || op_bind.name
+ str = "= #{safemethodname(name)}\n\n"
+ str << dump_method_signature(name, operation, element_definitions)
+ str.gsub(/^#/, " ")
+ }.join("\n")
+ end
+ end
+ end
+ end
+ sig.join("\n")
+ end
+
+private
+
+ def collect_assigned_method(porttypename)
+ name_creator = WSDL::SOAP::ClassNameCreator.new
+ methoddefcreator =
+ WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, nil, {})
+ methoddefcreator.dump(porttypename)
+ methoddefcreator.assigned_method
+ end
+
+ def find_port(servicename = nil, portname = nil)
+ service = port = nil
+ if servicename
+ service = @wsdl.service(
+ XSD::QName.new(@wsdl.targetnamespace, servicename))
+ else
+ service = @wsdl.services[0]
+ end
+ if service.nil?
+ raise FactoryError.new("service #{servicename} not found in WSDL")
+ end
+ if portname
+ port = service.ports[XSD::QName.new(@wsdl.targetnamespace, portname)]
+ if port.nil?
+ raise FactoryError.new("port #{portname} not found in WSDL")
+ end
+ else
+ port = service.ports.find { |port| !port.soap_address.nil? }
+ if port.nil?
+ raise FactoryError.new("no ports have soap:address")
+ end
+ end
+ if port.soap_address.nil?
+ raise FactoryError.new("soap:address element not found in WSDL")
+ end
+ port
+ end
+
+ def init_driver(drv, binding)
+ wsdl_elements = @wsdl.collect_elements
+ wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
+ rpc_decode_typemap = wsdl_types +
+ @wsdl.soap_rpc_complextypes(binding)
+ drv.proxy.mapping_registry =
+ Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap)
+ drv.proxy.literal_mapping_registry =
+ Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements)
+ end
+
+ def add_operation(drv, binding)
+ name_creator = WSDL::SOAP::ClassNameCreator.new
+ modulepath = 'WSDLDriverFactory'
+ methoddefcreator =
+ WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, modulepath, {})
+ mdefs = methoddefcreator.create(binding.name)
+ if mdefs.nil?
+ raise FactoryError.new("no method definition found in WSDL")
+ end
+ mdefs.each do |mdef|
+ opt = {
+ :request_style => mdef.style,
+ :response_style => mdef.style,
+ :request_use => mdef.inputuse,
+ :response_use => mdef.outputuse
+ }
+ qname = mdef.qname
+ soapaction = mdef.soapaction
+ name = mdef.name
+ if mdef.style == :rpc
+ drv.add_rpc_operation(qname, soapaction, name, mdef.parameters, opt)
+ else
+ drv.add_document_operation(soapaction, name, mdef.parameters, opt)
+ end
+ orgname = mdef.qname.name
+ if orgname != name and orgname.capitalize == name.capitalize
+ ::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg|
+ __send__(name, *arg)
+ end
+ end
+ end
+ end
+
+ def import(location)
+ WSDL::Importer.import(location)
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/binding.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/binding.rb
new file mode 100644
index 00000000..48477be6
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/binding.rb
@@ -0,0 +1,65 @@
+# WSDL4R - WSDL binding definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+
+
+class Binding < Info
+ attr_reader :name # required
+ attr_reader :type # required
+ attr_reader :operations
+ attr_reader :soapbinding
+
+ def initialize
+ super
+ @name = nil
+ @type = nil
+ @operations = XSD::NamedElements.new
+ @soapbinding = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when OperationName
+ o = OperationBinding.new
+ @operations << o
+ o
+ when SOAPBindingName
+ o = WSDL::SOAP::Binding.new
+ @soapbinding = o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when TypeAttrName
+ @type = value
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb
new file mode 100644
index 00000000..f645acbc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb
@@ -0,0 +1,64 @@
+# WSDL4R - WSDL data definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'wsdl/documentation'
+require 'wsdl/definitions'
+require 'wsdl/types'
+require 'wsdl/message'
+require 'wsdl/part'
+require 'wsdl/portType'
+require 'wsdl/operation'
+require 'wsdl/param'
+require 'wsdl/binding'
+require 'wsdl/operationBinding'
+require 'wsdl/service'
+require 'wsdl/port'
+require 'wsdl/import'
+
+
+module WSDL
+
+
+ArrayTypeAttrName = XSD::QName.new(Namespace, 'arrayType')
+BindingName = XSD::QName.new(Namespace, 'binding')
+DefinitionsName = XSD::QName.new(Namespace, 'definitions')
+DocumentationName = XSD::QName.new(Namespace, 'documentation')
+FaultName = XSD::QName.new(Namespace, 'fault')
+ImportName = XSD::QName.new(Namespace, 'import')
+InputName = XSD::QName.new(Namespace, 'input')
+MessageName = XSD::QName.new(Namespace, 'message')
+OperationName = XSD::QName.new(Namespace, 'operation')
+OutputName = XSD::QName.new(Namespace, 'output')
+PartName = XSD::QName.new(Namespace, 'part')
+PortName = XSD::QName.new(Namespace, 'port')
+PortTypeName = XSD::QName.new(Namespace, 'portType')
+ServiceName = XSD::QName.new(Namespace, 'service')
+TypesName = XSD::QName.new(Namespace, 'types')
+
+SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
+
+SOAPAddressName = XSD::QName.new(SOAPBindingNamespace, 'address')
+SOAPBindingName = XSD::QName.new(SOAPBindingNamespace, 'binding')
+SOAPHeaderName = XSD::QName.new(SOAPBindingNamespace, 'header')
+SOAPBodyName = XSD::QName.new(SOAPBindingNamespace, 'body')
+SOAPFaultName = XSD::QName.new(SOAPBindingNamespace, 'fault')
+SOAPOperationName = XSD::QName.new(SOAPBindingNamespace, 'operation')
+
+BindingAttrName = XSD::QName.new(nil, 'binding')
+ElementAttrName = XSD::QName.new(nil, 'element')
+LocationAttrName = XSD::QName.new(nil, 'location')
+MessageAttrName = XSD::QName.new(nil, 'message')
+NameAttrName = XSD::QName.new(nil, 'name')
+NamespaceAttrName = XSD::QName.new(nil, 'namespace')
+ParameterOrderAttrName = XSD::QName.new(nil, 'parameterOrder')
+TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace')
+TypeAttrName = XSD::QName.new(nil, 'type')
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb
new file mode 100644
index 00000000..2e76e0d0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb
@@ -0,0 +1,236 @@
+# WSDL4R - WSDL definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+
+
+class Definitions < Info
+ attr_reader :name
+ attr_reader :targetnamespace
+ attr_reader :imports
+
+ attr_accessor :location
+ attr_reader :importedschema
+
+ def initialize
+ super
+ @name = nil
+ @targetnamespace = nil
+ @location = nil
+ @importedschema = {}
+
+ @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
+
+ def inspect
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, @name || '(unnamed)')
+ end
+
+ def targetnamespace=(targetnamespace)
+ @targetnamespace = targetnamespace
+ if @name
+ @name = XSD::QName.new(@targetnamespace, @name.name)
+ end
+ end
+
+ def collect_attributes
+ collect_imports(:collect_attributes)
+ end
+
+ def collect_modelgroups
+ collect_imports(:collect_modelgroups)
+ end
+
+ def collect_attributegroups
+ collect_imports(:collect_attributegroups)
+ end
+
+ def collect_elements
+ collect_imports(:collect_elements)
+ end
+
+ def collect_complextypes
+ result = collect_imports(:collect_complextypes)
+ @anontypes.dup.concat(result)
+ end
+
+ def collect_simpletypes
+ collect_imports(:collect_simpletypes)
+ end
+
+ # ToDo: simpletype must be accepted...
+ def add_type(complextype)
+ @anontypes << complextype
+ end
+
+ def messages
+ result = @messages.dup
+ @imports.each do |import|
+ result.concat(import.content.messages) if self.class === import.content
+ end
+ result
+ end
+
+ def porttypes
+ result = @porttypes.dup
+ @imports.each do |import|
+ result.concat(import.content.porttypes) if self.class === import.content
+ end
+ result
+ end
+
+ def bindings
+ result = @bindings.dup
+ @imports.each do |import|
+ result.concat(import.content.bindings) if self.class === import.content
+ end
+ result
+ end
+
+ def services
+ result = @services.dup
+ @imports.each do |import|
+ result.concat(import.content.services) if self.class === import.content
+ end
+ result
+ end
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
+ 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
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when TargetNamespaceAttrName
+ self.targetnamespace = value.source
+ else
+ nil
+ end
+ end
+
+ def self.parse_element(element)
+ if element == DefinitionsName
+ Definitions.new
+ else
+ nil
+ end
+ end
+
+private
+
+ def collect_imports(method)
+ result = XSD::NamedElements.new
+ if @types
+ @types.schemas.each do |schema|
+ result.concat(schema.send(method))
+ end
+ end
+ @imports.each do |import|
+ result.concat(import.content.send(method))
+ end
+ result
+ end
+
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb
new file mode 100644
index 00000000..0cbf8f80
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb
@@ -0,0 +1,32 @@
+# WSDL4R - WSDL SOAP documentation element.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Documentation < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ # Accepts any element.
+ self
+ end
+
+ def parse_attr(attr, value)
+ # Accepts any attribute.
+ true
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb
new file mode 100644
index 00000000..c1f262cc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb
@@ -0,0 +1,80 @@
+# WSDL4R - WSDL import definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/importer'
+
+
+module WSDL
+
+
+class Import < Info
+ attr_reader :namespace
+ attr_reader :location
+ attr_reader :content
+
+ def initialize
+ super
+ @namespace = nil
+ @location = nil
+ @content = nil
+ @web_client = nil
+ end
+
+ def parse_element(element)
+ case element
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NamespaceAttrName
+ @namespace = value.source
+ if @content
+ @content.targetnamespace = @namespace
+ end
+ @namespace
+ when LocationAttrName
+ @location = URI.parse(value.source)
+ if @location.relative? and !parent.location.nil? and
+ !parent.location.relative?
+ @location = parent.location + @location
+ end
+ if root.importedschema.key?(@location)
+ @content = root.importedschema[@location]
+ else
+ root.importedschema[@location] = nil # placeholder
+ @content = import(@location)
+ if @content.is_a?(Definitions)
+ @content.root = root
+ if @namespace
+ @content.targetnamespace = @namespace
+ end
+ end
+ root.importedschema[@location] = @content
+ end
+ @location
+ else
+ nil
+ end
+ end
+
+private
+
+ def import(location)
+ Importer.import(location, root)
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb
new file mode 100644
index 00000000..0fe72989
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb
@@ -0,0 +1,38 @@
+# WSDL4R - WSDL importer library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/importer'
+require 'wsdl/parser'
+
+
+module WSDL
+
+
+class Importer < WSDL::XMLSchema::Importer
+ def self.import(location, originalroot = nil)
+ new.import(location, originalroot)
+ end
+
+private
+
+ def parse(content, location, originalroot)
+ opt = {
+ :location => location,
+ :originalroot => originalroot
+ }
+ begin
+ WSDL::Parser.new(opt).parse(content)
+ rescue WSDL::Parser::ParseError
+ super(content, location, originalroot)
+ end
+ end
+
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb
new file mode 100644
index 00000000..9c708afa
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb
@@ -0,0 +1,50 @@
+# WSDL4R - WSDL information base.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module WSDL
+
+
+class Info
+ attr_accessor :root
+ attr_accessor :parent
+ attr_accessor :id
+
+ def initialize
+ @root = nil
+ @parent = nil
+ @id = nil
+ end
+
+ def inspect
+ if self.respond_to?(:name)
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.name)
+ else
+ sprintf("#<%s:0x%x>", self.class.name, __id__)
+ end
+ end
+
+ def parse_element(element); end # abstract
+
+ def parse_attr(attr, value); end # abstract
+
+ def parse_epilogue; end # abstract
+
+private
+
+ def to_int(value)
+ Integer(value.source)
+ end
+
+ def to_boolean(value)
+ s = value.source
+ s == "true" or s == "1"
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb
new file mode 100644
index 00000000..d5aa1a5d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb
@@ -0,0 +1,54 @@
+# WSDL4R - WSDL message definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Message < Info
+ attr_reader :name # required
+ attr_reader :parts
+
+ def initialize
+ super
+ @name = nil
+ @parts = []
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when PartName
+ o = Part.new
+ @parts << o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(parent.targetnamespace, value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb
new file mode 100644
index 00000000..9e0d8ca2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb
@@ -0,0 +1,151 @@
+# WSDL4R - WSDL operation definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Operation < Info
+ attr_reader :name # required
+ attr_reader :parameter_order # optional
+ attr_reader :input
+ attr_reader :output
+ attr_reader :fault
+ attr_reader :type # required
+
+ def initialize
+ super
+ @name = nil
+ @type = nil
+ @parameter_order = nil
+ @input = nil
+ @output = nil
+ @fault = []
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def operationname
+ as_operationname(@name)
+ end
+
+ EMPTY = [].freeze
+ # TODO: remove once after OperationInfo created
+ def inputparts
+ if message = input_message
+ sort_parts(message.parts)
+ else
+ EMPTY
+ end
+ end
+
+ def inputname
+ if input
+ as_operationname(input.name ? input.name.name : @name)
+ else
+ nil
+ end
+ end
+
+ # TODO: remove once after OperationInfo created
+ def outputparts
+ if message = output_message
+ sort_parts(message.parts)
+ else
+ EMPTY
+ end
+ end
+
+ def outputname
+ if output
+ as_operationname(output.name ? output.name.name : @name + 'Response')
+ else
+ nil
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when InputName
+ o = Param.new
+ @input = o
+ o
+ when OutputName
+ o = Param.new
+ @output = o
+ o
+ when FaultName
+ o = Param.new
+ @fault << o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = value.source
+ when TypeAttrName
+ @type = value
+ when ParameterOrderAttrName
+ @parameter_order = value.source.split(/\s+/)
+ else
+ nil
+ end
+ end
+
+private
+
+ def input_message
+ if input and message = input.find_message
+ message
+ else
+ nil
+ end
+ end
+
+ def output_message
+ if output and message = output.find_message
+ message
+ else
+ nil
+ end
+ end
+
+ def sort_parts(parts)
+ return parts.dup unless parameter_order
+ result = []
+ parameter_order.each do |orderitem|
+ if (ele = parts.find { |part| part.name == orderitem })
+ result << ele
+ end
+ end
+ if result.length == 0
+ return parts.dup
+ end
+ # result length can be shorter than parts's.
+ # return part must not be a part of the parameterOrder.
+ result
+ end
+
+ def as_operationname(name)
+ XSD::QName.new(targetnamespace, name)
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb
new file mode 100644
index 00000000..c1ecf42c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb
@@ -0,0 +1,240 @@
+# WSDL4R - WSDL bound operation definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class OperationBinding < Info
+ attr_reader :name # required
+ attr_reader :input
+ attr_reader :output
+ attr_reader :fault
+ attr_reader :soapoperation
+
+ class OperationInfo
+ attr_reader :boundid
+ attr_reader :qname
+ attr_reader :style
+ attr_accessor :inputuse
+ attr_accessor :outputuse
+ attr_reader :parts
+ attr_reader :faults
+
+ def initialize(boundid, qname, style, inputuse, outputuse)
+ @boundid = boundid
+ @qname = qname
+ @style = style
+ @inputuse = inputuse
+ @outputuse = outputuse
+ @parts = []
+ @faults = {}
+ end
+ end
+
+ class Part
+ attr_reader :io_type
+ attr_reader :name
+ attr_reader :type
+ attr_reader :element
+
+ def initialize(io_type, name, type, element)
+ @io_type = io_type
+ @name = name
+ @type = type
+ @element = element
+ end
+ end
+
+ class BoundId
+ attr_reader :name
+ attr_reader :soapaction
+
+ def initialize(name, soapaction)
+ @name = name
+ @soapaction = soapaction
+ end
+
+ def ==(rhs)
+ !rhs.nil? and @name == rhs.name and @soapaction == rhs.soapaction
+ end
+
+ def eql?(rhs)
+ (self == rhs)
+ end
+
+ def hash
+ @name.hash ^ @soapaction.hash
+ end
+ end
+
+ def initialize
+ super
+ @name = nil
+ @input = nil
+ @output = nil
+ @fault = []
+ @soapoperation = nil
+ end
+
+ def operation_info
+ qname = soapoperation_name()
+ style = soapoperation_style()
+ use_input = soapbody_use(@input)
+ use_output = soapbody_use(@output)
+ info = OperationInfo.new(boundid, qname, style, use_input, use_output)
+ op = find_operation()
+ if style == :rpc
+ info.parts.concat(collect_rpcparameter(op))
+ else
+ info.parts.concat(collect_documentparameter(op))
+ end
+ @fault.each do |fault|
+ op_fault = {}
+ soapfault = fault.soapfault
+ next if soapfault.nil?
+ op_fault[:ns] = fault.name.namespace
+ op_fault[:name] = fault.name.name
+ op_fault[:namespace] = soapfault.namespace
+ op_fault[:use] = soapfault.use || "literal"
+ op_fault[:encodingstyle] = soapfault.encodingstyle || "document"
+ info.faults[fault.name] = op_fault
+ end
+ info
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def porttype
+ root.porttype(parent.type)
+ end
+
+ def boundid
+ BoundId.new(name, soapaction)
+ end
+
+ def find_operation
+ porttype.operations.each do |op|
+ next if op.name != @name
+ next if op.input and @input and op.input.name and @input.name and
+ op.input.name != @input.name
+ next if op.output and @output and op.output.name and @output.name and
+ op.output.name != @output.name
+ return op
+ end
+ raise RuntimeError.new("#{@name} not found")
+ end
+
+ def soapoperation_name
+ op_name = find_operation.operationname
+ if @input and @input.soapbody and @input.soapbody.namespace
+ op_name = XSD::QName.new(@input.soapbody.namespace, op_name.name)
+ end
+ op_name
+ end
+
+ def soapoperation_style
+ style = nil
+ if @soapoperation
+ style = @soapoperation.operation_style
+ elsif parent.soapbinding
+ style = parent.soapbinding.style
+ else
+ raise TypeError.new("operation style definition not found")
+ end
+ style || :document
+ end
+
+ def soapaction
+ if @soapoperation
+ @soapoperation.soapaction
+ else
+ nil
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when InputName
+ o = Param.new
+ @input = o
+ o
+ when OutputName
+ o = Param.new
+ @output = o
+ o
+ when FaultName
+ o = Param.new
+ @fault << o
+ o
+ when SOAPOperationName
+ o = WSDL::SOAP::Operation.new
+ @soapoperation = o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = value.source
+ else
+ nil
+ end
+ end
+
+private
+
+ def soapbody_use(param)
+ param ? param.soapbody_use : nil
+ end
+
+ def collect_rpcparameter(operation)
+ result = operation.inputparts.collect { |part|
+ Part.new(:in, part.name, part.type, part.element)
+ }
+ outparts = operation.outputparts
+ if outparts.size > 0
+ retval = outparts[0]
+ result << Part.new(:retval, retval.name, retval.type, retval.element)
+ cdr(outparts).each { |part|
+ result << Part.new(:out, part.name, part.type, part.element)
+ }
+ end
+ result
+ end
+
+ def collect_documentparameter(operation)
+ param = []
+ operation.inputparts.each do |input|
+ param << Part.new(:in, input.name, input.type, input.element)
+ end
+ operation.outputparts.each do |output|
+ param << Part.new(:out, output.name, output.type, output.element)
+ end
+ param
+ end
+
+ def cdr(ary)
+ result = ary.dup
+ result.shift
+ result
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb
new file mode 100644
index 00000000..f36e1d1b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb
@@ -0,0 +1,93 @@
+# WSDL4R - WSDL param definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Param < Info
+ attr_reader :message # required
+ attr_reader :name # optional but required for fault.
+ attr_reader :soapbody
+ attr_reader :soapheader
+ attr_reader :soapfault
+
+ def initialize
+ super
+ @message = nil
+ @name = nil
+ @soapbody = nil
+ @soapheader = []
+ @soapfault = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def find_message
+ root.message(@message) or raise RuntimeError.new("#{@message} not found")
+ end
+
+ def soapbody_use
+ if @soapbody
+ @soapbody.use || :literal
+ else
+ nil
+ end
+ end
+
+ def soapbody_encodingstyle
+ if @soapbody
+ @soapbody.encodingstyle
+ else
+ nil
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when SOAPBodyName
+ o = WSDL::SOAP::Body.new
+ @soapbody = o
+ o
+ when SOAPHeaderName
+ o = WSDL::SOAP::Header.new
+ @soapheader << o
+ o
+ when SOAPFaultName
+ o = WSDL::SOAP::Fault.new
+ @soapfault = o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MessageAttrName
+ if value.namespace.nil?
+ value = XSD::QName.new(targetnamespace, value.source)
+ end
+ @message = value
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb
new file mode 100644
index 00000000..f30fe3e3
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb
@@ -0,0 +1,164 @@
+# WSDL4R - WSDL XML Instance parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'xsd/charset'
+require 'xsd/datatypes'
+require 'xsd/xmlparser'
+require 'soap/ns'
+require 'wsdl/wsdl'
+require 'wsdl/data'
+require 'wsdl/xmlSchema/data'
+require 'wsdl/soap/data'
+
+
+module WSDL
+
+
+class Parser
+ include WSDL
+
+ class ParseError < Error; end
+ class FormatDecodeError < ParseError; end
+ class UnknownElementError < FormatDecodeError; end
+ class UnknownAttributeError < FormatDecodeError; end
+ class UnexpectedElementError < FormatDecodeError; end
+ class ElementConstraintError < FormatDecodeError; end
+ class AttributeConstraintError < FormatDecodeError; end
+
+private
+
+ class ParseFrame
+ attr_reader :ns
+ attr_reader :name
+ attr_accessor :node
+
+ private
+
+ def initialize(ns, name, node)
+ @ns = ns
+ @name = name
+ @node = node
+ end
+ end
+
+public
+
+ def initialize(opt = {})
+ @parser = XSD::XMLParser.create_parser(self, opt)
+ @parsestack = nil
+ @lastnode = nil
+ @ignored = {}
+ @location = opt[:location]
+ @originalroot = opt[:originalroot]
+ end
+
+ def parse(string_or_readable)
+ @parsestack = []
+ @lastnode = nil
+ @textbuf = ''
+ @parser.do_parse(string_or_readable)
+ @lastnode
+ end
+
+ def charset
+ @parser.charset
+ end
+
+ def start_element(name, attrs)
+ lastframe = @parsestack.last
+ ns = parent = nil
+ if lastframe
+ ns = lastframe.ns
+ parent = lastframe.node
+ else
+ ns = ::SOAP::NS.new
+ parent = nil
+ end
+ # ns might be the same
+ ns, attrs = XSD::XMLParser.filter_ns(ns, attrs)
+ node = decode_tag(ns, name, attrs, parent)
+ @parsestack << ParseFrame.new(ns, name, node)
+ end
+
+ def characters(text)
+ lastframe = @parsestack.last
+ if lastframe
+ # Need not to be cloned because character does not have attr.
+ ns = lastframe.ns
+ decode_text(ns, text)
+ else
+ p text if $DEBUG
+ end
+ end
+
+ def end_element(name)
+ lastframe = @parsestack.pop
+ unless name == lastframe.name
+ raise UnexpectedElementError.new("closing element name '#{name}' does not match with opening element '#{lastframe.name}'")
+ end
+ decode_tag_end(lastframe.ns, lastframe.node)
+ @lastnode = lastframe.node
+ end
+
+private
+
+ def decode_tag(ns, name, attrs, parent)
+ o = nil
+ elename = ns.parse(name)
+ if !parent
+ if elename == DefinitionsName
+ o = Definitions.parse_element(elename)
+ o.location = @location
+ else
+ raise UnknownElementError.new("unknown element: #{elename}")
+ end
+ o.root = @originalroot if @originalroot # o.root = o otherwise
+ else
+ if elename == XMLSchema::AnnotationName
+ # only the first annotation element is allowed for each xsd element.
+ o = XMLSchema::Annotation.new
+ else
+ o = parent.parse_element(elename)
+ end
+ if o.nil?
+ unless @ignored.key?(elename)
+ warn("ignored element: #{elename} : #{parent.inspect}")
+ @ignored[elename] = elename
+ end
+ o = Documentation.new # which accepts any element.
+ end
+ # node could be a pseudo element. pseudo element has its own parent.
+ o.root = parent.root
+ o.parent = parent if o.parent.nil?
+ end
+ attrs.each do |key, value|
+ attr_ele = ns.parse(key, true)
+ value_ele = ns.parse(value, false)
+ value_ele.source = value # for recovery; value may not be a QName
+ if o.parse_attr(attr_ele, value_ele).nil?
+ unless @ignored.key?(attr_ele)
+ warn("ignored attr: #{attr_ele}")
+ @ignored[attr_ele] = attr_ele
+ end
+ end
+ end
+ o
+ end
+
+ def decode_tag_end(ns, node)
+ node.parse_epilogue
+ end
+
+ def decode_text(ns, text)
+ @textbuf << text
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb
new file mode 100644
index 00000000..a52e6c38
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb
@@ -0,0 +1,52 @@
+# WSDL4R - WSDL part definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Part < Info
+ attr_reader :name # required
+ attr_reader :element # optional
+ attr_reader :type # optional
+
+ def initialize
+ super
+ @name = nil
+ @element = nil
+ @type = nil
+ end
+
+ def parse_element(element)
+ case element
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = value.source
+ when ElementAttrName
+ @element = value
+ when TypeAttrName
+ @type = value
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb
new file mode 100644
index 00000000..8fb7f1f1
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb
@@ -0,0 +1,66 @@
+# WSDL4R - WSDL port definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Port < Info
+ attr_reader :name # required
+ attr_reader :binding # required
+ attr_reader :soap_address
+
+ def initialize
+ super
+ @name = nil
+ @binding = nil
+ @soap_address = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def porttype
+ root.porttype(find_binding.type)
+ end
+
+ def find_binding
+ root.binding(@binding) or raise RuntimeError.new("#{@binding} not found")
+ end
+
+ def parse_element(element)
+ case element
+ when SOAPAddressName
+ o = WSDL::SOAP::Address.new
+ @soap_address = o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when BindingAttrName
+ @binding = value
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb
new file mode 100644
index 00000000..26269f21
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb
@@ -0,0 +1,75 @@
+# WSDL4R - WSDL portType definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+
+
+class PortType < Info
+ attr_reader :name # required
+ attr_reader :operations
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def initialize
+ super
+ @name = nil
+ @operations = XSD::NamedElements.new
+ end
+
+ # may be nil if not defined
+ def find_binding
+ root.bindings.find { |item| item.type == @name }
+ end
+
+ def locations
+ binding = find_binding
+ return [] if binding.nil?
+ bind_name = binding.name
+ result = []
+ root.services.each do |service|
+ service.ports.each do |port|
+ if port.binding == bind_name
+ result << port.soap_address.location if port.soap_address
+ end
+ end
+ end
+ result
+ end
+
+ def parse_element(element)
+ case element
+ when OperationName
+ o = Operation.new
+ @operations << o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb
new file mode 100644
index 00000000..1efbd591
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb
@@ -0,0 +1,61 @@
+# WSDL4R - WSDL service definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+
+
+class Service < Info
+ attr_reader :name # required
+ attr_reader :ports
+ attr_reader :soap_address
+
+ def initialize
+ super
+ @name = nil
+ @ports = XSD::NamedElements.new
+ @soap_address = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when PortName
+ o = Port.new
+ @ports << o
+ o
+ when SOAPAddressName
+ o = WSDL::SOAP::Address.new
+ @soap_address = o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb
new file mode 100644
index 00000000..fc03aa23
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb
@@ -0,0 +1,40 @@
+# WSDL4R - WSDL SOAP address definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Address < Info
+ attr_reader :location
+
+ def initialize
+ super
+ @location = nil
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when LocationAttrName
+ @location = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb
new file mode 100644
index 00000000..3b840c41
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb
@@ -0,0 +1,49 @@
+# WSDL4R - WSDL SOAP binding definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Binding < Info
+ attr_reader :style
+ attr_reader :transport
+
+ def initialize
+ super
+ @style = nil
+ @transport = nil
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when StyleAttrName
+ if ["document", "rpc"].include?(value.source)
+ @style = value.source.intern
+ else
+ raise Parser::AttributeConstraintError.new(
+ "Unexpected value #{ value }.")
+ end
+ when TransportAttrName
+ @transport = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb
new file mode 100644
index 00000000..b2392d78
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb
@@ -0,0 +1,58 @@
+# WSDL4R - WSDL SOAP body definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Body < Info
+ attr_reader :parts
+ attr_reader :use # required
+ attr_reader :encodingstyle
+ attr_reader :namespace
+
+ def initialize
+ super
+ @parts = nil
+ @use = nil
+ @encodingstyle = nil
+ @namespace = nil
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when PartsAttrName
+ @parts = value.source
+ when UseAttrName
+ if ['literal', 'encoded'].include?(value.source)
+ @use = value.source.intern
+ else
+ raise RuntimeError.new("unknown use of soap:body: #{value.source}")
+ end
+ when EncodingStyleAttrName
+ @encodingstyle = value.source
+ @encodingstyle = nil if @encodingstyle.to_s.empty?
+ value.source
+ when NamespaceAttrName
+ @namespace = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb
new file mode 100644
index 00000000..9b732780
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb
@@ -0,0 +1,92 @@
+# WSDL4R - Creating CGI stub code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreator'
+require 'wsdl/soap/methodDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class CGIStubCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump(service_name)
+ warn("CGI stub can have only 1 port. Creating stub for the first port... Rests are ignored.")
+ services = @definitions.service(service_name)
+ unless services
+ raise RuntimeError.new("service not defined: #{service_name}")
+ end
+ ports = services.ports
+ if ports.empty?
+ raise RuntimeError.new("ports not found for #{service_name}")
+ end
+ port = ports[0]
+ if port.porttype.nil?
+ raise RuntimeError.new("porttype not found for #{port}")
+ end
+ dump_porttype(port.porttype)
+ end
+
+private
+
+ def dump_porttype(porttype)
+ class_name = mapped_class_name(porttype.name, @modulepath)
+ defined_const = {}
+ methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
+ wsdl_name = @definitions.name ? @definitions.name.name : 'default'
+ mrname = safeconstname(wsdl_name + 'MappingRegistry')
+ c1 = XSD::CodeGen::ClassDef.new(class_name)
+ c1.def_require("soap/rpc/cgistub")
+ c1.def_code <<-EOD
+Methods = [
+#{methoddef.gsub(/^/, " ")}
+]
+ EOD
+ defined_const.each do |ns, tag|
+ c1.def_const(tag, dq(ns))
+ end
+ c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
+ "::SOAP::RPC::CGIStub")
+ c2.def_method("initialize", "*arg") do
+ <<-EOD
+ super(*arg)
+ servant = #{class_name}.new
+ #{class_name}::Methods.each do |definitions|
+ opt = definitions.last
+ if opt[:request_style] == :document
+ @router.add_document_operation(servant, *definitions)
+ else
+ @router.add_rpc_operation(servant, *definitions)
+ end
+ end
+ self.mapping_registry = #{mrname}::EncodedRegistry
+ self.literal_mapping_registry = #{mrname}::LiteralRegistry
+ self.level = Logger::Severity::ERROR
+ EOD
+ end
+ c1.dump + "\n" + c2.dump + format(<<-EOD)
+ #{class_name}App.new('app', nil).start
+ EOD
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb
new file mode 100644
index 00000000..224b9d8f
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb
@@ -0,0 +1,433 @@
+# WSDL4R - Creating class definition from WSDL
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/data'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'xsd/codegen'
+require 'set'
+
+
+module WSDL
+module SOAP
+
+
+class ClassDefCreator
+ include ClassDefCreatorSupport
+ include XSD::CodeGen
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ @elements = definitions.collect_elements
+ @elements.uniq!
+ @attributes = definitions.collect_attributes
+ @attributes.uniq!
+ @simpletypes = definitions.collect_simpletypes
+ @simpletypes.uniq!
+ @complextypes = definitions.collect_complextypes
+ @complextypes.uniq!
+ @modelgroups = definitions.collect_modelgroups
+ @modelgroups.uniq!
+ @faulttypes = nil
+ if definitions.respond_to?(:collect_faulttypes)
+ @faulttypes = definitions.collect_faulttypes
+ end
+ @defined_const = {}
+ end
+
+ def dump(type = nil)
+ result = "require 'xsd/qname'\n"
+ # cannot use @modulepath because of multiple classes
+ if @modulepath
+ result << "\n"
+ result << modulepath_split(@modulepath).collect { |ele| "module #{ele}" }.join("; ")
+ result << "\n\n"
+ end
+ str = dump_group(type)
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_complextype(type)
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_simpletype(type)
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_element(type)
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_attribute(type)
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ if @modulepath
+ result << "\n\n"
+ result << modulepath_split(@modulepath).collect { |ele| "end" }.join("; ")
+ result << "\n"
+ end
+ result
+ end
+
+private
+
+ def dump_element(target = nil)
+ @elements.collect { |ele|
+ next if @complextypes[ele.name]
+ next if target and target != ele.name
+ c = create_elementdef(@modulepath, ele)
+ c ? c.dump : nil
+ }.compact.join("\n")
+ end
+
+ def dump_attribute(target = nil)
+ @attributes.collect { |attribute|
+ next if target and target != attribute.name
+ if attribute.local_simpletype
+ c = create_simpletypedef(@modulepath, attribute.name, attribute.local_simpletype)
+ end
+ c ? c.dump : nil
+ }.compact.join("\n")
+ end
+
+ def dump_simpletype(target = nil)
+ @simpletypes.collect { |type|
+ next if target and target != type.name
+ c = create_simpletypedef(@modulepath, type.name, type)
+ c ? c.dump : nil
+ }.compact.join("\n")
+ end
+
+ def dump_complextype(target = nil)
+ definitions = sort_dependency(@complextypes).collect { |type|
+ next if target and target != type.name
+ c = create_complextypedef(@modulepath, type.name, type)
+ c ? c.dump : nil
+ }.compact.join("\n")
+ end
+
+ def dump_group(target = nil)
+ definitions = @modelgroups.collect { |group|
+ # TODO: not dumped for now but may be useful in the future
+ }.compact.join("\n")
+ end
+
+ def create_elementdef(mpath, ele)
+ qualified = (ele.elementform == 'qualified')
+ if ele.local_complextype
+ create_complextypedef(mpath, ele.name, ele.local_complextype, qualified)
+ elsif ele.local_simpletype
+ create_simpletypedef(mpath, ele.name, ele.local_simpletype, qualified)
+ elsif ele.empty?
+ create_simpleclassdef(mpath, ele.name, nil)
+ else
+ # ignores type only element
+ nil
+ end
+ end
+
+ def create_simpletypedef(mpath, qname, simpletype, qualified = false)
+ if simpletype.restriction
+ create_simpletypedef_restriction(mpath, qname, simpletype, qualified)
+ elsif simpletype.list
+ create_simpletypedef_list(mpath, qname, simpletype, qualified)
+ elsif simpletype.union
+ create_simpletypedef_union(mpath, qname, simpletype, qualified)
+ else
+ raise RuntimeError.new("unknown kind of simpletype: #{simpletype}")
+ end
+ end
+
+ def create_simpletypedef_restriction(mpath, qname, typedef, qualified)
+ restriction = typedef.restriction
+ unless restriction.enumeration?
+ # not supported. minlength?
+ return nil
+ end
+ classname = mapped_class_basename(qname, mpath)
+ c = ClassDef.new(classname, '::String')
+ c.comment = "#{qname}"
+ define_classenum_restriction(c, classname, restriction.enumeration)
+ c
+ end
+
+ def create_simpletypedef_list(mpath, qname, typedef, qualified)
+ list = typedef.list
+ classname = mapped_class_basename(qname, mpath)
+ c = ClassDef.new(classname, '::Array')
+ c.comment = "#{qname}"
+ if simpletype = list.local_simpletype
+ if simpletype.restriction.nil?
+ raise RuntimeError.new(
+ "unknown kind of simpletype: #{simpletype}")
+ end
+ define_stringenum_restriction(c, simpletype.restriction.enumeration)
+ c.comment << "\n contains list of #{classname}::*"
+ elsif list.itemtype
+ c.comment << "\n contains list of #{mapped_class_basename(list.itemtype, mpath)}::*"
+ else
+ raise RuntimeError.new("unknown kind of list: #{list}")
+ end
+ c
+ end
+
+ def create_simpletypedef_union(mpath, qname, typedef, qualified)
+ union = typedef.union
+ classname = mapped_class_basename(qname, mpath)
+ c = ClassDef.new(classname, '::String')
+ c.comment = "#{qname}"
+ if union.member_types
+ # fixme
+ c.comment << "\n any of #{union.member_types}"
+ end
+ c
+ end
+
+ def define_stringenum_restriction(c, enumeration)
+ const = {}
+ enumeration.each do |value|
+ constname = safeconstname(value)
+ const[constname] ||= 0
+ if (const[constname] += 1) > 1
+ constname += "_#{const[constname]}"
+ end
+ c.def_const(constname, ndq(value))
+ end
+ end
+
+ def define_classenum_restriction(c, classname, enumeration)
+ const = {}
+ enumeration.each do |value|
+ constname = safeconstname(value)
+ const[constname] ||= 0
+ if (const[constname] += 1) > 1
+ constname += "_#{const[constname]}"
+ end
+ c.def_const(constname, "new(#{ndq(value)})")
+ end
+ end
+
+ def create_simpleclassdef(mpath, qname, type_or_element)
+ classname = mapped_class_basename(qname, mpath)
+ c = ClassDef.new(classname, '::String')
+ c.comment = "#{qname}"
+ init_lines = []
+ if type_or_element and !type_or_element.attributes.empty?
+ define_attribute(c, type_or_element.attributes)
+ init_lines << "@__xmlattr = {}"
+ end
+ c.def_method('initialize', '*arg') do
+ "super\n" + init_lines.join("\n")
+ end
+ c
+ end
+
+ def create_complextypedef(mpath, qname, type, qualified = false)
+ case type.compoundtype
+ when :TYPE_STRUCT, :TYPE_EMPTY
+ create_structdef(mpath, qname, type, qualified)
+ when :TYPE_ARRAY
+ create_arraydef(mpath, qname, type)
+ when :TYPE_SIMPLE
+ create_simpleclassdef(mpath, qname, type)
+ when :TYPE_MAP
+ # mapped as a general Hash
+ nil
+ else
+ raise RuntimeError.new(
+ "unknown kind of complexContent: #{type.compoundtype}")
+ end
+ end
+
+ def create_structdef(mpath, qname, typedef, qualified = false)
+ classname = mapped_class_basename(qname, mpath)
+ baseclassname = nil
+ if typedef.complexcontent
+ if base = typedef.complexcontent.base
+ # :TYPE_ARRAY must not be derived (#424)
+ basedef = @complextypes[base]
+ if basedef and basedef.compoundtype != :TYPE_ARRAY
+ # baseclass should be a toplevel complexType
+ baseclassname = mapped_class_basename(base, @modulepath)
+ end
+ end
+ end
+ if @faulttypes and @faulttypes.index(qname)
+ c = ClassDef.new(classname, '::StandardError')
+ else
+ c = ClassDef.new(classname, baseclassname)
+ end
+ c.comment = "#{qname}"
+ c.comment << "\nabstract" if typedef.abstract
+ parentmodule = mapped_class_name(qname, mpath)
+ init_lines, init_params =
+ parse_elements(c, typedef.elements, qname.namespace, parentmodule)
+ unless typedef.attributes.empty?
+ define_attribute(c, typedef.attributes)
+ init_lines << "@__xmlattr = {}"
+ end
+ c.def_method('initialize', *init_params) do
+ init_lines.join("\n")
+ end
+ c
+ end
+
+ def parse_elements(c, elements, base_namespace, mpath, as_array = false)
+ init_lines = []
+ init_params = []
+ any = false
+ elements.each do |element|
+ case element
+ when XMLSchema::Any
+ # only 1 is allowed for now.
+ raise RuntimeError.new("duplicated 'any'") if any
+ any = true
+ attrname = '__xmlele_any'
+ c.def_attr(attrname, false, attrname)
+ c.def_method('set_any', 'elements') do
+ '@__xmlele_any = elements'
+ end
+ init_lines << "@__xmlele_any = nil"
+ when XMLSchema::Element
+ next if element.ref == SchemaName
+ name = name_element(element).name
+ typebase = @modulepath
+ if element.anonymous_type?
+ inner = create_elementdef(mpath, element)
+ unless as_array
+ inner.comment = "inner class for member: #{name}\n" + inner.comment
+ end
+ c.innermodule << inner
+ typebase = mpath
+ end
+ unless as_array
+ attrname = safemethodname(name)
+ varname = safevarname(name)
+ c.def_attr(attrname, true, varname)
+ init_lines << "@#{varname} = #{varname}"
+ if element.map_as_array?
+ init_params << "#{varname} = []"
+ else
+ init_params << "#{varname} = nil"
+ end
+ c.comment << "\n #{attrname} - #{create_type_name(typebase, element) || '(any)'}"
+ end
+ when WSDL::XMLSchema::Sequence
+ child_init_lines, child_init_params =
+ parse_elements(c, element.elements, base_namespace, mpath, as_array)
+ init_lines.concat(child_init_lines)
+ init_params.concat(child_init_params)
+ when WSDL::XMLSchema::Choice
+ child_init_lines, child_init_params =
+ parse_elements(c, element.elements, base_namespace, mpath, as_array)
+ init_lines.concat(child_init_lines)
+ init_params.concat(child_init_params)
+ when WSDL::XMLSchema::Group
+ if element.content.nil?
+ warn("no group definition found: #{element}")
+ next
+ end
+ child_init_lines, child_init_params =
+ parse_elements(c, element.content.elements, base_namespace, mpath, as_array)
+ init_lines.concat(child_init_lines)
+ init_params.concat(child_init_params)
+ else
+ raise RuntimeError.new("unknown type: #{element}")
+ end
+ end
+ [init_lines, init_params]
+ end
+
+ def define_attribute(c, attributes)
+ const = {}
+ unless attributes.empty?
+ c.def_method("__xmlattr") do <<-__EOD__
+ @__xmlattr ||= {}
+ __EOD__
+ end
+ end
+ attributes.each do |attribute|
+ name = name_attribute(attribute)
+ methodname = safemethodname('xmlattr_' + name.name)
+ constname = 'Attr' + safeconstname(name.name)
+ const[constname] ||= 0
+ if (const[constname] += 1) > 1
+ constname += "_#{const[constname]}"
+ end
+ c.def_const(constname, dqname(name))
+ c.def_method(methodname) do <<-__EOD__
+ __xmlattr[#{constname}]
+ __EOD__
+ end
+ c.def_method(methodname + '=', 'value') do <<-__EOD__
+ __xmlattr[#{constname}] = value
+ __EOD__
+ end
+ c.comment << "\n #{methodname} - #{attribute_basetype(attribute) || '(any)'}"
+ end
+ end
+
+ def create_arraydef(mpath, qname, typedef)
+ classname = mapped_class_basename(qname, mpath)
+ c = ClassDef.new(classname, '::Array')
+ c.comment = "#{qname}"
+ parentmodule = mapped_class_name(qname, mpath)
+ parse_elements(c, typedef.elements, qname.namespace, parentmodule, true)
+ c
+ end
+
+ def sort_dependency(types)
+ dep = {}
+ root = []
+ types.each do |type|
+ if type.complexcontent and (base = type.complexcontent.base)
+ dep[base] ||= []
+ dep[base] << type
+ else
+ root << type
+ end
+ end
+ sorted = []
+ root.each do |type|
+ sorted.concat(collect_dependency(type, dep))
+ end
+ sorted.concat(dep.values.flatten)
+ sorted
+ end
+
+ # removes collected key from dep
+ def collect_dependency(type, dep)
+ result = [type]
+ return result unless dep.key?(type.name)
+ dep[type.name].each do |deptype|
+ result.concat(collect_dependency(deptype, dep))
+ end
+ dep.delete(type.name)
+ result
+ end
+
+ def modulepath_split(modulepath)
+ if modulepath.is_a?(::Array)
+ modulepath
+ else
+ modulepath.to_s.split('::')
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb
new file mode 100644
index 00000000..5d7d8ea0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb
@@ -0,0 +1,240 @@
+# WSDL4R - Creating class code support from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'soap/mapping'
+require 'soap/mapping/typeMap'
+require 'xsd/codegen/gensupport'
+
+
+module WSDL
+module SOAP
+
+
+# requires @defined_const, @simpletypes, @name_creator
+module ClassDefCreatorSupport
+ include XSD::CodeGen::GenSupport
+
+ def mapped_class_name(qname, modulepath)
+ @name_creator.assign_name(qname, modulepath)
+ end
+
+ def mapped_class_basename(qname, modulepath)
+ classname = @name_creator.assign_name(qname, modulepath)
+ classname.sub(/\A.*:/, '')
+ end
+
+ def basetype_mapped_class(name)
+ ::SOAP::TypeMap[name]
+ end
+
+ def dump_method_signature(name, operation, element_definitions)
+ methodname = safemethodname(name)
+ input = operation.input
+ output = operation.output
+ fault = operation.fault
+ signature = "#{methodname}#{dump_inputparam(input)}"
+ str = <<__EOD__
+# SYNOPSIS
+# #{methodname}#{dump_inputparam(input)}
+#
+# ARGS
+#{dump_inout_type(input, element_definitions).chomp}
+#
+# RETURNS
+#{dump_inout_type(output, element_definitions).chomp}
+#
+__EOD__
+ unless fault.empty?
+ str <<<<__EOD__
+# RAISES
+#{dump_fault_type(fault, element_definitions)}
+#
+__EOD__
+ end
+ str
+ end
+
+ def dq(ele)
+ ele.dump
+ end
+
+ def ndq(ele)
+ ele.nil? ? 'nil' : dq(ele)
+ end
+
+ def sym(ele)
+ ':' + ele.id2name
+ end
+
+ def nsym(ele)
+ ele.nil? ? 'nil' : sym(ele)
+ end
+
+ def dqname(qname)
+ if @defined_const.key?(qname.namespace)
+ qname.dump(@defined_const[qname.namespace])
+ else
+ qname.dump
+ end
+ end
+
+ def assign_const(value, prefix = '')
+ return if value.nil? or @defined_const.key?(value)
+ name = value.scan(/[^:\/]+\/?\z/)[0] || 'C'
+ tag = prefix + safeconstname(name)
+ if @defined_const.value?(tag)
+ idx = 0
+ while true
+ tag = prefix + safeconstname(name + "_#{idx}")
+ break unless @defined_const.value?(tag)
+ idx += 1
+ raise RuntimeError.new("too much similar names") if idx > 100
+ end
+ end
+ @defined_const[value] = tag
+ end
+
+ def create_type_name(modulepath, element)
+ if element.type == XSD::AnyTypeName
+ # nil means anyType.
+ nil
+ elsif simpletype = @simpletypes[element.type]
+ if simpletype.restriction and simpletype.restriction.enumeration?
+ mapped_class_name(element.type, modulepath)
+ else
+ nil
+ end
+ elsif klass = element_basetype(element)
+ klass.name
+ elsif element.type
+ mapped_class_name(element.type, modulepath)
+ elsif element.ref
+ mapped_class_name(element.ref, modulepath)
+ elsif element.anonymous_type?
+ # inner class
+ mapped_class_name(element.name, modulepath)
+ else
+ nil
+ end
+ end
+
+private
+
+ def dump_inout_type(param, element_definitions)
+ if param
+ message = param.find_message
+ params = ""
+ message.parts.each do |part|
+ name = safevarname(part.name)
+ if part.type
+ typename = safeconstname(part.type.name)
+ qname = part.type
+ params << add_at("# #{name}", "#{typename} - #{qname}\n", 20)
+ elsif part.element
+ ele = element_definitions[part.element]
+ if ele.type
+ typename = safeconstname(ele.type.name)
+ qname = ele.type
+ else
+ typename = safeconstname(ele.name.name)
+ qname = ele.name
+ end
+ params << add_at("# #{name}", "#{typename} - #{qname}\n", 20)
+ end
+ end
+ unless params.empty?
+ return params
+ end
+ end
+ "# N/A\n"
+ end
+
+ def dump_inputparam(input)
+ message = input.find_message
+ params = ""
+ message.parts.each do |part|
+ params << ", " unless params.empty?
+ params << safevarname(part.name)
+ end
+ if params.empty?
+ ""
+ else
+ "(#{ params })"
+ end
+ end
+
+ def add_at(base, str, pos)
+ if base.size >= pos
+ base + ' ' + str
+ else
+ base + ' ' * (pos - base.size) + str
+ end
+ end
+
+ def dump_fault_type(fault, element_definitions)
+ fault.collect { |ele|
+ dump_inout_type(ele, element_definitions).chomp
+ }.join("\n")
+ end
+
+ def element_basetype(ele)
+ if klass = basetype_class(ele.type)
+ klass
+ elsif ele.local_simpletype
+ basetype_class(ele.local_simpletype.base)
+ else
+ nil
+ end
+ end
+
+ def attribute_basetype(attr)
+ if klass = basetype_class(attr.type)
+ klass
+ elsif attr.local_simpletype
+ basetype_class(attr.local_simpletype.base)
+ else
+ nil
+ end
+ end
+
+ def basetype_class(type)
+ return nil if type.nil?
+ if simpletype = @simpletypes[type]
+ basetype_mapped_class(simpletype.base)
+ else
+ basetype_mapped_class(type)
+ end
+ end
+
+ def name_element(element)
+ return element.name if element.name
+ return element.ref if element.ref
+ raise RuntimeError.new("cannot define name of #{element}")
+ end
+
+ def name_attribute(attribute)
+ return attribute.name if attribute.name
+ return attribute.ref if attribute.ref
+ raise RuntimeError.new("cannot define name of #{attribute}")
+ end
+
+ # TODO: run MethodDefCreator just once in 1.6.X.
+ # MethodDefCreator should return parsed struct, not a String.
+ def collect_assigned_method(wsdl, porttypename, modulepath = nil)
+ name_creator = WSDL::SOAP::ClassNameCreator.new
+ methoddefcreator =
+ WSDL::SOAP::MethodDefCreator.new(wsdl, name_creator, modulepath, {})
+ methoddefcreator.dump(porttypename)
+ methoddefcreator.assigned_method
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb
new file mode 100644
index 00000000..10c7e38b
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb
@@ -0,0 +1,54 @@
+# WSDL4R - Class name creator.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/mapping/typeMap'
+require 'xsd/codegen/gensupport'
+
+
+module WSDL
+module SOAP
+
+
+class ClassNameCreator
+ include XSD::CodeGen::GenSupport
+
+ def initialize
+ @classname = {}
+ end
+
+ def assign_name(qname, modulepath = nil)
+ key = [modulepath, qname]
+ unless @classname.key?(key)
+ if klass = ::SOAP::TypeMap[qname]
+ name =
+ ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass).name
+ else
+ name = safeconstname(qname.name)
+ if modulepath
+ name = [modulepath, name].join('::')
+ end
+ while @classname.value?(name)
+ name += '_'
+ end
+ check_classname(name)
+ end
+ @classname[key] = name.freeze
+ end
+ @classname[key]
+ end
+
+ def check_classname(name)
+ if Object.constants.include?(name)
+ warn("created definition re-opens an existing toplevel class: #{name}. consider to use --module_path option of wsdl2ruby.rb")
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb
new file mode 100644
index 00000000..cd6d338d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb
@@ -0,0 +1,104 @@
+# WSDL4R - Creating client skelton code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/classDefCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class ClientSkeltonCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump(service_name)
+ services = @definitions.service(service_name)
+ unless services
+ raise RuntimeError.new("service not defined: #{service_name}")
+ end
+ result = ""
+ if @modulepath
+ result << "\n"
+ result << @modulepath.collect { |ele| "module #{ele}" }.join("; ")
+ result << "\n\n"
+ end
+ services.ports.each do |port|
+ result << dump_porttype(port.porttype)
+ result << "\n"
+ end
+ if @modulepath
+ result << "\n\n"
+ result << @modulepath.collect { |ele| "end" }.join("; ")
+ result << "\n"
+ end
+ result
+ end
+
+private
+
+ def dump_porttype(porttype)
+ assigned_method = collect_assigned_method(@definitions, porttype.name, @modulepath)
+ drv_name = mapped_class_basename(porttype.name, @modulepath)
+
+ result = ""
+ result << <<__EOD__
+endpoint_url = ARGV.shift
+obj = #{ drv_name }.new(endpoint_url)
+
+# run ruby with -d to see SOAP wiredumps.
+obj.wiredump_dev = STDERR if $DEBUG
+
+__EOD__
+ element_definitions = @definitions.collect_elements
+ binding = porttype.find_binding
+ if binding
+ binding.operations.each do |op_bind|
+ operation = op_bind.find_operation
+ if operation.nil?
+ warn("operation not found for binding: #{op_bind}")
+ next
+ end
+ name = assigned_method[op_bind.boundid] || operation.name
+ result << dump_method_signature(name, operation, element_definitions)
+ result << dump_input_init(operation.input) << "\n"
+ result << dump_operation(name, operation) << "\n\n"
+ end
+ end
+ result
+ end
+
+ def dump_operation(name, operation)
+ input = operation.input
+ "puts obj.#{ safemethodname(name) }#{ dump_inputparam(input) }"
+ end
+
+ def dump_input_init(input)
+ result = input.find_message.parts.collect { |part|
+ safevarname(part.name)
+ }.join(" = ")
+ if result.empty?
+ ""
+ else
+ result << " = nil"
+ end
+ result
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb
new file mode 100644
index 00000000..bbf6b507
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb
@@ -0,0 +1,173 @@
+# WSDL4R - SOAP complexType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/complexType'
+require 'soap/mapping'
+
+
+module WSDL
+module XMLSchema
+
+
+class ComplexType < Info
+ def compoundtype
+ @compoundtype ||= check_type
+ end
+
+ def check_type
+ if have_any?
+ :TYPE_STRUCT
+ elsif content
+ if attributes.empty? and map_as_array?
+ if name == ::SOAP::Mapping::MapQName
+ :TYPE_MAP
+ else
+ :TYPE_ARRAY
+ end
+ else
+ :TYPE_STRUCT
+ end
+ elsif complexcontent
+ complexcontent.check_type
+ elsif simplecontent
+ :TYPE_SIMPLE
+ elsif !attributes.empty?
+ :TYPE_STRUCT
+ else # empty complexType definition (seen in partner.wsdl of salesforce)
+ :TYPE_EMPTY
+ end
+ end
+
+ def child_type(name = nil)
+ case compoundtype
+ when :TYPE_STRUCT
+ if ele = find_element(name)
+ ele.type
+ elsif ele = find_element_by_name(name.name)
+ ele.type
+ end
+ when :TYPE_ARRAY
+ @contenttype ||= content_arytype
+ when :TYPE_MAP
+ item_ele = find_element_by_name("item") or
+ raise RuntimeError.new("'item' element not found in Map definition.")
+ content = item_ele.local_complextype or
+ raise RuntimeError.new("No complexType definition for 'item'.")
+ if ele = content.find_element(name)
+ ele.type
+ elsif ele = content.find_element_by_name(name.name)
+ ele.type
+ end
+ else
+ raise NotImplementedError.new("Unknown kind of complexType.")
+ end
+ end
+
+ def child_defined_complextype(name)
+ ele = nil
+ case compoundtype
+ when :TYPE_STRUCT, :TYPE_MAP
+ unless ele = find_element(name)
+ if name.namespace.nil?
+ ele = find_element_by_name(name.name)
+ end
+ end
+ when :TYPE_ARRAY
+ e = elements
+ if e.size == 1
+ ele = e[0]
+ else
+ raise RuntimeError.new("Assert: must not reach.")
+ end
+ else
+ raise RuntimeError.new("Assert: Not implemented.")
+ end
+ unless ele
+ raise RuntimeError.new("Cannot find #{name} as a children of #{@name}.")
+ end
+ ele.local_complextype
+ end
+
+ def find_soapenc_arytype
+ unless compoundtype == :TYPE_ARRAY
+ raise RuntimeError.new("Assert: not for array")
+ end
+ if complexcontent
+ if complexcontent.restriction
+ complexcontent.restriction.attributes.each do |attribute|
+ if attribute.ref == ::SOAP::AttrArrayTypeName
+ return attribute.arytype
+ end
+ end
+ end
+ end
+ nil
+ end
+
+ def find_arytype
+ unless compoundtype == :TYPE_ARRAY
+ raise RuntimeError.new("Assert: not for array")
+ end
+ if arytype = find_soapenc_arytype
+ return arytype
+ end
+ if map_as_array?
+ return element_simpletype(elements[0])
+ end
+ raise RuntimeError.new("Assert: Unknown array definition.")
+ end
+
+ def find_aryelement
+ unless compoundtype == :TYPE_ARRAY
+ raise RuntimeError.new("Assert: not for array")
+ end
+ if map_as_array?
+ return nested_elements[0]
+ end
+ nil # use default item name
+ end
+
+private
+
+ def element_simpletype(element)
+ case element
+ when XMLSchema::Element
+ if element.type
+ element.type
+ elsif element.local_simpletype
+ element.local_simpletype.base
+ else
+ # element definition
+ nil
+ end
+ when XMLSchema::Any
+ XSD::AnyTypeName
+ else
+ nil
+ end
+ end
+
+ def map_as_array?
+ e = nested_elements
+ e.size == 1 and e[0].map_as_array?
+ end
+
+ def content_arytype
+ if arytype = find_arytype
+ ns = arytype.namespace
+ name = arytype.name.sub(/\[(?:,)*\]$/, '')
+ XSD::QName.new(ns, name)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb
new file mode 100644
index 00000000..56bbadf8
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb
@@ -0,0 +1,42 @@
+# WSDL4R - WSDL SOAP binding data definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'wsdl/soap/definitions'
+require 'wsdl/soap/binding'
+require 'wsdl/soap/operation'
+require 'wsdl/soap/body'
+require 'wsdl/soap/element'
+require 'wsdl/soap/header'
+require 'wsdl/soap/headerfault'
+require 'wsdl/soap/fault'
+require 'wsdl/soap/address'
+require 'wsdl/soap/complexType'
+
+
+module WSDL
+module SOAP
+
+
+HeaderFaultName = XSD::QName.new(SOAPBindingNamespace, 'headerfault')
+
+LocationAttrName = XSD::QName.new(nil, 'location')
+StyleAttrName = XSD::QName.new(nil, 'style')
+TransportAttrName = XSD::QName.new(nil, 'transport')
+UseAttrName = XSD::QName.new(nil, 'use')
+PartsAttrName = XSD::QName.new(nil, 'parts')
+PartAttrName = XSD::QName.new(nil, 'part')
+NameAttrName = XSD::QName.new(nil, 'name')
+MessageAttrName = XSD::QName.new(nil, 'message')
+EncodingStyleAttrName = XSD::QName.new(nil, 'encodingStyle')
+NamespaceAttrName = XSD::QName.new(nil, 'namespace')
+SOAPActionAttrName = XSD::QName.new(nil, 'soapAction')
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb
new file mode 100644
index 00000000..7a42a4c1
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb
@@ -0,0 +1,200 @@
+# WSDL4R - WSDL additional definitions for SOAP.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+require 'soap/mapping'
+
+
+module WSDL
+
+
+class Definitions < Info
+ def self.soap_rpc_complextypes
+ types = XSD::NamedElements.new
+ types << array_complextype
+ types << fault_complextype
+ types << exception_complextype
+ types
+ end
+
+ def self.array_complextype
+ type = XMLSchema::ComplexType.new(::SOAP::ValueArrayName)
+ type.complexcontent = XMLSchema::ComplexContent.new
+ type.complexcontent.restriction = XMLSchema::ComplexRestriction.new
+ type.complexcontent.restriction.base = ::SOAP::ValueArrayName
+ attr = XMLSchema::Attribute.new
+ attr.ref = ::SOAP::AttrArrayTypeName
+ anyarray = XSD::QName.new(
+ XSD::AnyTypeName.namespace,
+ XSD::AnyTypeName.name + '[]')
+ attr.arytype = anyarray
+ type.complexcontent.restriction.attributes << attr
+ type
+ end
+
+=begin
+
+
+
+
+
+
+
+
+=end
+ 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
+
+ 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
+
+ def soap_rpc_complextypes(binding)
+ types = rpc_operation_complextypes(binding)
+ types + self.class.soap_rpc_complextypes
+ end
+
+ def collect_faulttypes
+ result = []
+ collect_fault_messages.each do |name|
+ faultparts = message(name).parts
+ if faultparts.size != 1
+ raise RuntimeError.new("Expecting fault message \"#{name}\" to have ONE part")
+ end
+ fault_part = faultparts[0]
+ # WS-I Basic Profile Version 1.1 (R2205) requires fault message parts
+ # to refer to elements rather than types
+ faulttype = fault_part.element
+ if not faulttype
+ warn("Fault message \"#{name}\" part \"#{fault_part.name}\" must specify an \"element\" attribute")
+ faulttype = fault_part.type
+ end
+ if faulttype and result.index(faulttype).nil?
+ result << faulttype
+ end
+ end
+ result
+ end
+
+private
+
+ def get_fault_binding(op_binding, fault_name)
+ op_binding.fault.each do |fault|
+ return fault if fault.name == fault_name
+ end
+ return nil
+ end
+
+ def op_binding_declares_fault(op_binding, fault_name)
+ return get_fault_binding(op_binding, fault_name) != nil
+ end
+
+ def collect_fault_messages
+ result = []
+ porttypes.each do |porttype|
+ port_binding = porttype.find_binding()
+ next unless port_binding
+ porttype.operations.each do |operation|
+ op_binding = port_binding.operations.find { |ele| ele.name == operation.name }
+ next unless op_binding
+ operation.fault.each do |fault|
+ # Make sure the operation fault has a name
+ if not fault.name
+ warn("Operation \"#{operation.name}\": fault must specify a \"name\" attribute")
+ next
+ end
+ # Make sure that portType fault has a corresponding soap:fault
+ # definition in binding section.
+ if not op_binding_declares_fault(op_binding, fault.name)
+ warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": no corresponding wsdl:fault binding found with a matching \"name\" attribute")
+ next
+ end
+ fault_binding = get_fault_binding(op_binding, fault.name)
+ if fault_binding.soapfault.nil?
+ warn("WARNING: no soap:fault found for wsdl:fault \"#{fault_binding.name}\" in operation \"#{operation.name}\" \n\n")
+ next
+ end
+ if fault_binding.soapfault.name != fault_binding.name
+ warn("WARNING: name of soap:fault \"#{fault_binding.soapfault.name}\" doesn't match the name of wsdl:fault \"#{fault_binding.name}\" in operation \"#{operation.name}\" \n\n")
+ next
+ end
+ # According to WS-I (R2723): if in a wsdl:binding the use attribute
+ # on a contained soapbind:fault element is present, its value MUST
+ # be "literal".
+ if fault_binding.soapfault.use and fault_binding.soapfault.use != "literal"
+ warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": soap:fault \"use\" attribute must be \"literal\"")
+ end
+ if result.index(fault.message).nil?
+ result << fault.message
+ end
+ end
+ end
+ end
+ result
+ end
+
+ def rpc_operation_complextypes(binding)
+ types = XSD::NamedElements.new
+ binding.operations.each do |op_bind|
+ if op_bind_rpc?(op_bind)
+ operation = op_bind.find_operation
+ if op_bind.input
+ type = XMLSchema::ComplexType.new(op_bind.soapoperation_name)
+ message = messages[operation.input.message]
+ type.sequence_elements = elements_from_message(message)
+ types << type
+ end
+ if op_bind.output
+ type = XMLSchema::ComplexType.new(operation.outputname)
+ message = messages[operation.output.message]
+ type.sequence_elements = elements_from_message(message)
+ types << type
+ end
+ end
+ end
+ types
+ end
+
+ def op_bind_rpc?(op_bind)
+ op_bind.soapoperation_style == :rpc
+ end
+
+ def elements_from_message(message)
+ message.parts.collect { |part|
+ if part.element
+ collect_elements[part.element]
+ elsif part.name.nil? or part.type.nil?
+ raise RuntimeError.new("part of a message must be an element or typed")
+ else
+ qname = XSD::QName.new(nil, part.name)
+ XMLSchema::Element.new(qname, part.type)
+ end
+ }
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb
new file mode 100644
index 00000000..68f203cc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb
@@ -0,0 +1,118 @@
+# WSDL4R - Creating driver code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreator'
+require 'wsdl/soap/methodDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'xsd/codegen'
+
+
+module WSDL
+module SOAP
+
+
+class DriverCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+ attr_accessor :drivername_postfix
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ @drivername_postfix = ''
+ end
+
+ def dump(porttype = nil)
+ result = "require 'soap/rpc/driver'\n\n"
+ if @modulepath
+ @modulepath.each do |name|
+ result << "module #{name}\n"
+ end
+ result << "\n"
+ end
+ if porttype.nil?
+ @definitions.porttypes.each do |type|
+ result << dump_porttype(type.name)
+ result << "\n"
+ end
+ else
+ result << dump_porttype(porttype)
+ end
+ if @modulepath
+ result << "\n"
+ @modulepath.each do |name|
+ result << "end\n"
+ end
+ end
+ result
+ end
+
+private
+
+ def dump_porttype(porttype)
+ drivername = porttype.name + @drivername_postfix
+ qname = XSD::QName.new(porttype.namespace, drivername)
+ class_name = mapped_class_basename(qname, @modulepath)
+ defined_const = {}
+ mdcreator = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const)
+ methoddef = mdcreator.dump(porttype)
+ binding = @definitions.bindings.find { |item| item.type == porttype }
+ if binding.nil? or binding.soapbinding.nil?
+ # not bound or not a SOAP binding
+ return ''
+ end
+ address = @definitions.porttype(porttype).locations[0]
+
+ c = XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver")
+ c.def_const("DefaultEndpointUrl", ndq(address))
+ c.def_code <<-EOD
+Methods = [
+#{methoddef.gsub(/^/, " ")}
+]
+ EOD
+ wsdl_name = @definitions.name ? @definitions.name.name : 'default'
+ mrname = safeconstname(wsdl_name + 'MappingRegistry')
+ c.def_method("initialize", "endpoint_url = nil") do
+ %Q[endpoint_url ||= DefaultEndpointUrl\n] +
+ %Q[super(endpoint_url, nil)\n] +
+ %Q[self.mapping_registry = #{mrname}::EncodedRegistry\n] +
+ %Q[self.literal_mapping_registry = #{mrname}::LiteralRegistry\n] +
+ %Q[init_methods]
+ end
+ c.def_privatemethod("init_methods") do
+ <<-EOD
+ Methods.each do |definitions|
+ opt = definitions.last
+ if opt[:request_style] == :document
+ add_document_operation(*definitions)
+ else
+ add_rpc_operation(*definitions)
+ qname = definitions[0]
+ name = definitions[2]
+ if qname.name != name and qname.name.capitalize == name.capitalize
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
+ __send__(name, *arg)
+ end
+ end
+ end
+ end
+ EOD
+ end
+ defined_const.each do |ns, tag|
+ c.def_const(tag, dq(ns))
+ end
+ c.dump
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb
new file mode 100644
index 00000000..bc996ab5
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb
@@ -0,0 +1,33 @@
+# WSDL4R - XMLSchema element definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/element'
+
+
+module WSDL
+module XMLSchema
+
+
+class Element < Info
+ def map_as_array?
+ # parent sequence / choice may be marked as maxOccurs="unbounded"
+ maxoccurs.nil? or maxoccurs != 1 or (parent and parent.map_as_array?)
+ end
+
+ def anonymous_type?
+ !@ref and @name and @local_complextype
+ end
+
+ def attributes
+ @local_complextype.attributes
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb
new file mode 100644
index 00000000..7fa5baef
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb
@@ -0,0 +1,73 @@
+# WSDL4R - Creating EncodedMappingRegistry code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class EncodedMappingRegistryCreator
+ include MappingRegistryCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath, defined_const)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ @simpletypes = definitions.collect_simpletypes
+ @simpletypes.uniq!
+ @complextypes = definitions.collect_complextypes
+ @complextypes.uniq!
+ @varname = nil
+ @defined_const = defined_const
+ end
+
+ def dump(varname)
+ @varname = varname
+ result = ''
+ str = dump_complextype
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_simpletype
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ result
+ end
+
+private
+
+ def dump_complextype
+ @complextypes.collect { |type|
+ unless type.abstract
+ dump_with_inner {
+ dump_complextypedef(@modulepath, type.name, type, nil, :encoded => true)
+ }
+ end
+ }.compact.join("\n")
+ end
+
+ def dump_simpletype
+ @simpletypes.collect { |type|
+ dump_with_inner {
+ dump_simpletypedef(@modulepath, type.name, type, nil, :encoded => true)
+ }
+ }.compact.join("\n")
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb
new file mode 100644
index 00000000..eba1d72c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb
@@ -0,0 +1,56 @@
+# WSDL4R - WSDL SOAP body definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Fault < Info
+ attr_reader :name # required
+ attr_reader :use # required
+ attr_reader :encodingstyle
+ attr_reader :namespace
+
+ def initialize
+ super
+ @name = nil
+ @use = nil
+ @encodingstyle = nil
+ @namespace = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when UseAttrName
+ @use = value.source
+ when EncodingStyleAttrName
+ @encodingstyle = value.source
+ when NamespaceAttrName
+ @namespace = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb
new file mode 100644
index 00000000..2f03ff84
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb
@@ -0,0 +1,86 @@
+# WSDL4R - WSDL SOAP body definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Header < Info
+ attr_reader :headerfault
+
+ attr_reader :message # required
+ attr_reader :part # required
+ attr_reader :use # required
+ attr_reader :encodingstyle
+ attr_reader :namespace
+
+ def initialize
+ super
+ @message = nil
+ @part = nil
+ @use = nil
+ @encodingstyle = nil
+ @namespace = nil
+ @headerfault = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def find_message
+ root.message(@message) or raise RuntimeError.new("#{@message} not found")
+ end
+
+ def find_part
+ find_message.parts.each do |part|
+ if part.name == @part
+ return part
+ end
+ end
+ raise RuntimeError.new("#{@part} not found")
+ end
+
+ def parse_element(element)
+ case element
+ when HeaderFaultName
+ o = WSDL::SOAP::HeaderFault.new
+ @headerfault = o
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MessageAttrName
+ if value.namespace.nil?
+ value = XSD::QName.new(targetnamespace, value.source)
+ end
+ @message = value
+ when PartAttrName
+ @part = value.source
+ when UseAttrName
+ @use = value.source
+ when EncodingStyleAttrName
+ @encodingstyle = value.source
+ when NamespaceAttrName
+ @namespace = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb
new file mode 100644
index 00000000..7b11f244
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb
@@ -0,0 +1,56 @@
+# WSDL4R - WSDL SOAP body definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class HeaderFault < Info
+ attr_reader :message # required
+ attr_reader :part # required
+ attr_reader :use # required
+ attr_reader :encodingstyle
+ attr_reader :namespace
+
+ def initialize
+ super
+ @message = nil
+ @part = nil
+ @use = nil
+ @encodingstyle = nil
+ @namespace = nil
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MessageAttrName
+ @message = value
+ when PartAttrName
+ @part = value.source
+ when UseAttrName
+ @use = value.source
+ when EncodingStyleAttrName
+ @encodingstyle = value.source
+ when NamespaceAttrName
+ @namespace = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb
new file mode 100644
index 00000000..1853ac18
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb
@@ -0,0 +1,115 @@
+# WSDL4R - Creating LiteralMappingRegistry code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class LiteralMappingRegistryCreator
+ include MappingRegistryCreatorSupport
+
+ def initialize(definitions, name_creator, modulepath, defined_const)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ @elements = definitions.collect_elements
+ @elements.uniq!
+ @attributes = definitions.collect_attributes
+ @attributes.uniq!
+ @simpletypes = definitions.collect_simpletypes
+ @simpletypes.uniq!
+ @complextypes = definitions.collect_complextypes
+ @complextypes.uniq!
+ @varname = nil
+ @defined_const = defined_const
+ end
+
+ def dump(varname)
+ @varname = varname
+ result = ''
+ str = dump_complextype
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_simpletype
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_element
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ str = dump_attribute
+ unless str.empty?
+ result << "\n" unless result.empty?
+ result << str
+ end
+ result
+ end
+
+private
+
+ def dump_element
+ @elements.collect { |ele|
+ # has the definition different from the complexType of the same name
+ next if ele.type.nil? and @complextypes[ele.name]
+ dump_with_inner {
+ if typedef = ele.local_complextype
+ dump_complextypedef(@modulepath, ele.name, typedef)
+ elsif typedef = ele.local_simpletype
+ dump_simpletypedef(@modulepath, ele.name, typedef)
+ elsif ele.type
+ if typedef = @complextypes[ele.type]
+ dump_complextypedef(@modulepath, ele.type, typedef, ele.name)
+ elsif typedef = @simpletypes[ele.type]
+ dump_simpletypedef(@modulepath, ele.type, typedef, ele.name)
+ end
+ end
+ }
+ }.compact.join("\n")
+ end
+
+ def dump_attribute
+ @attributes.collect { |attr|
+ if attr.local_simpletype
+ dump_with_inner {
+ dump_simpletypedef(@modulepath, attr.name, attr.local_simpletype)
+ }
+ end
+ }.compact.join("\n")
+ end
+
+ def dump_simpletype
+ @simpletypes.collect { |type|
+ dump_with_inner {
+ dump_simpletypedef(@modulepath, type.name, type)
+ }
+ }.compact.join("\n")
+ end
+
+ def dump_complextype
+ @complextypes.collect { |type|
+ unless type.abstract
+ dump_with_inner {
+ dump_complextypedef(@modulepath, type.name, type)
+ }
+ end
+ }.compact.join("\n")
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb
new file mode 100644
index 00000000..b619eda9
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb
@@ -0,0 +1,58 @@
+# WSDL4R - Creating MappingRegistry code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'wsdl/soap/encodedMappingRegistryCreator'
+require 'wsdl/soap/literalMappingRegistryCreator'
+require 'xsd/codegen/moduledef.rb'
+
+
+module WSDL
+module SOAP
+
+
+class MappingRegistryCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump
+ defined_const = {}
+ encoded_creator = EncodedMappingRegistryCreator.new(@definitions, @name_creator, @modulepath, defined_const)
+ literal_creator = LiteralMappingRegistryCreator.new(@definitions, @name_creator, @modulepath, defined_const)
+ wsdl_name = @definitions.name ? @definitions.name.name : 'default'
+ module_name = safeconstname(wsdl_name + 'MappingRegistry')
+ if @modulepath
+ module_name = [@modulepath, module_name].join('::')
+ end
+ m = XSD::CodeGen::ModuleDef.new(module_name)
+ m.def_require("soap/mapping")
+ varname = 'EncodedRegistry'
+ m.def_const(varname, '::SOAP::Mapping::EncodedRegistry.new')
+ m.def_code(encoded_creator.dump(varname))
+ varname = 'LiteralRegistry'
+ m.def_const(varname, '::SOAP::Mapping::LiteralRegistry.new')
+ m.def_code(literal_creator.dump(varname))
+ #
+ defined_const.each do |ns, tag|
+ m.def_const(tag, dq(ns))
+ end
+ m.dump
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb
new file mode 100644
index 00000000..b224eec0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb
@@ -0,0 +1,376 @@
+# WSDL4R - Creating MappingRegistry support.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/soap/classDefCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+# requires @defined_const = {}, @dump_with_inner, @modulepath
+module MappingRegistryCreatorSupport
+ include ClassDefCreatorSupport
+ include XSD::CodeGen
+
+ def dump_with_inner
+ @dump_with_inner = []
+ @dump_with_inner.unshift(yield)
+ @dump_with_inner.join("\n")
+ end
+
+ def dump_complextypedef(mpath, qname, typedef, as_element = nil, opt = {})
+ case typedef.compoundtype
+ when :TYPE_STRUCT, :TYPE_EMPTY
+ dump_complex_typemap(mpath, qname, typedef, as_element, opt)
+ when :TYPE_ARRAY
+ dump_array_typemap(mpath, qname, typedef, as_element, opt)
+ when :TYPE_SIMPLE
+ dump_simple_typemap(mpath, qname, typedef, as_element, opt)
+ when :TYPE_MAP
+ # mapped as a general Hash
+ nil
+ else
+ raise RuntimeError.new(
+ "unknown kind of complexContent: #{typedef.compoundtype}")
+ end
+ end
+
+ def dump_array_typemap(mpath, qname, typedef, as_element, opt)
+ if typedef.find_soapenc_arytype
+ if opt[:encoded]
+ dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt)
+ end
+ else
+ dump_literal_array_typemap(mpath, qname, typedef, as_element, opt)
+ end
+ end
+
+ def dump_complex_typemap(mpath, qname, typedef, as_element, opt)
+ var = {}
+ define_dump_class(var, mpath, qname, typedef, as_element, opt)
+ schema_ns = (var[:schema_name] || var[:schema_type]).namespace
+ if var[:schema_type] and typedef.base
+ var[:schema_basetype] = typedef.base
+ end
+ parentmodule = var[:class]
+ parsed_element =
+ parse_elements(typedef.elements, qname.namespace, parentmodule, opt)
+ if typedef.choice?
+ parsed_element.unshift(:choice)
+ end
+ var[:schema_element] = dump_schema_element_definition(parsed_element, 2)
+ unless typedef.attributes.empty?
+ var[:schema_attribute] = define_attribute(typedef.attributes)
+ end
+ assign_const(schema_ns, 'Ns')
+ dump_entry(@varname, var)
+ end
+
+ def dump_simple_typemap(mpath, qname, typedef, as_element, opt)
+ var = {}
+ define_dump_class(var, mpath, qname, typedef, as_element, opt)
+ schema_ns = (var[:schema_name] || var[:schema_type]).namespace
+ unless typedef.attributes.empty?
+ var[:schema_attribute] = define_attribute(typedef.attributes)
+ end
+ assign_const(schema_ns, 'Ns')
+ dump_entry(@varname, var)
+ end
+
+ def dump_schema_element_definition(definition, indent = 0)
+ return '[]' if definition.empty?
+ sp = ' ' * indent
+ if definition[0] == :choice
+ definition.shift
+ "[ :choice,\n" +
+ dump_schema_element(definition, indent + 2) + "\n" + sp + "]"
+ elsif definition[0].is_a?(::Array)
+ "[\n" +
+ dump_schema_element(definition, indent + 2) + "\n" + sp + "]"
+ else
+ varname, name, type, occurrence = definition
+ '[' + [
+ varname.dump,
+ dump_type(name, type),
+ dump_occurrence(occurrence)
+ ].compact.join(', ') + ']'
+ end
+ end
+
+ def dump_schema_element(schema_element, indent = 0)
+ sp = ' ' * indent
+ delimiter = ",\n" + sp
+ sp + schema_element.collect { |definition|
+ dump_schema_element_definition(definition, indent)
+ }.join(delimiter)
+ end
+
+ def dump_type(name, type)
+ if name
+ assign_const(name.namespace, 'Ns')
+ '[' + ndq(type) + ', ' + dqname(name) + ']'
+ else
+ ndq(type)
+ end
+ end
+
+ def dump_occurrence(occurrence)
+ if occurrence and occurrence != [1, 1] # default
+ minoccurs, maxoccurs = occurrence
+ maxoccurs ||= 'nil'
+ "[#{minoccurs}, #{maxoccurs}]"
+ end
+ end
+
+ def parse_elements(elements, base_namespace, mpath, opt)
+ schema_element = []
+ any = false
+ elements.each do |element|
+ case element
+ when XMLSchema::Any
+ # only 1 is allowed for now.
+ raise RuntimeError.new("duplicated 'any'") if any
+ any = true
+ varname = 'any' # not used
+ eleqname = XSD::AnyTypeName
+ type = nil
+ occurrence = nil
+ schema_element << [varname, eleqname, type, occurrence]
+ when XMLSchema::Element
+ next if element.ref == SchemaName
+ typebase = @modulepath
+ if element.anonymous_type?
+ child_opt = {
+ :qualified => (element.elementform == 'qualified'),
+ :is_anonymous => true
+ }
+ @dump_with_inner << dump_complextypedef(mpath, element.name, element.local_complextype, nil, child_opt)
+ typebase = mpath
+ end
+ type = create_type_name(typebase, element)
+ name = name_element(element).name
+ varname = safevarname(name)
+ if element.map_as_array?
+ if type
+ type += '[]'
+ else
+ type = '[]'
+ end
+ end
+ # nil means @@schema_ns + varname
+ eleqname = element.name || element.ref
+ if eleqname && varname == name && eleqname.namespace == base_namespace
+ eleqname = nil
+ end
+ occurrence = [element.minoccurs, element.maxoccurs]
+ schema_element << [varname, eleqname, type, occurrence]
+ when WSDL::XMLSchema::Sequence
+ child_schema_element =
+ parse_elements(element.elements, base_namespace, mpath, opt)
+ schema_element << child_schema_element
+ when WSDL::XMLSchema::Choice
+ child_schema_element =
+ parse_elements(element.elements, base_namespace, mpath, opt)
+ if !element.map_as_array?
+ # choice + maxOccurs="unbounded" is treated just as 'all' now.
+ child_schema_element.unshift(:choice)
+ end
+ schema_element << child_schema_element
+ when WSDL::XMLSchema::Group
+ if element.content.nil?
+ warn("no group definition found: #{element}")
+ next
+ end
+ child_schema_element =
+ parse_elements(element.content.elements, base_namespace, mpath, opt)
+ schema_element.concat(child_schema_element)
+ else
+ raise RuntimeError.new("unknown type: #{element}")
+ end
+ end
+ schema_element
+ end
+
+ def define_attribute(attributes)
+ schema_attribute = []
+ attributes.each do |attribute|
+ name = name_attribute(attribute)
+ if klass = attribute_basetype(attribute)
+ type = klass.name
+ else
+ warn("unresolved attribute type #{attribute.type} for #{name}")
+ type = nil
+ end
+ schema_attribute << [name, type]
+ end
+ "{\n " +
+ schema_attribute.collect { |name, type|
+ assign_const(name.namespace, 'Ns')
+ dqname(name) + ' => ' + ndq(type)
+ }.join(",\n ") +
+ "\n }"
+ end
+
+ def dump_entry(regname, var)
+ "#{regname}.register(\n " +
+ [
+ dump_entry_item(var, :class),
+ dump_entry_item(var, :soap_class),
+ dump_entry_item(var, :schema_name, :qname),
+ dump_entry_item(var, :schema_type, :qname),
+ dump_entry_item(var, :is_anonymous),
+ dump_entry_item(var, :schema_basetype, :qname),
+ dump_entry_item(var, :schema_qualified),
+ dump_entry_item(var, :schema_element),
+ dump_entry_item(var, :schema_attribute)
+ ].compact.join(",\n ") +
+ "\n)\n"
+ end
+
+ def dump_entry_item(var, key, dump_type = :none)
+ if var.key?(key)
+ case dump_type
+ when :none
+ ":#{key} => #{var[key]}"
+ when :string
+ if @defined_const.key?(var[key])
+ ":#{key} => #{@defined_const[var[key]]}"
+ else
+ ":#{key} => #{ndq(var[key])}"
+ end
+ when :qname
+ qname = var[key]
+ if @defined_const.key?(qname.namespace)
+ ns = @defined_const[qname.namespace]
+ else
+ ns = ndq(qname.namespace)
+ end
+ ":#{key} => XSD::QName.new(#{ns}, #{ndq(qname.name)})"
+ else
+ raise "Unknown dump type: #{dump_type}"
+ end
+ end
+ end
+
+ def dump_simpletypedef(mpath, qname, simpletype, as_element = nil, opt = {})
+ if simpletype.restriction
+ dump_simpletypedef_restriction(mpath, qname, simpletype, as_element, opt)
+ elsif simpletype.list
+ dump_simpletypedef_list(mpath, qname, simpletype, as_element, opt)
+ elsif simpletype.union
+ dump_simpletypedef_union(mpath, qname, simpletype, as_element, opt)
+ else
+ raise RuntimeError.new("unknown kind of simpletype: #{simpletype}")
+ end
+ end
+
+ def dump_simpletypedef_restriction(mpath, qname, typedef, as_element, opt)
+ restriction = typedef.restriction
+ unless restriction.enumeration?
+ # not supported. minlength?
+ return nil
+ end
+ var = {}
+ define_dump_class(var, mpath, qname, typedef, as_element, opt)
+ schema_ns = (var[:schema_name] || var[:schema_type]).namespace
+ assign_const(schema_ns, 'Ns')
+ dump_entry(@varname, var)
+ end
+
+ def dump_simpletypedef_list(mpath, qname, typedef, as_element, opt)
+ nil
+ end
+
+ def dump_simpletypedef_union(mpath, qname, typedef, as_element, opt)
+ nil
+ end
+
+ DEFAULT_ITEM_NAME = XSD::QName.new(nil, 'item')
+
+ def dump_literal_array_typemap(mpath, qname, typedef, as_element, opt)
+ var = {}
+ define_dump_class(var, mpath, qname, typedef, as_element, opt)
+ schema_ns = (var[:schema_name] || var[:schema_type]).namespace
+ parsed_element =
+ parse_elements(typedef.elements, qname.namespace, var[:class], opt)
+ if parsed_element.empty?
+ parsed_element = [create_array_element_definition(typedef, mpath)]
+ end
+ var[:schema_element] = dump_schema_element_definition(parsed_element, 2)
+ assign_const(schema_ns, 'Ns')
+ dump_entry(@varname, var)
+ end
+
+ def dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt)
+ arytype = typedef.find_arytype || XSD::AnyTypeName
+ type = XSD::QName.new(arytype.namespace, arytype.name.sub(/\[(?:,)*\]$/, ''))
+ return <<__EOD__
+#{@varname}.set(
+ #{mapped_class_name(qname, mpath)},
+ ::SOAP::SOAPArray,
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
+ { :type => #{dqname(type)} }
+)
+__EOD__
+ end
+
+ # used when "soapenc:arrayType" definition
+ def create_array_element_definition(typedef, mpath)
+ child_type = typedef.child_type
+ child_element = typedef.find_aryelement
+ if child_type == XSD::AnyTypeName
+ type = nil
+ elsif child_element
+ if klass = element_basetype(child_element)
+ type = klass.name
+ else
+ typename = child_element.type || child_element.name
+ type = mapped_class_name(typename, mpath)
+ end
+ elsif child_type
+ type = mapped_class_name(child_type, mpath)
+ else
+ type = nil
+ end
+ occurrence = [0, nil]
+ if child_element and child_element.name
+ if child_element.map_as_array?
+ type << '[]' if type
+ occurrence = [child_element.minoccurs, child_element.maxoccurs]
+ end
+ child_element_name = child_element.name
+ else
+ child_element_name = DEFAULT_ITEM_NAME
+ end
+ [child_element_name.name, child_element_name, type, occurrence]
+ end
+
+ def define_dump_class(var, mpath, qname, typedef, as_element, opt)
+ var[:class] = mapped_class_name(qname, mpath)
+ if as_element
+ var[:schema_name] = as_element
+ schema_ns = as_element.namespace
+ elsif typedef.name.nil?
+ var[:schema_name] = qname
+ schema_ns = qname.namespace
+ else
+ var[:schema_type] = qname
+ schema_ns = qname.namespace
+ end
+ var[:is_anonymous] = opt[:is_anonymous] if opt.key?(:is_anonymous)
+ # true, false, or nil
+ if opt.key?(:qualified)
+ var[:schema_qualified] = opt[:qualified].to_s
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb
new file mode 100644
index 00000000..0bb1416d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb
@@ -0,0 +1,199 @@
+# WSDL4R - Creating method definition from WSDL
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'soap/rpc/element'
+require 'soap/rpc/methodDef'
+
+
+module WSDL
+module SOAP
+
+
+class MethodDefCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+ # TODO: should not export this kind of stateful information.
+ # will be rewwritten in 1.6.1
+ attr_reader :assigned_method
+
+ def initialize(definitions, name_creator, modulepath, defined_const)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ @simpletypes = @definitions.collect_simpletypes
+ @complextypes = @definitions.collect_complextypes
+ @elements = @definitions.collect_elements
+ @defined_const = defined_const
+ @assigned_method = {}
+ end
+
+ def dump(name)
+ methoddef = ""
+ porttype = @definitions.porttype(name)
+ binding = porttype.find_binding
+ if binding
+ create(binding.name).each do |mdef|
+ methoddef << ",\n" unless methoddef.empty?
+ methoddef << dump_method(mdef).chomp
+ end
+ end
+ methoddef
+ end
+
+ def create(bindingname)
+ binding = @definitions.binding(bindingname)
+ if binding
+ return binding.operations.collect { |op_bind|
+ next unless op_bind.soapoperation # not a SOAP operation binding
+ create_methoddef(op_bind)
+ }
+ end
+ nil
+ end
+
+private
+
+ def create_methoddef(op_bind)
+ op_info = op_bind.operation_info
+ name = assign_method_name(op_bind)
+ soapaction = op_info.boundid.soapaction
+ qname = op_bind.soapoperation_name
+ mdef = ::SOAP::RPC::MethodDef.new(name, soapaction, qname)
+ op_info.parts.each do |part|
+ if op_info.style == :rpc
+ mapped_class, qname = rpcdefinedtype(part)
+ else
+ mapped_class, qname = documentdefinedtype(part)
+ end
+ mdef.add_parameter(part.io_type, part.name, qname, mapped_class)
+ end
+ op_info.faults.each do |name, faultinfo|
+ faultclass = mapped_class_name(name, @modulepath)
+ mdef.faults[faultclass] = faultinfo
+ end
+ mdef.style = op_info.style
+ mdef.inputuse = op_info.inputuse
+ mdef.outputuse = op_info.outputuse
+ mdef
+ end
+
+ def dump_method(mdef)
+ style = mdef.style
+ inputuse = mdef.inputuse
+ outputuse = mdef.outputuse
+ paramstr = param2str(mdef.parameters)
+ if paramstr.empty?
+ paramstr = '[]'
+ else
+ paramstr = "[ " << paramstr.split(/\r?\n/).join("\n ") << " ]"
+ end
+ definitions = <<__EOD__
+#{ndq(mdef.soapaction)},
+ #{dq(mdef.name)},
+ #{paramstr},
+ { :request_style => #{nsym(style)}, :request_use => #{nsym(inputuse)},
+ :response_style => #{nsym(style)}, :response_use => #{nsym(outputuse)},
+ :faults => #{mdef.faults.inspect} }
+__EOD__
+ if style == :rpc
+ assign_const(mdef.qname.namespace, 'Ns')
+ return <<__EOD__
+[ #{dqname(mdef.qname)},
+ #{definitions}]
+__EOD__
+ else
+ return <<__EOD__
+[ #{definitions}]
+__EOD__
+ end
+ end
+
+ def assign_method_name(op_bind)
+ method_name = safemethodname(op_bind.name)
+ i = 1 # starts from _2
+ while @assigned_method.value?(method_name)
+ i += 1
+ method_name = safemethodname("#{op_bind.name}_#{i}")
+ end
+ @assigned_method[op_bind.boundid] = method_name
+ method_name
+ end
+
+ def rpcdefinedtype(part)
+ if mapped = basetype_mapped_class(part.type)
+ return ['::' + mapped.name, nil]
+ elsif definedtype = @simpletypes[part.type]
+ return [nil, definedtype.name]
+ elsif definedtype = @elements[part.element]
+ return [nil, part.element]
+ elsif definedtype = @complextypes[part.type]
+ case definedtype.compoundtype
+ when :TYPE_STRUCT, :TYPE_EMPTY, :TYPE_ARRAY, :TYPE_SIMPLE
+ type = mapped_class_name(part.type, @modulepath)
+ return [type, part.type]
+ when :TYPE_MAP
+ return [Hash.name, part.type]
+ else
+ raise NotImplementedError.new("must not reach here: #{definedtype.compoundtype}")
+ end
+ elsif part.type == XSD::AnyTypeName
+ return [nil, nil]
+ else
+ raise RuntimeError.new("part: #{part.name} cannot be resolved")
+ end
+ end
+
+ def documentdefinedtype(part)
+ if mapped = basetype_mapped_class(part.type)
+ return ['::' + mapped.name, XSD::QName.new(nil, part.name)]
+ elsif definedtype = @simpletypes[part.type]
+ if definedtype.base
+ return ['::' + basetype_mapped_class(definedtype.base).name, XSD::QName.new(nil, part.name)]
+ else
+ raise RuntimeError.new("unsupported simpleType: #{definedtype}")
+ end
+ elsif definedtype = @elements[part.element]
+ return ['::SOAP::SOAPElement', part.element]
+ elsif definedtype = @complextypes[part.type]
+ return ['::SOAP::SOAPElement', part.type]
+ else
+ raise RuntimeError.new("part: #{part.name} cannot be resolved")
+ end
+ end
+
+ def param2str(params)
+ params.collect { |param|
+ mappingstr = mapping_info2str(param.mapped_class, param.qname)
+ "[:#{param.io_type.id2name}, #{dq(param.name)}, #{mappingstr}]"
+ }.join(",\n")
+ end
+
+ def mapping_info2str(mapped_class, qname)
+ if qname.nil?
+ "[#{ndq(mapped_class)}]"
+ else
+ "[#{ndq(mapped_class)}, #{ndq(qname.namespace)}, #{dq(qname.name)}]"
+ end
+ end
+
+ def ele2str(ele)
+ qualified = ele
+ if qualified
+ "true"
+ else
+ "false"
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb
new file mode 100644
index 00000000..455bd841
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb
@@ -0,0 +1,112 @@
+# WSDL4R - WSDL SOAP operation definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module SOAP
+
+
+class Operation < Info
+ class ParamInfo
+ attr_reader :style
+ attr_reader :op_name
+ attr_reader :optype_name
+ attr_reader :encodingstyle
+ attr_reader :headerparts
+ attr_reader :bodyparts
+ attr_reader :faultpart
+ attr_reader :soapaction
+
+ def initialize(style, use, encodingstyle, op_name, optype_name,
+ headerparts, bodyparts, faultpart, soapaction)
+ @style = style
+ @use = use
+ @encodingstyle = encodingstyle
+ @op_name = op_name
+ @optype_name = optype_name
+ @headerparts = headerparts
+ @bodyparts = bodyparts
+ @faultpart = faultpart
+ @soapaction = soapaction
+ end
+ end
+
+ attr_reader :soapaction
+ attr_reader :style
+
+ def initialize
+ super
+ @soapaction = nil
+ @style = nil
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when StyleAttrName
+ if ["document", "rpc"].include?(value.source)
+ @style = value.source.intern
+ else
+ raise Parser::AttributeConstraintError.new(
+ "Unexpected value #{ value }.")
+ end
+ when SOAPActionAttrName
+ @soapaction = value.source
+ else
+ nil
+ end
+ end
+
+ def operation_style
+ return @style if @style
+ if parent_binding.soapbinding
+ return parent_binding.soapbinding.style
+ end
+ nil
+ end
+
+private
+
+ def parent_binding
+ parent.parent
+ end
+
+ def create_param_info(name_info, param)
+ op_style = operation_style()
+ op_use = param.soapbody_use
+ op_encodingstyle = param.soapbody_encodingstyle
+ op_name = name_info.op_name
+ optype_name = name_info.optype_name
+ soapheader = param.soapheader
+ headerparts = soapheader.collect { |item| item.find_part }
+ soapbody = param.soapbody
+ if soapbody.namespace
+ op_name = XSD::QName.new(soapbody.namespace, op_name.name)
+ end
+ if soapbody.parts
+ target = soapbody.parts.split(/\s+/)
+ bodyparts = name_info.parts.find_all { |part|
+ target.include?(part.name)
+ }
+ else
+ bodyparts = name_info.parts
+ end
+ faultpart = nil
+ ParamInfo.new(op_style, op_use, op_encodingstyle, op_name, optype_name,
+ headerparts, bodyparts, faultpart, parent.soapaction)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb
new file mode 100644
index 00000000..e2d79f02
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb
@@ -0,0 +1,89 @@
+# WSDL4R - Creating servant skelton code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'xsd/codegen'
+
+
+module WSDL
+module SOAP
+
+
+class ServantSkeltonCreator
+ include ClassDefCreatorSupport
+ include XSD::CodeGen::GenSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump(porttype = nil)
+ result = ""
+ if @modulepath
+ result << "\n"
+ result << @modulepath.collect { |ele| "module #{ele}" }.join("; ")
+ result << "\n\n"
+ end
+ if porttype.nil?
+ @definitions.porttypes.each do |porttype|
+ result << dump_porttype(porttype)
+ result << "\n"
+ end
+ else
+ result << dump_porttype(porttype)
+ end
+ if @modulepath
+ result << "\n\n"
+ result << @modulepath.collect { |ele| "end" }.join("; ")
+ result << "\n"
+ end
+ result
+ end
+
+private
+
+ def dump_porttype(porttype)
+ assigned_method = collect_assigned_method(@definitions, porttype.name, @modulepath)
+ class_name = mapped_class_basename(porttype.name, @modulepath)
+ c = XSD::CodeGen::ClassDef.new(class_name)
+ element_definitions = @definitions.collect_elements
+ binding = porttype.find_binding
+ if binding
+ binding.operations.each do |op_bind|
+ operation = op_bind.find_operation
+ if operation.nil?
+ warn("operation not found for binding: #{op_bind}")
+ next
+ end
+ name = assigned_method[op_bind.boundid] || operation.name
+ methodname = safemethodname(name)
+ input = operation.input
+ params = input.find_message.parts.collect { |part|
+ safevarname(part.name)
+ }
+ m = XSD::CodeGen::MethodDef.new(methodname, params) do <<-EOD
+ p [#{params.join(", ")}]
+ raise NotImplementedError.new
+ EOD
+ end
+ m.comment = dump_method_signature(methodname, operation, element_definitions)
+ c.add_method(m)
+ end
+ end
+ c.dump
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb
new file mode 100644
index 00000000..826b2e23
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb
@@ -0,0 +1,104 @@
+# WSDL4R - Creating servlet stub code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreator'
+require 'wsdl/soap/methodDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class ServletStubCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump(service_name)
+ warn("- Servlet stub can have only 1 port for now. So creating stub for the first port and rests are ignored.")
+ services = @definitions.service(service_name)
+ unless services
+ raise RuntimeError.new("service not defined: #{service_name}")
+ end
+ ports = services.ports
+ if ports.empty?
+ raise RuntimeError.new("ports not found for #{service_name}")
+ end
+ port = ports[0]
+ if port.porttype.nil?
+ raise RuntimeError.new("porttype not found for #{port}")
+ end
+ dump_porttype(port.porttype)
+ end
+
+private
+
+ def dump_porttype(porttype)
+ class_name = mapped_class_name(porttype.name, @modulepath)
+ defined_const = {}
+ methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
+ wsdl_name = @definitions.name ? @definitions.name.name : 'default'
+ mrname = safeconstname(wsdl_name + 'MappingRegistry')
+ c1 = XSD::CodeGen::ClassDef.new(class_name)
+ c1.def_require("soap/rpc/soaplet")
+ c1.def_code <<-EOD
+Methods = [
+#{methoddef.gsub(/^/, " ")}
+]
+ EOD
+ defined_const.each do |ns, tag|
+ c1.def_const(tag, dq(ns))
+ end
+ c2 = XSD::CodeGen::ClassDef.new(class_name + "Servlet",
+ "::SOAP::RPC::SOAPlet")
+ c2.def_method("initialize", "router = nil") do
+ <<-EOD
+ super(router)
+ servant = #{class_name}.new
+ #{class_name}::Methods.each do |definitions|
+ opt = definitions.last
+ if opt[:request_style] == :document
+ @router.add_document_operation(servant, *definitions)
+ else
+ @router.add_rpc_operation(servant, *definitions)
+ end
+ end
+ @router.mapping_registry = #{mrname}::EncodedRegistry
+ @router.literal_mapping_registry = #{mrname}::LiteralRegistry
+ EOD
+ end
+ c1.dump + "\n" + c2.dump + format(<<-EOD)
+
+ if $0 == __FILE__
+ require 'webrick'
+ server = WEBrick::HTTPServer.new(
+ :BindAddress => "0.0.0.0",
+ :Port => 10080,
+ :DocumentRoot => "."
+ )
+ server.mount("/", #{c2.name}.new)
+ trap(:INT) do
+ server.shutdown
+ end
+ server.start
+ end
+ EOD
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb
new file mode 100644
index 00000000..169eb2a1
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb
@@ -0,0 +1,100 @@
+# WSDL4R - Creating standalone server stub code from WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/soap/mappingRegistryCreator'
+require 'wsdl/soap/methodDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+
+
+module WSDL
+module SOAP
+
+
+class StandaloneServerStubCreator
+ include ClassDefCreatorSupport
+
+ attr_reader :definitions
+
+ def initialize(definitions, name_creator, modulepath = nil)
+ @definitions = definitions
+ @name_creator = name_creator
+ @modulepath = modulepath
+ end
+
+ def dump(service_name)
+ warn("- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored.")
+ warn("- Standalone server stub ignores port location defined in WSDL. Location is http://localhost:10080/ by default. Generated client from WSDL must be configured to point this endpoint manually.")
+ services = @definitions.service(service_name)
+ unless services
+ raise RuntimeError.new("service not defined: #{service_name}")
+ end
+ ports = services.ports
+ if ports.empty?
+ raise RuntimeError.new("ports not found for #{service_name}")
+ end
+ port = ports[0]
+ if port.porttype.nil?
+ raise RuntimeError.new("porttype not found for #{port}")
+ end
+ dump_porttype(port.porttype)
+ end
+
+private
+
+ def dump_porttype(porttype)
+ class_name = mapped_class_name(porttype.name, @modulepath)
+ defined_const = {}
+ methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
+ wsdl_name = @definitions.name ? @definitions.name.name : 'default'
+ mrname = safeconstname(wsdl_name + 'MappingRegistry')
+ c1 = XSD::CodeGen::ClassDef.new(class_name)
+ c1.def_require("soap/rpc/standaloneServer")
+ c1.def_code <<-EOD
+Methods = [
+#{methoddef.gsub(/^/, " ")}
+]
+ EOD
+ defined_const.each do |ns, tag|
+ c1.def_const(tag, dq(ns))
+ end
+ c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
+ "::SOAP::RPC::StandaloneServer")
+ c2.def_method("initialize", "*arg") do
+ <<-EOD
+ super(*arg)
+ servant = #{class_name}.new
+ #{class_name}::Methods.each do |definitions|
+ opt = definitions.last
+ if opt[:request_style] == :document
+ @router.add_document_operation(servant, *definitions)
+ else
+ @router.add_rpc_operation(servant, *definitions)
+ end
+ end
+ self.mapping_registry = #{mrname}::EncodedRegistry
+ self.literal_mapping_registry = #{mrname}::LiteralRegistry
+ EOD
+ end
+ c1.dump + "\n" + c2.dump + format(<<-EOD)
+
+ if $0 == __FILE__
+ # Change listen port.
+ server = #{class_name}App.new('app', nil, '0.0.0.0', 10080)
+ trap(:INT) do
+ server.shutdown
+ end
+ server.start
+ end
+ EOD
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb
new file mode 100644
index 00000000..6b63322d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb
@@ -0,0 +1,217 @@
+# WSDL4R - WSDL to ruby mapping library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'logger'
+require 'xsd/qname'
+require 'wsdl/importer'
+require 'wsdl/soap/classDefCreator'
+require 'wsdl/soap/servantSkeltonCreator'
+require 'wsdl/soap/driverCreator'
+require 'wsdl/soap/clientSkeltonCreator'
+require 'wsdl/soap/standaloneServerStubCreator'
+require 'wsdl/soap/servletStubCreator'
+require 'wsdl/soap/cgiStubCreator'
+require 'wsdl/soap/classNameCreator'
+
+
+module WSDL
+module SOAP
+
+
+class WSDL2Ruby
+ attr_accessor :location
+ attr_reader :opt
+ attr_accessor :logger
+ attr_accessor :basedir
+
+ def run
+ unless @location
+ raise RuntimeError, "WSDL location not given"
+ end
+ @wsdl = import(@location)
+ if @opt['classdef']
+ @name = @opt['classdef']
+ else
+ @name = @wsdl.name ? @wsdl.name.name : 'default'
+ end
+ create_file
+ end
+
+private
+
+ def initialize
+ @modulepath = nil
+ @location = nil
+ @opt = {}
+ @logger = Logger.new(STDERR)
+ @basedir = nil
+ @wsdl = nil
+ @name = nil
+ @classdef_filename = nil
+ @mr_filename = nil
+ @name_creator = ClassNameCreator.new
+ end
+
+ def create_file
+ @modulepath = @opt['module_path']
+ create_classdef if @opt.key?('classdef')
+ create_mapping_registry if @opt.key?('mapping_registry')
+ create_servant_skelton(@opt['servant_skelton']) if @opt.key?('servant_skelton')
+ create_cgi_stub(@opt['cgi_stub']) if @opt.key?('cgi_stub')
+ create_standalone_server_stub(@opt['standalone_server_stub']) if @opt.key?('standalone_server_stub')
+ create_servlet_stub(@opt['servlet_stub']) if @opt.key?('servlet_stub')
+ create_driver(@opt['driver'], @opt['drivername_postfix'] || '') if @opt.key?('driver')
+ create_client_skelton(@opt['client_skelton']) if @opt.key?('client_skelton')
+ end
+
+ def create_classdef
+ @logger.info { "Creating class definition." }
+ @classdef_filename = @name + '.rb'
+ check_file(@classdef_filename) or return
+ write_file(@classdef_filename) do |f|
+ f << WSDL::SOAP::ClassDefCreator.new(@wsdl, @name_creator, @modulepath).dump
+ end
+ end
+
+ def create_mapping_registry
+ @logger.info { "Creating mapping registry definition." }
+ @mr_filename = @name + 'MappingRegistry.rb'
+ check_file(@mr_filename) or return
+ write_file(@mr_filename) do |f|
+ f << "require '#{@classdef_filename}'\n" if @classdef_filename
+ f << WSDL::SOAP::MappingRegistryCreator.new(@wsdl, @name_creator, @modulepath).dump
+ end
+ end
+
+ def create_client_skelton(servicename)
+ return if @wsdl.services.empty?
+ @logger.info { "Creating client skelton." }
+ servicename ||= @wsdl.services[0].name.name
+ @client_skelton_filename = servicename + 'Client.rb'
+ check_file(@client_skelton_filename) or return
+ write_file(@client_skelton_filename) do |f|
+ f << shbang << "\n"
+ f << "require '#{@driver_filename}'\n\n" if @driver_filename
+ f << WSDL::SOAP::ClientSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
+ end
+ end
+
+ def create_servant_skelton(porttypename)
+ @logger.info { "Creating servant skelton." }
+ @servant_skelton_filename = (porttypename || @name + 'Servant') + '.rb'
+ check_file(@servant_skelton_filename) or return
+ write_file(@servant_skelton_filename) do |f|
+ f << "require '#{@classdef_filename}'\n\n" if @classdef_filename
+ f << WSDL::SOAP::ServantSkeltonCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(porttypename))
+ end
+ end
+
+ def create_cgi_stub(servicename)
+ @logger.info { "Creating CGI stub." }
+ servicename ||= @wsdl.services[0].name.name
+ @cgi_stubFilename = servicename + '.cgi'
+ check_file(@cgi_stubFilename) or return
+ write_file(@cgi_stubFilename) do |f|
+ f << shbang << "\n"
+ f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
+ f << "require '#{@mr_filename}'\n" if @mr_filename
+ f << WSDL::SOAP::CGIStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
+ end
+ end
+
+ def create_standalone_server_stub(servicename)
+ @logger.info { "Creating standalone stub." }
+ servicename ||= @wsdl.services[0].name.name
+ @standalone_server_stub_filename = servicename + '.rb'
+ check_file(@standalone_server_stub_filename) or return
+ write_file(@standalone_server_stub_filename) do |f|
+ f << shbang << "\n"
+ f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
+ f << "require '#{@mr_filename}'\n" if @mr_filename
+ f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
+ end
+ end
+
+ def create_servlet_stub(servicename)
+ @logger.info { "Creating servlet stub." }
+ servicename ||= @wsdl.services[0].name.name
+ @servlet_stub_filename = servicename + 'Servlet.rb'
+ check_file(@servlet_stub_filename) or return
+ write_file(@servlet_stub_filename) do |f|
+ f << shbang << "\n"
+ f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename
+ f << "require '#{@mr_filename}'\n" if @mr_filename
+ f << WSDL::SOAP::ServletStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename))
+ end
+ end
+
+ def create_driver(porttypename, drivername_postfix)
+ @logger.info { "Creating driver." }
+ @driver_filename = (porttypename || @name) + 'Driver.rb'
+ creator = WSDL::SOAP::DriverCreator.new(@wsdl, @name_creator, @modulepath)
+ creator.drivername_postfix = drivername_postfix
+ check_file(@driver_filename) or return
+ write_file(@driver_filename) do |f|
+ f << "require '#{@classdef_filename}'\n" if @classdef_filename
+ f << "require '#{@mr_filename}'\n" if @mr_filename
+ f << creator.dump(create_name(porttypename))
+ end
+ end
+
+ def write_file(filename)
+ if @basedir
+ filename = File.join(basedir, filename)
+ end
+ File.open(filename, "w") do |f|
+ yield f
+ end
+ end
+
+ def check_file(filename)
+ if @basedir
+ filename = File.join(basedir, filename)
+ end
+ if FileTest.exist?(filename)
+ if @opt.key?('force')
+ @logger.warn {
+ "File '#{filename}' exists but overrides it."
+ }
+ true
+ else
+ @logger.warn {
+ "File '#{filename}' exists. #{$0} did not override it."
+ }
+ false
+ end
+ else
+ @logger.info { "Creates file '#{filename}'." }
+ true
+ end
+ end
+
+ def shbang
+ "#!/usr/bin/env ruby"
+ end
+
+ def create_name(name)
+ name ? XSD::QName.new(@wsdl.targetnamespace, name) : nil
+ end
+
+ def import(location)
+ WSDL::Importer.import(location)
+ end
+end
+
+
+end
+end
+
+
+if __FILE__ == $0
+ warn("WARNING: #{File.expand_path(__FILE__)} is a library file used by bin/wsdl2ruby.rb. Find bin/wsdl2ruby.rb from tarball version of soap4r or install soap4r via gem.")
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb
new file mode 100644
index 00000000..0b77997a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb
@@ -0,0 +1,44 @@
+# WSDL4R - WSDL types definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+
+
+class Types < Info
+ attr_reader :schemas
+
+ def initialize
+ super
+ @schemas = []
+ end
+
+ def parse_element(element)
+ case element
+ when SchemaName
+ o = XMLSchema::Schema.new
+ o.location = parent.location
+ @schemas << o
+ o
+ when DocumentationName
+ o = Documentation.new
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ nil
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb
new file mode 100644
index 00000000..f9356c82
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb
@@ -0,0 +1,24 @@
+# WSDL4R - Base definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'soap/nestedexception'
+
+
+module WSDL
+
+
+Version = '0.0.2'
+
+Namespace = 'http://schemas.xmlsoap.org/wsdl/'
+SOAPBindingNamespace ='http://schemas.xmlsoap.org/wsdl/soap/'
+
+class Error < StandardError; include ::SOAP::NestedException; end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb
new file mode 100644
index 00000000..5e987592
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb
@@ -0,0 +1,24 @@
+# WSDL4R - XMLSchema complexType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/content'
+
+
+module WSDL
+module XMLSchema
+
+
+class All < Content
+ def initialize
+ super()
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb
new file mode 100644
index 00000000..4e2341a8
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb
@@ -0,0 +1,34 @@
+# WSDL4R - WSDL SOAP documentation element.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Annotation < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ # Accepts any element.
+ self
+ end
+
+ def parse_attr(attr, value)
+ # Accepts any attribute.
+ true
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb
new file mode 100644
index 00000000..59322d26
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb
@@ -0,0 +1,61 @@
+# WSDL4R - XMLSchema any definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Any < Info
+ attr_accessor :maxoccurs
+ attr_accessor :minoccurs
+ attr_accessor :namespace
+ attr_accessor :process_contents
+
+ def initialize
+ super()
+ @maxoccurs = 1
+ @minoccurs = 1
+ @namespace = '##any'
+ @process_contents = 'strict'
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MaxOccursAttrName
+ if value.source == 'unbounded'
+ @maxoccurs = nil
+ else
+ @maxoccurs = Integer(value.source)
+ end
+ value.source
+ when MinOccursAttrName
+ @minoccurs = Integer(value.source)
+ when NamespaceAttrName
+ @namespace = value.source
+ when ProcessContentsAttrName
+ @process_contents = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb
new file mode 100644
index 00000000..12da3952
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb
@@ -0,0 +1,48 @@
+# WSDL4R - XMLSchema anyAttribute definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class AnyAttribute < Info
+ attr_accessor :namespace
+ attr_accessor :processcontents
+
+ def initialize
+ super()
+ @namespace = '##any'
+ @processcontents = 'strict'
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NamespaceAttrName
+ @namespace = value.source
+ when ProcessContentsAttrName
+ @processcontents = value.source
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb
new file mode 100644
index 00000000..8b7ddebf
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb
@@ -0,0 +1,104 @@
+# WSDL4R - XMLSchema attribute definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/ref'
+
+
+module WSDL
+module XMLSchema
+
+
+class Attribute < Info
+ include Ref
+
+ attr_writer :use
+ attr_writer :form
+ attr_writer :name
+ attr_writer :type
+ attr_writer :local_simpletype
+ attr_writer :default
+ attr_writer :fixed
+
+ attr_reader_ref :use
+ attr_reader_ref :form
+ attr_reader_ref :name
+ attr_reader_ref :type
+ attr_reader_ref :local_simpletype
+ attr_reader_ref :default
+ attr_reader_ref :fixed
+
+ attr_accessor :arytype
+
+ def initialize
+ super
+ @use = nil
+ @form = nil
+ @name = nil
+ @type = nil
+ @local_simpletype = nil
+ @default = nil
+ @fixed = nil
+ @ref = nil
+ @refelement = nil
+ @arytype = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when SimpleTypeName
+ @local_simpletype = SimpleType.new
+ @local_simpletype
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when RefAttrName
+ @ref = value
+ when UseAttrName
+ @use = value.source
+ when FormAttrName
+ @form = value.source
+ when NameAttrName
+ if directelement?
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ @name = XSD::QName.new(nil, value.source)
+ end
+ when TypeAttrName
+ @type = value
+ when DefaultAttrName
+ @default = value.source
+ when FixedAttrName
+ @fixed = value.source
+ when ArrayTypeAttrName
+ @arytype = value
+ else
+ nil
+ end
+ end
+
+private
+
+ def directelement?
+ parent.is_a?(Schema)
+ end
+
+ def refelement
+ @refelement ||= root.collect_attributes[@ref]
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb
new file mode 100644
index 00000000..dfb922c7
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb
@@ -0,0 +1,68 @@
+# WSDL4R - XMLSchema attributeGroup definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/ref'
+
+
+module WSDL
+module XMLSchema
+
+
+class AttributeGroup < Info
+ include Ref
+
+ attr_writer :name # required
+ attr_writer :attributes
+
+ attr_reader_ref :name
+ attr_reader_ref :attributes
+
+ def initialize
+ super
+ @name = nil
+ @attributes = nil
+ @ref = nil
+ @refelement = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when AttributeName
+ @attributes ||= XSD::NamedElements.new
+ o = Attribute.new
+ @attributes << o
+ o
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when RefAttrName
+ @ref = value
+ else
+ nil
+ end
+ end
+
+private
+
+ def refelement
+ @refelement ||= root.collect_attributegroups[@ref]
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb
new file mode 100644
index 00000000..062b6fa2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb
@@ -0,0 +1,58 @@
+# WSDL4R - XMLSchema complexType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/content'
+
+
+module WSDL
+module XMLSchema
+
+
+class Choice < Content
+ attr_reader :any
+
+ def initialize
+ super()
+ @any = nil
+ end
+
+ def have_any?
+ !!@any
+ end
+
+ def choice?
+ true
+ end
+
+ def parse_element(element)
+ case element
+ when SequenceName
+ o = Sequence.new
+ @elements << o
+ o
+ when ChoiceName
+ o = Choice.new
+ @elements << o
+ o
+ when GroupName
+ o = Group.new
+ @elements << o
+ o
+ when AnyName
+ @any = Any.new
+ @elements << @any
+ @any
+ else
+ super(element)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb
new file mode 100644
index 00000000..34a3a61f
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb
@@ -0,0 +1,97 @@
+# WSDL4R - XMLSchema complexContent definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class ComplexContent < Info
+ attr_accessor :restriction
+ attr_accessor :extension
+ attr_accessor :mixed
+
+ def initialize
+ super
+ @restriction = nil
+ @extension = nil
+ @mixed = false
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def content
+ @extension || @restriction
+ end
+
+ def base
+ content ? content.base : nil
+ end
+
+ def have_any?
+ content ? content.have_any? : nil
+ end
+
+ def choice?
+ content ? content.choice? : nil
+ end
+
+ def elements
+ content ? content.elements : XSD::NamedElements::Empty
+ end
+
+ def attributes
+ content ? content.attributes : XSD::NamedElements::Empty
+ end
+
+ def nested_elements
+ # restrict and extension does not have particle.
+ content ? content.nested_elements : XSD::NamedElements::Empty
+ end
+
+ def check_type
+ if content
+ content.check_type
+ else
+ raise ArgumentError.new("incomplete complexContent")
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when RestrictionName
+ raise ArgumentError.new("incomplete complexContent") if content
+ @restriction = ComplexRestriction.new
+ when ExtensionName
+ raise ArgumentError.new("incomplete complexContent") if content
+ @extension = ComplexExtension.new
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MixedAttrName
+ @mixed = to_boolean(value)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb
new file mode 100644
index 00000000..23b68abf
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb
@@ -0,0 +1,119 @@
+# WSDL4R - XMLSchema complexType extension definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class ComplexExtension < Info
+ attr_accessor :base
+ attr_reader :content
+
+ def initialize
+ super
+ @base = nil
+ @basetype = nil
+ @content = nil
+ @attributes = XSD::NamedElements.new
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def have_any?
+ basetype.have_any? or (content && content.have_any?)
+ end
+
+ def choice?
+ content and content.choice?
+ end
+
+ def elements
+ result = XSD::NamedElements.new
+ result.concat(basetype.elements)
+ result.concat(content.elements) if content
+ result
+ end
+
+ def nested_elements
+ result = XSD::NamedElements.new
+ result.concat(basetype.nested_elements)
+ result.concat(content.nested_elements) if content
+ result
+ end
+
+ def attributes
+ basetype.attributes + @attributes
+ end
+
+ def check_type
+ if @base == ::SOAP::ValueArrayName
+ :TYPE_ARRAY
+ elsif content or !@attributes.empty?
+ :TYPE_STRUCT
+ else
+ basetype.check_type
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when AllName
+ @content = All.new
+ @content
+ when SequenceName
+ @content = Sequence.new
+ @content
+ when ChoiceName
+ @content = Choice.new
+ @content
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributes << o
+ o
+ when AnyAttributeName
+ o = AnyAttribute.new
+ @attributes << o
+ o
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when BaseAttrName
+ @base = value
+ end
+ end
+
+private
+
+ def basetype
+ @basetype ||= root.collect_complextypes[@base]
+ unless @basetype
+ raise RuntimeError.new("base type definition not found: #{@base}")
+ end
+ @basetype
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb
new file mode 100644
index 00000000..c12cc0fc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb
@@ -0,0 +1,104 @@
+# WSDL4R - XMLSchema complexType restriction definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class ComplexRestriction < Info
+ attr_accessor :base
+ attr_reader :content
+ attr_reader :attributes
+
+ def initialize
+ super
+ @base = nil
+ @basetype = nil
+ @content = nil
+ @attributes = XSD::NamedElements.new
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def have_any?
+ @content and @content.have_any?
+ end
+
+ def choice?
+ @content and @content.choice?
+ end
+
+ def elements
+ @content ? @content.elements : XSD::NamedElements::Empty
+ end
+
+ def nested_elements
+ @content ? @content.nested_elements : XSD::NamedElements::Empty
+ end
+
+ def check_type
+ if @base == ::SOAP::ValueArrayName
+ :TYPE_ARRAY
+ else
+ basetype.check_type if basetype
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when AllName
+ @content = All.new
+ @content
+ when SequenceName
+ @content = Sequence.new
+ @content
+ when ChoiceName
+ @content = Choice.new
+ @content
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributes << o
+ o
+ when AnyAttributeName
+ o = AnyAttribute.new
+ @attributes << o
+ o
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when BaseAttrName
+ @base = value
+ end
+ end
+
+private
+
+ def basetype
+ @basetype ||= root.collect_complextypes[@base]
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb
new file mode 100644
index 00000000..79374f7c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb
@@ -0,0 +1,193 @@
+# WSDL4R - XMLSchema complexType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/element'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class ComplexType < Info
+ attr_accessor :name
+ attr_accessor :complexcontent
+ attr_accessor :simplecontent
+ attr_reader :content
+ attr_accessor :final
+ attr_accessor :mixed
+ attr_accessor :abstract
+
+ def initialize(name = nil)
+ super()
+ @name = name
+ @complexcontent = nil
+ @simplecontent = nil
+ @content = nil
+ @final = nil
+ @mixed = false
+ @abstract = false
+ @attributes = XSD::NamedElements.new
+ end
+
+ def targetnamespace
+ # inner elements can be qualified
+ # parent.is_a?(WSDL::XMLSchema::Element) ? nil : parent.targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def have_any?
+ if c = @complexcontent || @content
+ c.have_any?
+ else
+ false
+ end
+ end
+
+ def choice?
+ if c = @complexcontent || @content
+ c.choice?
+ else
+ false
+ end
+ end
+
+ def base
+ if c = @complexcontent || @simplecontent
+ c.base
+ end
+ end
+
+ def elements
+ if c = @complexcontent || @content
+ c.elements
+ else
+ XSD::NamedElements::Empty
+ end
+ end
+
+ def attributes
+ attrs = nil
+ if @complexcontent
+ attrs = @complexcontent.attributes + @attributes
+ elsif @simplecontent
+ attrs = @simplecontent.attributes + @attributes
+ else
+ attrs = @attributes
+ end
+ found = XSD::NamedElements.new
+ attrs.each do |attr|
+ case attr
+ when Attribute
+ found << attr
+ when AttributeGroup
+ if attr.attributes
+ found.concat(attr.attributes)
+ end
+ when AnyAttribute
+ # ignored
+ else
+ warn("unknown attribute: #{attr}")
+ end
+ end
+ found
+ end
+
+ def nested_elements
+ if c = @complexcontent || @content
+ c.nested_elements
+ else
+ XSD::NamedElements::Empty
+ end
+ end
+
+ def find_element(name)
+ return nil if name.nil?
+ elements.each do |element|
+ return element if name == element.name
+ end
+ nil
+ end
+
+ def find_element_by_name(name)
+ return nil if name.nil?
+ elements.each do |element|
+ return element if name == element.name.name
+ end
+ nil
+ end
+
+ def sequence_elements=(elements)
+ @content = Sequence.new
+ elements.each do |element|
+ @content << element
+ end
+ end
+
+ def all_elements=(elements)
+ @content = All.new
+ elements.each do |element|
+ @content << element
+ end
+ end
+
+ def parse_element(element)
+ case element
+ when AllName
+ @content = All.new
+ when SequenceName
+ @content = Sequence.new
+ when ChoiceName
+ @content = Choice.new
+ when GroupName
+ @content = Group.new
+ when ComplexContentName
+ @complexcontent = ComplexContent.new
+ when SimpleContentName
+ @simplecontent = SimpleContent.new
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributes << o
+ o
+ when AnyAttributeName
+ o = AnyAttribute.new
+ @attributes << o
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when AbstractAttrName
+ @abstract = to_boolean(value)
+ when FinalAttrName
+ @final = value.source
+ when MixedAttrName
+ @mixed = to_boolean(value)
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb
new file mode 100644
index 00000000..2583ddb0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb
@@ -0,0 +1,95 @@
+# WSDL4R - XMLSchema content base definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Content < Info
+ attr_reader :minoccurs
+ attr_reader :maxoccurs
+ attr_reader :elements
+
+ def initialize
+ super()
+ @minoccurs = 1
+ @maxoccurs = 1
+ @elements = XSD::NamedElements.new
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def have_any?
+ false
+ end
+
+ def choice?
+ false
+ end
+
+ def map_as_array?
+ maxoccurs.nil? or maxoccurs != 1
+ end
+
+ def nested_elements
+ elements = XSD::NamedElements.new
+ @elements.each do |ele|
+ if ele.respond_to?(:nested_elements)
+ elements.concat(ele.nested_elements)
+ else
+ elements << ele
+ end
+ end
+ elements
+ end
+
+ def <<(element)
+ @elements << element
+ end
+
+ def parse_element(element)
+ case element
+ when ElementName
+ o = Element.new
+ o.form = elementformdefault
+ @elements << o
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MaxOccursAttrName
+ if value.source == 'unbounded'
+ @maxoccurs = nil
+ else
+ @maxoccurs = Integer(value.source)
+ end
+ value.source
+ when MinOccursAttrName
+ @minoccurs = Integer(value.source)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb
new file mode 100644
index 00000000..bf2dd62e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb
@@ -0,0 +1,116 @@
+# WSDL4R - XMLSchema data definitions.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+require 'wsdl/xmlSchema/annotation'
+require 'wsdl/xmlSchema/schema'
+require 'wsdl/xmlSchema/import'
+require 'wsdl/xmlSchema/include'
+require 'wsdl/xmlSchema/simpleType'
+require 'wsdl/xmlSchema/simpleRestriction'
+require 'wsdl/xmlSchema/simpleExtension'
+require 'wsdl/xmlSchema/complexType'
+require 'wsdl/xmlSchema/complexContent'
+require 'wsdl/xmlSchema/complexRestriction'
+require 'wsdl/xmlSchema/complexExtension'
+require 'wsdl/xmlSchema/simpleContent'
+require 'wsdl/xmlSchema/any'
+require 'wsdl/xmlSchema/anyAttribute'
+require 'wsdl/xmlSchema/element'
+require 'wsdl/xmlSchema/all'
+require 'wsdl/xmlSchema/choice'
+require 'wsdl/xmlSchema/sequence'
+require 'wsdl/xmlSchema/list'
+require 'wsdl/xmlSchema/attribute'
+require 'wsdl/xmlSchema/union'
+require 'wsdl/xmlSchema/unique'
+require 'wsdl/xmlSchema/group'
+require 'wsdl/xmlSchema/attributeGroup'
+
+require 'wsdl/xmlSchema/length'
+require 'wsdl/xmlSchema/minlength'
+require 'wsdl/xmlSchema/maxlength'
+require 'wsdl/xmlSchema/pattern'
+require 'wsdl/xmlSchema/enumeration'
+require 'wsdl/xmlSchema/whitespace'
+require 'wsdl/xmlSchema/maxinclusive'
+require 'wsdl/xmlSchema/maxexclusive'
+require 'wsdl/xmlSchema/minexclusive'
+require 'wsdl/xmlSchema/mininclusive'
+require 'wsdl/xmlSchema/totaldigits'
+require 'wsdl/xmlSchema/fractiondigits'
+
+module WSDL
+module XMLSchema
+
+
+AllName = XSD::QName.new(XSD::Namespace, 'all')
+AnnotationName = XSD::QName.new(XSD::Namespace, 'annotation')
+AnyName = XSD::QName.new(XSD::Namespace, 'any')
+AnyAttributeName = XSD::QName.new(XSD::Namespace, 'anyAttribute')
+AttributeName = XSD::QName.new(XSD::Namespace, 'attribute')
+AttributeGroupName = XSD::QName.new(XSD::Namespace, 'attributeGroup')
+ChoiceName = XSD::QName.new(XSD::Namespace, 'choice')
+ComplexContentName = XSD::QName.new(XSD::Namespace, 'complexContent')
+ComplexTypeName = XSD::QName.new(XSD::Namespace, 'complexType')
+ElementName = XSD::QName.new(XSD::Namespace, 'element')
+ExtensionName = XSD::QName.new(XSD::Namespace, 'extension')
+GroupName = XSD::QName.new(XSD::Namespace, 'group')
+ImportName = XSD::QName.new(XSD::Namespace, 'import')
+IncludeName = XSD::QName.new(XSD::Namespace, 'include')
+ListName = XSD::QName.new(XSD::Namespace, 'list')
+RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction')
+SequenceName = XSD::QName.new(XSD::Namespace, 'sequence')
+SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
+SimpleContentName = XSD::QName.new(XSD::Namespace, 'simpleContent')
+SimpleTypeName = XSD::QName.new(XSD::Namespace, 'simpleType')
+UnionName = XSD::QName.new(XSD::Namespace, 'union')
+UniqueName = XSD::QName.new(XSD::Namespace, 'unique')
+
+LengthName = XSD::QName.new(XSD::Namespace, 'length')
+MinLengthName = XSD::QName.new(XSD::Namespace, 'minLength')
+MaxLengthName = XSD::QName.new(XSD::Namespace, 'maxLength')
+PatternName = XSD::QName.new(XSD::Namespace, 'pattern')
+EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration')
+WhiteSpaceName = XSD::QName.new(XSD::Namespace, 'whiteSpace')
+MaxInclusiveName = XSD::QName.new(XSD::Namespace, 'maxInclusive')
+MaxExclusiveName = XSD::QName.new(XSD::Namespace, 'maxExclusive')
+MinExclusiveName = XSD::QName.new(XSD::Namespace, 'minExclusive')
+MinInclusiveName = XSD::QName.new(XSD::Namespace, 'minInclusive')
+TotalDigitsName = XSD::QName.new(XSD::Namespace, 'totalDigits')
+FractionDigitsName = XSD::QName.new(XSD::Namespace, 'fractionDigits')
+
+AbstractAttrName = XSD::QName.new(nil, 'abstract')
+AttributeFormDefaultAttrName = XSD::QName.new(nil, 'attributeFormDefault')
+BaseAttrName = XSD::QName.new(nil, 'base')
+DefaultAttrName = XSD::QName.new(nil, 'default')
+ElementFormDefaultAttrName = XSD::QName.new(nil, 'elementFormDefault')
+FinalAttrName = XSD::QName.new(nil, 'final')
+FixedAttrName = XSD::QName.new(nil, 'fixed')
+FormAttrName = XSD::QName.new(nil, 'form')
+IdAttrName = XSD::QName.new(nil, 'id')
+ItemTypeAttrName = XSD::QName.new(nil, 'itemType')
+MaxOccursAttrName = XSD::QName.new(nil, 'maxOccurs')
+MemberTypesAttrName = XSD::QName.new(nil, 'memberTypes')
+MinOccursAttrName = XSD::QName.new(nil, 'minOccurs')
+MixedAttrName = XSD::QName.new(nil, 'mixed')
+NameAttrName = XSD::QName.new(nil, 'name')
+NamespaceAttrName = XSD::QName.new(nil, 'namespace')
+NillableAttrName = XSD::QName.new(nil, 'nillable')
+ProcessContentsAttrName = XSD::QName.new(nil, 'processContents')
+RefAttrName = XSD::QName.new(nil, 'ref')
+SchemaLocationAttrName = XSD::QName.new(nil, 'schemaLocation')
+TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace')
+TypeAttrName = XSD::QName.new(nil, 'type')
+UseAttrName = XSD::QName.new(nil, 'use')
+ValueAttrName = XSD::QName.new(nil, 'value')
+VersionAttrName = XSD::QName.new(nil, 'version')
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb
new file mode 100644
index 00000000..70919fec
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb
@@ -0,0 +1,153 @@
+# WSDL4R - XMLSchema element definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/ref'
+
+
+module WSDL
+module XMLSchema
+
+
+class Element < Info
+ include Ref
+
+ attr_writer :name # required
+ attr_writer :form
+ attr_writer :type
+ attr_writer :local_simpletype
+ attr_writer :local_complextype
+ attr_writer :constraint
+ attr_accessor :maxoccurs
+ attr_accessor :minoccurs
+ attr_writer :nillable
+
+ attr_reader_ref :name
+ attr_reader_ref :form
+ attr_reader_ref :type
+ attr_reader_ref :local_simpletype
+ attr_reader_ref :local_complextype
+ attr_reader_ref :constraint
+ attr_reader_ref :nillable
+ attr_reader_ref :default
+ attr_reader_ref :abstract
+
+ def initialize(name = nil, type = nil)
+ super()
+ @name = name
+ @form = nil
+ @type = type
+ @local_simpletype = @local_complextype = nil
+ @constraint = nil
+ @maxoccurs = 1
+ @minoccurs = 1
+ @nillable = nil
+ @default = nil
+ @abstract = false
+ @ref = nil
+ @refelement = nil
+ end
+
+ def empty?
+ !(local_simpletype || local_complextype || constraint || type)
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def elementform
+ self.form.nil? ? parent.elementformdefault : self.form
+ end
+
+ def parse_element(element)
+ case element
+ when SimpleTypeName
+ @local_simpletype = SimpleType.new
+ @local_simpletype
+ when ComplexTypeName
+ @type = nil
+ @local_complextype = ComplexType.new
+ @local_complextype
+ when UniqueName
+ @constraint = Unique.new
+ @constraint
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ # namespace may be nil
+ if directelement? or elementform == 'qualified'
+ @name = XSD::QName.new(targetnamespace, value.source)
+ else
+ @name = XSD::QName.new(nil, value.source)
+ end
+ when FormAttrName
+ @form = value.source
+ if @form != 'qualified' and @name.namespace
+ @name = XSD::QName.new(nil, @name.name)
+ end
+ @form
+ when TypeAttrName
+ @type = value
+ when RefAttrName
+ @ref = value
+ when MaxOccursAttrName
+ if parent.is_a?(All)
+ if value.source != '1'
+ raise Parser::AttributeConstraintError.new(
+ "cannot parse #{value} for #{attr}")
+ end
+ end
+ if value.source == 'unbounded'
+ @maxoccurs = nil
+ else
+ @maxoccurs = Integer(value.source)
+ end
+ value.source
+ when MinOccursAttrName
+ if parent.is_a?(All)
+ unless ['0', '1'].include?(value.source)
+ raise Parser::AttributeConstraintError.new(
+ "cannot parse #{value} for #{attr}")
+ end
+ end
+ @minoccurs = Integer(value.source)
+ when NillableAttrName
+ @nillable = to_boolean(value)
+ when DefaultAttrName
+ @default = value.source
+ when AbstractAttrName
+ @abstract = to_boolean(value)
+ else
+ nil
+ end
+ end
+
+private
+
+ def directelement?
+ parent.is_a?(Schema)
+ end
+
+ def refelement
+ @refelement ||= (@ref ? root.collect_elements[@ref] : nil)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb
new file mode 100644
index 00000000..592c2c2f
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb
@@ -0,0 +1,36 @@
+# WSDL4R - XMLSchema enumeration definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Enumeration < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when ValueAttrName
+ parent.enumeration << value.source
+ value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb
new file mode 100644
index 00000000..d0c5a2c7
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema fractionDigits definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class FractionDigits < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:fractiondigits] = to_boolean(value)
+ when ValueAttrName
+ parent.fractiondigits = to_int(value)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb
new file mode 100644
index 00000000..af120097
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb
@@ -0,0 +1,100 @@
+# WSDL4R - XMLSchema group definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/ref'
+
+
+module WSDL
+module XMLSchema
+
+
+class Group < Info
+ include Ref
+
+ attr_writer :name # required
+ attr_accessor :maxoccurs
+ attr_accessor :minoccurs
+ attr_writer :content
+
+ attr_reader_ref :name
+ attr_reader_ref :content
+
+ def initialize(name = nil)
+ super()
+ @name = name
+ @maxoccurs = 1
+ @minoccurs = 1
+ @content = nil
+ @ref = nil
+ @refelement = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def elementformdefault
+ parent.elementformdefault
+ end
+
+ def parse_element(element)
+ case element
+ when AllName
+ @content = All.new
+ when SequenceName
+ @content = Sequence.new
+ when ChoiceName
+ @content = Choice.new
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ when RefAttrName
+ @ref = value
+ when MaxOccursAttrName
+ if parent.is_a?(All)
+ if value.source != '1'
+ raise Parser::AttributeConstraintError.new(
+ "cannot parse #{value} for #{attr}")
+ end
+ end
+ if value.source == 'unbounded'
+ @maxoccurs = nil
+ else
+ @maxoccurs = Integer(value.source)
+ end
+ value.source
+ when MinOccursAttrName
+ if parent.is_a?(All)
+ unless ['0', '1'].include?(value.source)
+ raise Parser::AttributeConstraintError.new(
+ "cannot parse #{value} for #{attr}")
+ end
+ end
+ @minoccurs = Integer(value.source)
+ else
+ nil
+ end
+ end
+
+private
+
+ def refelement
+ @refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb
new file mode 100644
index 00000000..b17d3a5a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb
@@ -0,0 +1,53 @@
+# WSDL4R - XMLSchema import definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/importer'
+require 'wsdl/xmlSchema/importHandler'
+
+
+module WSDL
+module XMLSchema
+
+
+class Import < Info
+ attr_reader :namespace
+
+ def initialize
+ super
+ @namespace = nil
+ @handler = ImportHandler.new
+ end
+
+ def schemalocation
+ @handler.schemalocation
+ end
+
+ def content
+ @handler.content
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NamespaceAttrName
+ @namespace = value.source
+ when SchemaLocationAttrName
+ @handler.parse_schemalocation(value.source, root, parent)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb
new file mode 100644
index 00000000..b6fb39da
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb
@@ -0,0 +1,45 @@
+# WSDL4R - XMLSchema import handler.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/importer'
+
+
+module WSDL
+module XMLSchema
+
+
+class ImportHandler
+ attr_reader :schemalocation
+ attr_reader :content
+
+ def initialize
+ @schemalocation = nil
+ @content = nil
+ end
+
+ def parse_schemalocation(location, root, parent)
+ @schemalocation = URI.parse(location)
+ if @schemalocation.relative? and !parent.location.nil? and
+ !parent.location.relative?
+ @schemalocation = parent.location + @schemalocation
+ end
+ if root.importedschema.key?(@schemalocation)
+ @content = root.importedschema[@schemalocation]
+ else
+ root.importedschema[@schemalocation] = nil # placeholder
+ @content = Importer.import(@schemalocation, root)
+ root.importedschema[@schemalocation] = @content
+ end
+ @schemalocation
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb
new file mode 100644
index 00000000..20e5eda6
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb
@@ -0,0 +1,102 @@
+# WSDL4R - XSD importer library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'soap/soap'
+require 'soap/httpconfigloader'
+require 'wsdl/xmlSchema/parser'
+
+
+module WSDL
+module XMLSchema
+
+
+class Importer
+ DO_NOT_IMPORT = [::SOAP::EncodingNamespace]
+
+ def self.import(location, originalroot = nil)
+ new.import(location, originalroot)
+ end
+
+ def initialize
+ @web_client = nil
+ end
+
+ def import(location, originalroot = nil)
+ if DO_NOT_IMPORT.include?(location.to_s)
+ return nil
+ end
+ unless location.is_a?(URI)
+ location = URI.parse(location)
+ end
+ source, normalizedlocation = fetch(location)
+ content = parse(source, normalizedlocation, originalroot)
+ content.location = normalizedlocation
+ content
+ end
+
+private
+
+ def parse(content, location, originalroot)
+ opt = {
+ :location => location,
+ :originalroot => originalroot
+ }
+ WSDL::XMLSchema::Parser.new(opt).parse(content)
+ end
+
+ def fetch(location)
+ warn("importing: #{location}") if $DEBUG
+ content = nil
+ normalizedlocation = location
+ if location.scheme == 'file' or
+ (location.relative? and FileTest.exist?(location.path))
+ content = File.open(location.path).read
+ normalizedlocation = URI.parse('file://' + File.expand_path(location.path))
+ elsif location.scheme and location.scheme.size == 1 and
+ FileTest.exist?(location.to_s)
+ # ToDo: remove this ugly workaround for a path with drive letter
+ # (D://foo/bar)
+ content = File.open(location.to_s).read
+ else
+ client = web_client.new(nil, "WSDL4R")
+ client.proxy = ::SOAP::Env::HTTP_PROXY
+ client.no_proxy = ::SOAP::Env::NO_PROXY
+ if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName)
+ http_opt = opt["client.protocol.http"]
+ ::SOAP::HTTPConfigLoader.set_options(client, http_opt) if http_opt
+ end
+ content = client.get_content(location)
+ end
+ return content, normalizedlocation
+ end
+
+ def web_client
+ return @web_client if @web_client
+ begin
+ require 'httpclient'
+ @web_client = HTTPClient
+ rescue LoadError
+ begin
+ require 'http-access2'
+ if HTTPAccess2::VERSION < "2.0"
+ raise LoadError.new("http-access/2.0 or later is required.")
+ end
+ @web_client = HTTPAccess2::Client
+ rescue LoadError
+ warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
+ require 'soap/netHttpClient'
+ @web_client = ::SOAP::NetHttpClient
+ end
+ end
+ @web_client
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb
new file mode 100644
index 00000000..13dfa518
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb
@@ -0,0 +1,48 @@
+# WSDL4R - XMLSchema include definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'wsdl/xmlSchema/importer'
+require 'wsdl/xmlSchema/importHandler'
+
+
+module WSDL
+module XMLSchema
+
+
+class Include < Info
+ def initialize
+ super
+ @handler = ImportHandler.new
+ end
+
+ def schemalocation
+ @handler.schemalocation
+ end
+
+ def content
+ @handler.content
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when SchemaLocationAttrName
+ @handler.parse_schemalocation(value.source, root, parent)
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb
new file mode 100644
index 00000000..71fba884
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema length definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Length < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:length] = to_boolean(value)
+ when ValueAttrName
+ parent.length = to_int(value)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb
new file mode 100644
index 00000000..7d5ecece
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb
@@ -0,0 +1,48 @@
+# WSDL4R - XMLSchema list definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class List < Info
+ attr_reader :itemtype
+ attr_reader :local_simpletype
+
+ def initialize
+ super()
+ @itemtype = nil
+ @local_simpletype = nil
+ end
+
+ def parse_element(element)
+ case element
+ when SimpleTypeName
+ @local_simpletype = SimpleType.new
+ @local_simpletype
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when ItemTypeAttrName
+ @itemtype = value
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb
new file mode 100644
index 00000000..41df4967
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema maxExclusive definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MaxExclusive < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:maxexclusive] = to_boolean(value)
+ when ValueAttrName
+ parent.maxexclusive = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb
new file mode 100644
index 00000000..3be8e2c9
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema maxInclusive definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MaxInclusive < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:maxinclusive] = to_boolean(value)
+ when ValueAttrName
+ parent.maxinclusive = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb
new file mode 100644
index 00000000..d35e01b2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema maxLength definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MaxLength < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:maxlength] = to_boolean(value)
+ when ValueAttrName
+ parent.maxlength = to_int(value)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb
new file mode 100644
index 00000000..8621349d
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema minExclusive definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MinExclusive < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:minexclusive] = to_boolean(value)
+ when ValueAttrName
+ parent.minexclusive = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb
new file mode 100644
index 00000000..2a3f68de
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema minInclusive definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MinInclusive < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:mininclusive] = to_boolean(value)
+ when ValueAttrName
+ parent.mininclusive = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb
new file mode 100644
index 00000000..e10a1f1a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema minLength definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class MinLength < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:minlength] = to_boolean(value)
+ when ValueAttrName
+ parent.minlength = to_int(value)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb
new file mode 100644
index 00000000..3f61a651
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb
@@ -0,0 +1,167 @@
+# WSDL4R - WSDL XML Instance parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'xsd/ns'
+require 'xsd/charset'
+require 'xsd/datatypes'
+require 'xsd/xmlparser'
+require 'wsdl/xmlSchema/data'
+
+
+module WSDL
+module XMLSchema
+
+
+class Parser
+ include XSD
+
+ class ParseError < Error; end
+ class FormatDecodeError < ParseError; end
+ class UnknownElementError < FormatDecodeError; end
+ class UnknownAttributeError < FormatDecodeError; end
+ class UnexpectedElementError < FormatDecodeError; end
+ class ElementConstraintError < FormatDecodeError; end
+ class AttributeConstraintError < FormatDecodeError; end
+
+private
+
+ class ParseFrame
+ attr_reader :ns
+ attr_reader :name
+ attr_accessor :node
+
+ private
+
+ def initialize(ns, name, node)
+ @ns = ns
+ @name = name
+ @node = node
+ end
+ end
+
+public
+
+ def initialize(opt = {})
+ @parser = XSD::XMLParser.create_parser(self, opt)
+ @parsestack = nil
+ @lastnode = nil
+ @ignored = {}
+ @location = opt[:location]
+ @originalroot = opt[:originalroot]
+ end
+
+ def parse(string_or_readable)
+ @parsestack = []
+ @lastnode = nil
+ @textbuf = ''
+ @parser.do_parse(string_or_readable)
+ @lastnode
+ end
+
+ def charset
+ @parser.charset
+ end
+
+ def start_element(name, attrs)
+ lastframe = @parsestack.last
+ ns = parent = nil
+ if lastframe
+ ns = lastframe.ns
+ parent = lastframe.node
+ else
+ ns = XSD::NS.new
+ parent = nil
+ end
+ # ns might be the same
+ ns, attrs = XSD::XMLParser.filter_ns(ns, attrs)
+ node = decode_tag(ns, name, attrs, parent)
+ @parsestack << ParseFrame.new(ns, name, node)
+ end
+
+ def characters(text)
+ lastframe = @parsestack.last
+ if lastframe
+ # Need not to be cloned because character does not have attr.
+ ns = lastframe.ns
+ decode_text(ns, text)
+ else
+ p text if $DEBUG
+ end
+ end
+
+ def end_element(name)
+ lastframe = @parsestack.pop
+ unless name == lastframe.name
+ raise UnexpectedElementError.new("closing element name '#{name}' does not match with opening element '#{lastframe.name}'")
+ end
+ decode_tag_end(lastframe.ns, lastframe.node)
+ @lastnode = lastframe.node
+ end
+
+private
+
+ def decode_tag(ns, name, attrs, parent)
+ o = nil
+ elename = ns.parse(name)
+ if !parent
+ if elename == SchemaName
+ o = Schema.parse_element(elename)
+ o.location = @location
+ else
+ raise UnknownElementError.new("unknown element: #{elename}")
+ end
+ o.root = @originalroot if @originalroot # o.root = o otherwise
+ else
+ if elename == AnnotationName
+ # only the first annotation element is allowed for each element.
+ o = Annotation.new
+ else
+ o = parent.parse_element(elename)
+ end
+ if o.nil?
+ unless @ignored.key?(elename)
+ warn("ignored element: #{elename} of #{parent.class}")
+ @ignored[elename] = elename
+ end
+ o = Documentation.new # which accepts any element.
+ end
+ # node could be a pseudo element. pseudo element has its own parent.
+ o.root = parent.root
+ o.parent = parent if o.parent.nil?
+ end
+ attrs.each do |key, value|
+ attr_ele = ns.parse(key, true)
+ value_ele = ns.parse(value, false)
+ value_ele.source = value # for recovery; value may not be a QName
+ if attr_ele == IdAttrName
+ o.id = value_ele
+ else
+ if o.parse_attr(attr_ele, value_ele).nil?
+ unless @ignored.key?(attr_ele)
+ warn("ignored attr: #{attr_ele}")
+ @ignored[attr_ele] = attr_ele
+ end
+ end
+ end
+ end
+ o
+ end
+
+ def decode_tag_end(ns, node)
+ node.parse_epilogue
+ end
+
+ def decode_text(ns, text)
+ @textbuf << text
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb
new file mode 100644
index 00000000..160636cc
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb
@@ -0,0 +1,36 @@
+# WSDL4R - XMLSchema pattern definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Pattern < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when ValueAttrName
+ parent.pattern = /\A#{value.source}\z/n
+ value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/ref.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/ref.rb
new file mode 100644
index 00000000..f7b5670e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/ref.rb
@@ -0,0 +1,33 @@
+# WSDL4R - XMLSchema ref support.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module WSDL
+module XMLSchema
+
+
+module Ref
+ def self.included(klass)
+ klass.extend(RefClassSupport)
+ end
+
+ module RefClassSupport
+ def attr_reader_ref(symbol)
+ name = symbol.to_s
+ define_method(name) {
+ instance_variable_get("@#{name}") ||
+ (refelement ? refelement.__send__(name) : nil)
+ }
+ end
+ end
+
+ attr_accessor :ref
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb
new file mode 100644
index 00000000..841f6a9a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb
@@ -0,0 +1,178 @@
+# WSDL4R - XMLSchema schema definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class Schema < Info
+ attr_reader :targetnamespace # required
+ attr_reader :complextypes
+ attr_reader :simpletypes
+ attr_reader :elements
+ attr_reader :attributes
+ attr_reader :modelgroups
+ attr_reader :attributegroups
+ attr_reader :imports
+ attr_accessor :attributeformdefault
+ attr_accessor :elementformdefault
+ attr_accessor :version
+
+ attr_reader :importedschema
+
+ def initialize
+ super
+ @targetnamespace = nil
+ @complextypes = XSD::NamedElements.new
+ @simpletypes = XSD::NamedElements.new
+ @elements = XSD::NamedElements.new
+ @attributes = XSD::NamedElements.new
+ @modelgroups = XSD::NamedElements.new
+ @attributegroups = XSD::NamedElements.new
+ @imports = []
+ @attributeformdefault = "unqualified"
+ @elementformdefault = "unqualified"
+ @importedschema = {}
+ @location = nil
+ @root = self
+ @version = nil
+ end
+
+ def location
+ @location || (root.nil? ? nil : root.location)
+ end
+
+ def location=(location)
+ @location = location
+ end
+
+ def parse_element(element)
+ case element
+ when ImportName
+ o = Import.new
+ @imports << o
+ o
+ when IncludeName
+ o = Include.new
+ @imports << o
+ o
+ when ComplexTypeName
+ o = ComplexType.new
+ @complextypes << o
+ o
+ when SimpleTypeName
+ o = SimpleType.new
+ @simpletypes << o
+ o
+ when ElementName
+ o = Element.new
+ o.form = 'qualified' # root element is qualified
+ @elements << o
+ o
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when GroupName
+ o = Group.new
+ @modelgroups << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributegroups << o
+ o
+ else
+ nil
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when TargetNamespaceAttrName
+ @targetnamespace = value.source
+ when AttributeFormDefaultAttrName
+ @attributeformdefault = value.source
+ when ElementFormDefaultAttrName
+ @elementformdefault = value.source
+ when VersionAttrName
+ @version = value.source
+ else
+ nil
+ end
+ end
+
+ def collect_attributes
+ result = XSD::NamedElements.new
+ result.concat(@attributes)
+ @imports.each do |import|
+ result.concat(import.content.collect_attributes) if import.content
+ end
+ result
+ end
+
+ def collect_modelgroups
+ result = XSD::NamedElements.new
+ result.concat(@modelgroups)
+ @imports.each do |import|
+ result.concat(import.content.collect_modelgroups) if import.content
+ end
+ result
+ end
+
+ def collect_attributegroups
+ result = XSD::NamedElements.new
+ result.concat(@attributegroups)
+ @imports.each do |import|
+ result.concat(import.content.collect_attributegroups) if import.content
+ end
+ result
+ end
+
+ def collect_elements
+ result = XSD::NamedElements.new
+ result.concat(@elements)
+ @imports.each do |import|
+ result.concat(import.content.collect_elements) if import.content
+ end
+ result
+ end
+
+ def collect_complextypes
+ result = XSD::NamedElements.new
+ result.concat(@complextypes)
+ @imports.each do |import|
+ result.concat(import.content.collect_complextypes) if import.content
+ end
+ result
+ end
+
+ def collect_simpletypes
+ result = XSD::NamedElements.new
+ result.concat(@simpletypes)
+ @imports.each do |import|
+ result.concat(import.content.collect_simpletypes) if import.content
+ end
+ result
+ end
+
+ def self.parse_element(element)
+ if element == SchemaName
+ Schema.new
+ else
+ nil
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb
new file mode 100644
index 00000000..a1835ddb
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb
@@ -0,0 +1,54 @@
+# WSDL4R - XMLSchema complexType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/xmlSchema/content'
+
+
+module WSDL
+module XMLSchema
+
+
+class Sequence < Content
+ attr_reader :any
+
+ def initialize
+ super()
+ @any = nil
+ end
+
+ def have_any?
+ !!@any
+ end
+
+ def parse_element(element)
+ case element
+ when SequenceName
+ o = Sequence.new
+ @elements << o
+ o
+ when ChoiceName
+ o = Choice.new
+ @elements << o
+ o
+ when GroupName
+ o = Group.new
+ @elements << o
+ o
+ when AnyName
+ @any = Any.new
+ @elements << @any
+ @any
+ else
+ super(element)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb
new file mode 100644
index 00000000..9740d3e3
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb
@@ -0,0 +1,69 @@
+# WSDL4R - XMLSchema simpleContent definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class SimpleContent < Info
+ attr_reader :restriction
+ attr_reader :extension
+
+ def check_lexical_format(value)
+ check(value)
+ end
+
+ def initialize
+ super
+ @restriction = nil
+ @extension = nil
+ end
+
+ def base
+ content.base
+ end
+
+ def attributes
+ content.attributes
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when RestrictionName
+ @restriction = SimpleRestriction.new
+ @restriction
+ when ExtensionName
+ @extension = SimpleExtension.new
+ @extension
+ end
+ end
+
+private
+
+ def content
+ @restriction || @extension
+ end
+
+ def check(value)
+ unless content.valid?(value)
+ raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb
new file mode 100644
index 00000000..10f8c374
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb
@@ -0,0 +1,62 @@
+# WSDL4R - XMLSchema simpleType extension definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class SimpleExtension < Info
+ attr_reader :base
+ attr_reader :attributes
+
+ def initialize
+ super
+ @base = nil
+ @attributes = XSD::NamedElements.new
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def valid?(value)
+ true
+ end
+
+ def parse_element(element)
+ case element
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributes << o
+ o
+ when AnyAttributeName
+ o = AnyAttribute.new
+ @attributes << o
+ o
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when BaseAttrName
+ @base = value
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb
new file mode 100644
index 00000000..ea324423
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb
@@ -0,0 +1,132 @@
+# WSDL4R - XMLSchema simpleContent restriction definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class SimpleRestriction < Info
+ attr_reader :base
+ attr_accessor :length
+ attr_accessor :minlength
+ attr_accessor :maxlength
+ attr_accessor :pattern
+ attr_reader :enumeration
+ attr_accessor :whitespace
+ attr_accessor :maxinclusive
+ attr_accessor :maxexclusive
+ attr_accessor :minexclusive
+ attr_accessor :mininclusive
+ attr_accessor :totaldigits
+ attr_accessor :fractiondigits
+ attr_reader :fixed
+ attr_reader :attributes
+
+ def initialize
+ super
+ @base = nil
+ @enumeration = [] # NamedElements?
+ @length = nil
+ @maxlength = nil
+ @minlength = nil
+ @pattern = nil
+ @fixed = {}
+ @attributes = XSD::NamedElements.new
+ end
+
+ def valid?(value)
+ return false unless check_restriction(value)
+ return false unless check_length(value)
+ return false unless check_maxlength(value)
+ return false unless check_minlength(value)
+ return false unless check_pattern(value)
+ true
+ end
+
+ def enumeration?
+ !@enumeration.empty?
+ end
+
+ def parse_element(element)
+ case element
+ when LengthName
+ Length.new
+ when MinLengthName
+ MinLength.new
+ when MaxLengthName
+ MaxLength.new
+ when PatternName
+ Pattern.new
+ when EnumerationName
+ Enumeration.new
+ when WhiteSpaceName
+ WhiteSpace.new
+ when MaxInclusiveName
+ MaxInclusive.new
+ when MaxExclusiveName
+ MaxExclusive.new
+ when MinExclusiveName
+ MinExclusive.new
+ when MinInclusiveName
+ MinInclusive.new
+ when TotalDigitsName
+ TotalDigits.new
+ when FractionDigitsName
+ FractionDigits.new
+ when AttributeName
+ o = Attribute.new
+ @attributes << o
+ o
+ when AttributeGroupName
+ o = AttributeGroup.new
+ @attributes << o
+ o
+ when AnyAttributeName
+ o = AnyAttribute.new
+ @attributes << o
+ o
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when BaseAttrName
+ @base = value
+ end
+ end
+
+private
+
+ def check_restriction(value)
+ @enumeration.empty? or @enumeration.include?(value)
+ end
+
+ def check_length(value)
+ @length.nil? or value.size == @length
+ end
+
+ def check_maxlength(value)
+ @maxlength.nil? or value.size <= @maxlength
+ end
+
+ def check_minlength(value)
+ @minlength.nil? or value.size >= @minlength
+ end
+
+ def check_pattern(value)
+ @pattern.nil? or @pattern =~ value
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb
new file mode 100644
index 00000000..a10420dd
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb
@@ -0,0 +1,87 @@
+# WSDL4R - XMLSchema simpleType definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class SimpleType < Info
+ attr_accessor :name
+ attr_reader :restriction
+ attr_reader :list
+ attr_reader :union
+
+ def check_lexical_format(value)
+ if @restriction
+ check_restriction(value)
+ elsif @list
+ # TODO: check
+ elsif @union
+ # TODO: check
+ else
+ raise ArgumentError.new("incomplete simpleType")
+ end
+ end
+
+ def base
+ if @restriction
+ @restriction.base
+ else
+ nil
+ end
+ end
+
+ def initialize(name = nil)
+ super()
+ @name = name
+ @restriction = nil
+ @list = nil
+ @union = nil
+ end
+
+ def targetnamespace
+ parent.targetnamespace
+ end
+
+ def parse_element(element)
+ case element
+ when RestrictionName
+ @restriction = SimpleRestriction.new
+ @restriction
+ when ListName
+ @list = List.new
+ @list
+ when UnionName
+ @union = Union.new
+ @union
+ end
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when NameAttrName
+ @name = XSD::QName.new(targetnamespace, value.source)
+ end
+ end
+
+private
+
+ def check_restriction(value)
+ unless @restriction.valid?(value)
+ raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb
new file mode 100644
index 00000000..46694736
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema totalDigits definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class TotalDigits < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:totaldigits] = to_boolean(value)
+ when ValueAttrName
+ parent.totaldigits = to_int(value)
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb
new file mode 100644
index 00000000..57fdd465
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb
@@ -0,0 +1,35 @@
+# WSDL4R - XMLSchema union definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+require 'xsd/namedelements'
+
+
+module WSDL
+module XMLSchema
+
+
+class Union < Info
+ attr_reader :member_types
+
+ def initialize
+ super
+ @member_types = nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when MemberTypesAttrName
+ @member_types = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb
new file mode 100644
index 00000000..d872a435
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb
@@ -0,0 +1,34 @@
+# WSDL4R - XMLSchema unique element.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class Unique < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ # Accepts any element.
+ self
+ end
+
+ def parse_attr(attr, value)
+ # Accepts any attribute.
+ true
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb
new file mode 100644
index 00000000..54f14708
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb
@@ -0,0 +1,37 @@
+# WSDL4R - XMLSchema whiteSpace definition for WSDL.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'wsdl/info'
+
+
+module WSDL
+module XMLSchema
+
+
+class WhiteSpace < Info
+ def initialize
+ super
+ end
+
+ def parse_element(element)
+ nil
+ end
+
+ def parse_attr(attr, value)
+ case attr
+ when FixedAttrName
+ parent.fixed[:whitespace] = to_boolean(value)
+ when ValueAttrName
+ parent.whitespace = value.source
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb
new file mode 100644
index 00000000..69db7760
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb
@@ -0,0 +1,174 @@
+# XSD4R - XSD to ruby mapping library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'wsdl/xmlSchema/importer'
+require 'wsdl/soap/classDefCreator'
+require 'wsdl/soap/classDefCreatorSupport'
+require 'wsdl/soap/literalMappingRegistryCreator'
+require 'wsdl/soap/classNameCreator'
+require 'logger'
+
+
+module WSDL
+module XMLSchema
+
+
+class XSD2Ruby
+ include WSDL::SOAP::ClassDefCreatorSupport
+
+ attr_accessor :location
+ attr_reader :opt
+ attr_accessor :logger
+ attr_accessor :basedir
+
+ def run
+ unless @location
+ raise RuntimeError, "XML Schema location not given"
+ end
+ @xsd = import(@location)
+ @name = @opt['classdef'] || create_classname(@xsd)
+ create_file
+ end
+
+private
+
+ def initialize
+ @location = nil
+ @opt = {}
+ @logger = Logger.new(STDERR)
+ @basedir = nil
+ @xsd = nil
+ @name = nil
+ @name_creator = WSDL::SOAP::ClassNameCreator.new
+ end
+
+ def create_file
+ @modulepath = @opt['module_path']
+ create_classdef if @opt.key?('classdef')
+ create_mapping_registry if @opt.key?('mapping_registry')
+ create_mapper if @opt.key?('mapper')
+ end
+
+ def create_classdef
+ @logger.info { "Creating class definition." }
+ @classdef_filename = @name + '.rb'
+ check_file(@classdef_filename) or return
+ write_file(@classdef_filename) do |f|
+ f << WSDL::SOAP::ClassDefCreator.new(@xsd, @name_creator, @modulepath).dump
+ end
+ end
+
+ def create_mapping_registry
+ @logger.info { "Creating mapping registry definition." }
+ @mr_filename = @name + '_mapping_registry.rb'
+ check_file(@mr_filename) or return
+ write_file(@mr_filename) do |f|
+ f << dump_mapping_registry
+ end
+ end
+
+ def create_mapper
+ @logger.info { "Creating mapper definition." }
+ @mapper_filename = @name + '_mapper.rb'
+ check_file(@mapper_filename) or return
+ write_file(@mapper_filename) do |f|
+ f << dump_mapper
+ end
+ end
+
+ def dump_mapping_registry
+ defined_const = {}
+ creator = WSDL::SOAP::LiteralMappingRegistryCreator.new(@xsd, @name_creator, @modulepath, defined_const)
+ module_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'MappingRegistry')
+ if @modulepath
+ module_name = [@modulepath, module_name].join('::')
+ end
+ m = XSD::CodeGen::ModuleDef.new(module_name)
+ m.def_require("xsd/mapping")
+ m.def_require("#{@classdef_filename}")
+ varname = 'Registry'
+ m.def_const(varname, '::SOAP::Mapping::LiteralRegistry.new')
+ m.def_code(creator.dump(varname))
+ #
+ defined_const.each do |ns, tag|
+ m.def_const(tag, dq(ns))
+ end
+ m.dump
+ end
+
+ def dump_mapper
+ class_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'Mapper')
+ if @modulepath
+ class_name = [@modulepath, class_name].join('::')
+ end
+ mr_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'MappingRegistry')
+ c = XSD::CodeGen::ClassDef.new(class_name, 'XSD::Mapping::Mapper')
+ c.def_require("#{@mr_filename}")
+ c.def_method("initialize") do
+ "super(#{mr_name}::Registry)"
+ end
+ c.dump
+ end
+
+ def write_file(filename)
+ if @basedir
+ filename = File.join(basedir, filename)
+ end
+ File.open(filename, "w") do |f|
+ yield f
+ end
+ end
+
+ def check_file(filename)
+ if @basedir
+ filename = File.join(basedir, filename)
+ end
+ if FileTest.exist?(filename)
+ if @opt.key?('force')
+ @logger.warn {
+ "File '#{filename}' exists but overrides it."
+ }
+ true
+ else
+ @logger.warn {
+ "File '#{filename}' exists. #{$0} did not override it."
+ }
+ false
+ end
+ else
+ @logger.info { "Creates file '#{filename}'." }
+ true
+ end
+ end
+
+ def create_classname(xsd)
+ name = nil
+ if xsd.targetnamespace
+ name = xsd.targetnamespace.scan(/[a-zA-Z0-9]+$/)[0]
+ end
+ if name.nil?
+ 'default'
+ else
+ XSD::CodeGen::GenSupport.safevarname(name)
+ end
+ end
+
+ def import(location)
+ WSDL::XMLSchema::Importer.import(location)
+ end
+end
+
+
+end
+end
+
+
+if __FILE__ == $0
+ warn("WARNING: #{File.expand_path(__FILE__)} is a library file used by bin/xsd2ruby.rb. Find bin/xsd2ruby.rb from tarball version of soap4r or install soap4r via gem.")
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb
new file mode 100644
index 00000000..19ea7ad0
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb
@@ -0,0 +1,188 @@
+# XSD4R - Charset handling library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module XSD
+
+
+module Charset
+ @internal_encoding = "UTF8" #$KCODE
+
+ class XSDError < StandardError; end
+ class CharsetError < XSDError; end
+ class UnknownCharsetError < CharsetError; end
+ class CharsetConversionError < CharsetError; end
+
+public
+
+ ###
+ ## Maps
+ #
+ EncodingConvertMap = {}
+ def Charset.init
+ EncodingConvertMap[['UTF8', 'X_ISO_8859_1']] =
+ Proc.new { |str| str.unpack('U*').pack('C*') }
+ EncodingConvertMap[['X_ISO_8859_1', 'UTF8']] =
+ Proc.new { |str| str.unpack('C*').pack('U*') }
+ begin
+ require 'xsd/iconvcharset'
+ @internal_encoding = 'UTF8'
+ sjtag = (/(mswin|bccwin|mingw|cygwin|emx)/ =~ RUBY_PLATFORM) ? 'cp932' :
+ 'shift_jis'
+ EncodingConvertMap[['UTF8', 'EUC' ]] =
+ Proc.new { |str| IconvCharset.safe_iconv("euc-jp", "utf-8", str) }
+ EncodingConvertMap[['EUC' , 'UTF8']] =
+ Proc.new { |str| IconvCharset.safe_iconv("utf-8", "euc-jp", str) }
+ EncodingConvertMap[['EUC' , 'SJIS']] =
+ Proc.new { |str| IconvCharset.safe_iconv(sjtag, "euc-jp", str) }
+ EncodingConvertMap[['UTF8', 'SJIS']] =
+ Proc.new { |str| IconvCharset.safe_iconv(sjtag, "utf-8", str) }
+ EncodingConvertMap[['SJIS', 'UTF8']] =
+ Proc.new { |str| IconvCharset.safe_iconv("utf-8", sjtag, str) }
+ EncodingConvertMap[['SJIS', 'EUC' ]] =
+ Proc.new { |str| IconvCharset.safe_iconv("euc-jp", sjtag, str) }
+ rescue LoadError
+ begin
+ require 'nkf'
+ EncodingConvertMap[['EUC' , 'SJIS']] =
+ Proc.new { |str| NKF.nkf('-sXm0', str) }
+ EncodingConvertMap[['SJIS', 'EUC' ]] =
+ Proc.new { |str| NKF.nkf('-eXm0', str) }
+ rescue LoadError
+ end
+
+ begin
+ require 'uconv'
+ @internal_encoding = 'UTF8'
+ EncodingConvertMap[['UTF8', 'EUC' ]] = Uconv.method(:u8toeuc)
+ EncodingConvertMap[['UTF8', 'SJIS']] = Uconv.method(:u8tosjis)
+ EncodingConvertMap[['EUC' , 'UTF8']] = Uconv.method(:euctou8)
+ EncodingConvertMap[['SJIS', 'UTF8']] = Uconv.method(:sjistou8)
+ rescue LoadError
+ end
+ end
+ end
+ self.init
+
+ CharsetMap = {
+ 'NONE' => 'us-ascii',
+ 'EUC' => 'euc-jp',
+ 'SJIS' => 'shift_jis',
+ 'UTF8' => 'utf-8',
+ 'X_ISO_8859_1' => 'iso-8859-1',
+ 'X_UNKNOWN' => nil,
+ }
+
+ CharsetStrCache = {}
+
+
+ ###
+ ## handlers
+ #
+ def Charset.encoding
+ @internal_encoding
+ end
+
+ def Charset.encoding=(encoding)
+ warn("xsd charset is set to #{encoding}") if $DEBUG
+ @internal_encoding = encoding
+ end
+
+ def Charset.xml_encoding_label
+ charset_label(@internal_encoding)
+ end
+
+ def Charset.encoding_to_xml(str, charset)
+ encoding_conv(str, @internal_encoding, charset_str(charset))
+ end
+
+ def Charset.encoding_from_xml(str, charset)
+ encoding_conv(str, charset_str(charset), @internal_encoding)
+ end
+
+ def Charset.encoding_conv(str, enc_from, enc_to)
+ if enc_from == enc_to or enc_from == 'NONE' or enc_to == 'NONE'
+ str
+ elsif converter = EncodingConvertMap[[enc_from, enc_to]]
+ converter.call(str)
+ else
+ raise CharsetConversionError.new(
+ "Converter not found: #{enc_from} -> #{enc_to}")
+ end
+ end
+
+ def Charset.charset_label(encoding)
+ CharsetMap[encoding.upcase]
+ end
+
+ def Charset.charset_str(label)
+ if CharsetMap.respond_to?(:key)
+ CharsetStrCache[label] ||= CharsetMap.key(label.downcase) || 'X_UNKNOWN'
+ else
+ CharsetStrCache[label] ||= CharsetMap.index(label.downcase) || 'X_UNKNOWN'
+ end
+ end
+
+ # us_ascii = '[\x00-\x7F]'
+ us_ascii = '[\x9\xa\xd\x20-\x7F]' # XML 1.0 restricted.
+ USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z")
+
+ twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])'
+ threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])'
+ character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})"
+ EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, 'n')
+
+ # onebyte_sjis = '[\x00-\x7F\xA1-\xDF]'
+ onebyte_sjis = '[\x9\xa\xd\x20-\x7F\xA1-\xDF]' # XML 1.0 restricted.
+ twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])'
+ character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})"
+ SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, 'n')
+
+ # 0xxxxxxx
+ # 110yyyyy 10xxxxxx
+ twobytes_utf8 = '(?:[\xC0-\xDF][\x80-\xBF])'
+ # 1110zzzz 10yyyyyy 10xxxxxx
+ threebytes_utf8 = '(?:[\xE0-\xEF][\x80-\xBF][\x80-\xBF])'
+ # 11110uuu 10uuuzzz 10yyyyyy 10xxxxxx
+ fourbytes_utf8 = '(?:[\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])'
+ character_utf8 = "(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})"
+ UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, 'n')
+
+ def Charset.is_us_ascii(str)
+ USASCIIRegexp =~ str
+ end
+
+ def Charset.is_utf8(str)
+ UTF8Regexp =~ str
+ end
+
+ def Charset.is_euc(str)
+ EUCRegexp =~ str
+ end
+
+ def Charset.is_sjis(str)
+ SJISRegexp =~ str
+ end
+
+ def Charset.is_ces(str, code = @internal_encoding)
+ case code
+ when 'NONE'
+ is_us_ascii(str)
+ when 'UTF8'
+ is_utf8(str)
+ when 'EUC'
+ is_euc(str)
+ when 'SJIS'
+ is_sjis(str)
+ else
+ raise UnknownCharsetError.new("Unknown charset: #{code}")
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb
new file mode 100644
index 00000000..4f71f0ee
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb
@@ -0,0 +1,12 @@
+# XSD4R - Generating code library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'xsd/codegen/moduledef'
+require 'xsd/codegen/classdef'
+require 'xsd/codegen/methoddef'
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb
new file mode 100644
index 00000000..755ec548
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb
@@ -0,0 +1,208 @@
+# XSD4R - Generating class definition code
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'xsd/codegen/moduledef'
+require 'xsd/codegen/methoddef'
+
+
+module XSD
+module CodeGen
+
+
+class ClassDef < ModuleDef
+ include GenSupport
+
+ def initialize(name, baseclass = nil)
+ super(name)
+ @baseclass = baseclass
+ @classvar = []
+ @attrdef = []
+ end
+
+ def def_classvar(var, value)
+ var = var.sub(/\A@@/, "")
+ unless safevarname?(var)
+ raise ArgumentError.new("#{var} seems to be unsafe")
+ end
+ @classvar << [var, value]
+ end
+
+ def def_attr(attrname, writable = true, varname = nil)
+ unless safevarname?(varname || attrname)
+ raise ArgumentError.new("#{varname || attrname} seems to be unsafe")
+ end
+ @attrdef << [attrname, writable, varname]
+ end
+
+ def dump
+ buf = ""
+ unless @requirepath.empty?
+ buf << dump_requirepath
+ end
+ buf << dump_emptyline unless buf.empty?
+ package = @name.split(/::/)[0..-2]
+ buf << dump_package_def(package) unless package.empty?
+ buf << dump_comment if @comment
+ buf << dump_class_def
+ spacer = false
+ unless @classvar.empty?
+ spacer = true
+ buf << dump_classvar
+ end
+ unless @const.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_const
+ end
+ unless @innermodule.empty?
+ buf << dump_emptyline # always add 1 empty line
+ spacer = true
+ buf << dump_innermodule
+ end
+ unless @code.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_code
+ end
+ unless @attrdef.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_attributes
+ end
+ unless @methoddef.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_methods
+ end
+ buf << dump_class_def_end
+ buf << dump_package_def_end(package) unless package.empty?
+ buf.gsub(/^\s+$/, '')
+ end
+
+private
+
+ def dump_class_def
+ name = @name.to_s.split(/::/)
+ if @baseclass
+ format("class #{name.last} < #{@baseclass}")
+ else
+ format("class #{name.last}")
+ end
+ end
+
+ def dump_class_def_end
+ str = format("end")
+ end
+
+ def dump_classvar
+ dump_static(
+ @classvar.collect { |var, value|
+ %Q(@@#{var.sub(/^@@/, "")} = #{dump_value(value)})
+ }.join("\n")
+ )
+ end
+
+ def dump_attributes
+ str = ""
+ @attrdef.each do |attrname, writable, varname|
+ varname ||= attrname
+ if attrname == varname
+ str << format(dump_accessor(attrname, writable), 2)
+ end
+ end
+ @attrdef.each do |attrname, writable, varname|
+ varname ||= attrname
+ if attrname != varname
+ str << "\n" unless str.empty?
+ str << format(dump_attribute(attrname, writable, varname), 2)
+ end
+ end
+ str
+ end
+
+ def dump_accessor(attrname, writable)
+ if writable
+ "attr_accessor :#{attrname}"
+ else
+ "attr_reader :#{attrname}"
+ end
+ end
+
+ def dump_attribute(attrname, writable, varname)
+ str = nil
+ mr = MethodDef.new(attrname)
+ mr.definition = "@#{varname}"
+ str = mr.dump
+ if writable
+ mw = MethodDef.new(attrname + "=", 'value')
+ mw.definition = "@#{varname} = value"
+ str << "\n" + mw.dump
+ end
+ str
+ end
+end
+
+
+end
+end
+
+
+if __FILE__ == $0
+ require 'xsd/codegen/classdef'
+ include XSD::CodeGen
+ c = ClassDef.new("Foo::Bar::HobbitName", String)
+ c.def_require("foo/bar")
+ c.comment = <<-EOD
+ foo
+ bar
+ baz
+ EOD
+ c.def_const("FOO", 1)
+ c.def_classvar("@@foo", "var".dump)
+ c.def_classvar("baz", "1".dump)
+ c.def_attr("Foo", true, "foo")
+ c.def_attr("bar")
+ c.def_attr("baz", true)
+ c.def_attr("Foo2", true, "foo2")
+ c.def_attr("foo3", false, "foo3")
+ c.def_method("foo") do
+ <<-EOD
+ foo.bar = 1
+\tbaz.each do |ele|
+\t ele
+ end
+ EOD
+ end
+ c.def_method("baz", "qux") do
+ <<-EOD
+ [1, 2, 3].each do |i|
+ p i
+ end
+ EOD
+ end
+
+ m = MethodDef.new("qux", "quxx", "quxxx") do
+ <<-EOD
+ p quxx + quxxx
+ EOD
+ end
+ m.comment = "hello world\n123"
+ c.add_method(m)
+ c.def_code <<-EOD
+ Foo.new
+ Bar.z
+ EOD
+ c.def_code <<-EOD
+ Foo.new
+ Bar.z
+ EOD
+ c.def_privatemethod("foo", "baz", "*arg", "&block")
+
+ puts c.dump
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb
new file mode 100644
index 00000000..13b074b6
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb
@@ -0,0 +1,34 @@
+# XSD4R - Generating comment definition code
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+
+
+module XSD
+module CodeGen
+
+
+module CommentDef
+ include GenSupport
+
+ attr_accessor :comment
+
+private
+
+ def dump_comment
+ if /\A#/ =~ @comment
+ format(@comment)
+ else
+ format(@comment).gsub(/^/, '# ')
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb
new file mode 100644
index 00000000..761887b2
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb
@@ -0,0 +1,273 @@
+# XSD4R - Code generation support
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module XSD
+module CodeGen
+
+# from the file 'keywords' in 1.9.
+KEYWORDS = {}
+%w(
+__LINE__
+__FILE__
+BEGIN
+END
+alias
+and
+begin
+break
+case
+class
+def
+defined?
+do
+else
+elsif
+end
+ensure
+false
+for
+if
+in
+module
+next
+nil
+not
+or
+redo
+rescue
+retry
+return
+self
+super
+then
+true
+undef
+unless
+until
+when
+while
+yield
+).each { |k| KEYWORDS[k] = nil }
+
+# from Module.constants from 1.8 & 1.9
+CONSTANTS = {}
+%w(
+ARGF
+ARGV
+ArgumentError
+Array
+BasicObject
+Bignum
+Binding
+Class
+Comparable
+Continuation
+Data
+Dir
+ENV
+EOFError
+Enumerable
+Errno
+Exception
+FALSE
+FalseClass
+File
+FileTest
+Fixnum
+Float
+FloatDomainError
+GC
+Hash
+IO
+IOError
+IndexError
+Integer
+Interrupt
+Kernel
+KeyError
+LoadError
+LocalJumpError
+Marshal
+MatchData
+MatchingData
+Math
+Method
+Module
+Mutex
+NIL
+NameError
+NilClass
+NoMemoryError
+NoMethodError
+NotImplementedError
+Numeric
+Object
+ObjectSpace
+PLATFORM
+Precision
+Proc
+Process
+RELEASE_DATE
+RUBY_PATCHLEVEL
+RUBY_PLATFORM
+RUBY_RELEASE_DATE
+RUBY_VERSION
+Range
+RangeError
+Regexp
+RegexpError
+RuntimeError
+STDERR
+STDIN
+STDOUT
+ScriptError
+SecurityError
+Signal
+SignalException
+StandardError
+String
+Struct
+Symbol
+SyntaxError
+SystemCallError
+SystemExit
+SystemStackError
+TOPLEVEL_BINDING
+TRUE
+Thread
+ThreadError
+ThreadGroup
+Time
+TrueClass
+TypeError
+UnboundMethod
+VERSION
+VM
+ZeroDivisionError
+).each { |c| CONSTANTS[c] = nil }
+
+
+module GenSupport
+ def capitalize(target)
+ target.sub(/^([a-z])/) { $1.upcase }
+ end
+ module_function :capitalize
+
+ def uncapitalize(target)
+ target.sub(/^([A-Z])/) { $1.downcase }
+ end
+ module_function :uncapitalize
+
+ def safeconstname(name)
+ safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele|
+ GenSupport.capitalize(ele)
+ }.join
+ if /\A[A-Z]/ !~ safename or keyword?(safename) or constant?(safename)
+ "C_#{safename}"
+ else
+ safename
+ end
+ end
+ module_function :safeconstname
+
+ def safeconstname?(name)
+ /\A[A-Z][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
+ end
+ module_function :safeconstname?
+
+ def safemethodname(name)
+ postfix = name[/[=?!]$/]
+ safename = name.scan(/[a-zA-Z0-9_]+/).join('_')
+ safename = uncapitalize(safename)
+ safename += postfix if postfix
+ if /\A[a-z]/ !~ safename or keyword?(safename)
+ "m_#{safename}"
+ else
+ safename
+ end
+ end
+ module_function :safemethodname
+
+ def safemethodname?(name)
+ /\A[a-zA-Z_][a-zA-Z0-9_]*[=!?]?\z/ =~ name and !keyword?(name)
+ end
+ module_function :safemethodname?
+
+ def safevarname(name)
+ safename = uncapitalize(name.scan(/[a-zA-Z0-9_]+/).join('_'))
+ if /\A[a-z]/ !~ safename or keyword?(safename)
+ "v_#{safename}"
+ else
+ safename
+ end
+ end
+ module_function :safevarname
+
+ def safevarname?(name)
+ /\A[a-z_][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
+ end
+ module_function :safevarname?
+
+ def keyword?(word)
+ KEYWORDS.key?(word)
+ end
+ module_function :keyword?
+
+ def constant?(word)
+ CONSTANTS.key?(word)
+ end
+ module_function :constant?
+
+ def format(str, indent = nil)
+ str = trim_eol(str)
+ str = trim_indent(str)
+ if indent
+ str.gsub(/^/, " " * indent)
+ else
+ str
+ end
+ end
+
+private
+
+ def trim_eol(str)
+ str.lines.collect { |line|
+ line.sub(/\r?\n\z/, "") + "\n"
+ }.join
+ end
+
+ def trim_indent(str)
+ indent = nil
+ str = str.lines.collect { |line| untab(line) }.join
+ str.each_line do |line|
+ head = line.index(/\S/)
+ if !head.nil? and (indent.nil? or head < indent)
+ indent = head
+ end
+ end
+ return str unless indent
+ str.lines.collect { |line|
+ line.sub(/^ {0,#{indent}}/, "")
+ }.join
+ end
+
+ def untab(line, ts = 8)
+ while pos = line.index(/\t/)
+ line = line.sub(/\t/, " " * (ts - (pos % ts)))
+ end
+ line
+ end
+
+ def dump_emptyline
+ "\n"
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb
new file mode 100644
index 00000000..72d24a6c
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb
@@ -0,0 +1,70 @@
+# XSD4R - Generating method definition code
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'xsd/codegen/commentdef'
+
+
+module XSD
+module CodeGen
+
+
+class MethodDef
+ include GenSupport
+ include CommentDef
+
+ attr_accessor :definition
+
+ def initialize(name, *params)
+ klass, mname = name.split('.', 2)
+ if mname.nil?
+ mname, klass = klass, mname
+ end
+ unless safemethodname?(mname)
+ raise ArgumentError.new("name '#{name}' seems to be unsafe")
+ end
+ if klass and klass != 'self' and !safeconstname(klass)
+ raise ArgumentError.new("name '#{name}' seems to be unsafe")
+ end
+ @name = name
+ @params = params
+ @comment = nil
+ @definition = yield if block_given?
+ end
+
+ def dump
+ buf = ""
+ buf << dump_comment if @comment
+ buf << dump_method_def
+ buf << dump_definition if @definition and !@definition.empty?
+ buf << dump_method_def_end
+ buf
+ end
+
+private
+
+ def dump_method_def
+ if @params.empty?
+ format("def #{@name}")
+ else
+ format("def #{@name}(#{@params.join(", ")})")
+ end
+ end
+
+ def dump_method_def_end
+ format("end")
+ end
+
+ def dump_definition
+ format(@definition, 2)
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb
new file mode 100644
index 00000000..a135a2be
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb
@@ -0,0 +1,208 @@
+# XSD4R - Generating module definition code
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/codegen/gensupport'
+require 'xsd/codegen/methoddef'
+require 'xsd/codegen/commentdef'
+
+
+module XSD
+module CodeGen
+
+
+class ModuleDef
+ include GenSupport
+ include CommentDef
+
+ attr_reader :name
+ attr_reader :innermodule
+
+ def initialize(name)
+ @name = name
+ @comment = nil
+ @const = []
+ @code = []
+ @requirepath = []
+ @methoddef = []
+ @innermodule = []
+ end
+
+ def def_require(path)
+ @requirepath << path
+ end
+
+ def def_const(const, value)
+ unless safeconstname?(const)
+ raise ArgumentError.new("#{const} seems to be unsafe")
+ end
+ @const << [const, value]
+ end
+
+ def def_code(code)
+ @code << code
+ end
+
+ def def_method(name, *params)
+ add_method(MethodDef.new(name, *params) { yield if block_given? }, :public)
+ end
+ alias def_publicmethod def_method
+
+ def def_protectedmethod(name, *params)
+ add_method(MethodDef.new(name, *params) { yield if block_given? },
+ :protected)
+ end
+
+ def def_privatemethod(name, *params)
+ add_method(MethodDef.new(name, *params) { yield if block_given? }, :private)
+ end
+
+ def add_method(m, visibility = :public)
+ @methoddef << [visibility, m]
+ end
+
+ def dump
+ buf = ""
+ unless @requirepath.empty?
+ buf << dump_requirepath
+ end
+ buf << dump_emptyline unless buf.empty?
+ package = @name.split(/::/)[0..-2]
+ buf << dump_package_def(package) unless package.empty?
+ buf << dump_comment if @comment
+ buf << dump_module_def
+ spacer = false
+ unless @const.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_const
+ end
+ unless @innermodule.empty?
+ buf << dump_emptyline # always add 1 empty line
+ spacer = true
+ buf << dump_innermodule
+ end
+ unless @code.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_code
+ end
+ unless @methoddef.empty?
+ buf << dump_emptyline if spacer
+ spacer = true
+ buf << dump_methods
+ end
+ buf << dump_module_def_end
+ buf << dump_package_def_end(package) unless package.empty?
+ buf.gsub(/^\s+$/, '')
+ end
+
+private
+
+ def dump_requirepath
+ format(
+ @requirepath.collect { |path|
+ %Q(require '#{path}')
+ }.join("\n")
+ )
+ end
+
+ def dump_const
+ dump_static(
+ @const.sort.collect { |var, value|
+ %Q(#{var} = #{dump_value(value)})
+ }.join("\n")
+ )
+ end
+
+ def dump_innermodule
+ dump_static(
+ @innermodule.collect { |moduledef|
+ moduledef.dump
+ }.join("\n")
+ )
+ end
+
+ def dump_code
+ dump_static(@code.join("\n"))
+ end
+
+ def dump_static(str)
+ format(str, 2)
+ end
+
+ def dump_methods
+ methods = {}
+ @methoddef.each do |visibility, method|
+ (methods[visibility] ||= []) << method
+ end
+ str = ""
+ [:public, :protected, :private].each do |visibility|
+ if methods[visibility]
+ str << "\n" unless str.empty?
+ str << visibility.to_s << "\n\n" unless visibility == :public
+ str << methods[visibility].collect { |m| format(m.dump, 2) }.join("\n")
+ end
+ end
+ str
+ end
+
+ def dump_value(value)
+ if value.respond_to?(:to_src)
+ value.to_src
+ else
+ value
+ end
+ end
+
+ def dump_package_def(package)
+ format(package.collect { |ele| "module #{ele}" }.join("; ")) + "\n\n"
+ end
+
+ def dump_package_def_end(package)
+ "\n\n" + format(package.collect { |ele| "end" }.join("; "))
+ end
+
+ def dump_module_def
+ name = @name.to_s.split(/::/)
+ format("module #{name.last}")
+ end
+
+ def dump_module_def_end
+ format("end")
+ end
+end
+
+
+end
+end
+
+
+if __FILE__ == $0
+ require 'xsd/codegen/moduledef'
+ include XSD::CodeGen
+ m = ModuleDef.new("Foo::Bar::HobbitName")
+ m.def_require("foo/bar")
+ m.def_require("baz")
+ m.comment = <<-EOD
+ foo
+ bar
+ baz
+ EOD
+ m.def_method("foo") do
+ <<-EOD
+ foo.bar = 1
+ baz.each do |ele|
+ ele + 1
+ end
+ EOD
+ end
+ m.def_method("baz", "qux")
+ #m.def_protectedmethod("aaa")
+ m.def_privatemethod("bbb")
+ puts m.dump
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb
new file mode 100644
index 00000000..0e9669c9
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb
@@ -0,0 +1,1466 @@
+# XSD4R - XML Schema Datatype implementation.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'xsd/charset'
+require 'soap/nestedexception'
+require 'uri'
+require 'date'
+
+###
+## XMLSchamaDatatypes general definitions.
+#
+module XSD
+
+
+Namespace = 'http://www.w3.org/2001/XMLSchema'
+InstanceNamespace = 'http://www.w3.org/2001/XMLSchema-instance'
+
+AttrType = 'type'
+NilValue = 'true'
+
+AnyTypeLiteral = 'anyType'
+AnySimpleTypeLiteral = 'anySimpleType'
+NilLiteral = 'nil'
+StringLiteral = 'string'
+BooleanLiteral = 'boolean'
+DecimalLiteral = 'decimal'
+FloatLiteral = 'float'
+DoubleLiteral = 'double'
+DurationLiteral = 'duration'
+DateTimeLiteral = 'dateTime'
+TimeLiteral = 'time'
+DateLiteral = 'date'
+GYearMonthLiteral = 'gYearMonth'
+GYearLiteral = 'gYear'
+GMonthDayLiteral = 'gMonthDay'
+GDayLiteral = 'gDay'
+GMonthLiteral = 'gMonth'
+HexBinaryLiteral = 'hexBinary'
+Base64BinaryLiteral = 'base64Binary'
+AnyURILiteral = 'anyURI'
+QNameLiteral = 'QName'
+
+NormalizedStringLiteral = 'normalizedString'
+TokenLiteral = 'token'
+LanguageLiteral = 'language'
+NMTOKENLiteral = 'NMTOKEN'
+NMTOKENSLiteral = 'NMTOKENS'
+NameLiteral = 'Name'
+NCNameLiteral = 'NCName'
+IDLiteral = 'ID'
+IDREFLiteral = 'IDREF'
+IDREFSLiteral = 'IDREFS'
+ENTITYLiteral = 'ENTITY'
+ENTITIESLiteral = 'ENTITIES'
+IntegerLiteral = 'integer'
+NonPositiveIntegerLiteral = 'nonPositiveInteger'
+NegativeIntegerLiteral = 'negativeInteger'
+LongLiteral = 'long'
+IntLiteral = 'int'
+ShortLiteral = 'short'
+ByteLiteral = 'byte'
+NonNegativeIntegerLiteral = 'nonNegativeInteger'
+UnsignedLongLiteral = 'unsignedLong'
+UnsignedIntLiteral = 'unsignedInt'
+UnsignedShortLiteral = 'unsignedShort'
+UnsignedByteLiteral = 'unsignedByte'
+PositiveIntegerLiteral = 'positiveInteger'
+
+AttrTypeName = QName.new(InstanceNamespace, AttrType)
+AttrNilName = QName.new(InstanceNamespace, NilLiteral)
+
+AnyTypeName = QName.new(Namespace, AnyTypeLiteral)
+AnySimpleTypeName = QName.new(Namespace, AnySimpleTypeLiteral)
+
+class Error < StandardError; include ::SOAP::NestedException; end
+class ValueSpaceError < Error; end
+
+
+###
+## The base class of all datatypes with Namespace.
+#
+class NSDBase
+ @@types = []
+
+ attr_accessor :type
+
+ def self.inherited(klass)
+ @@types << klass
+ end
+
+ def self.types
+ @@types
+ end
+
+ def initialize
+ end
+
+ def init(type)
+ @type = type
+ end
+end
+
+
+###
+## The base class of XSD datatypes.
+#
+class XSDAnySimpleType < NSDBase
+ include XSD
+ Type = QName.new(Namespace, AnySimpleTypeLiteral)
+
+ # @data represents canonical space (ex. Integer: 123).
+ attr_reader :data
+ # @is_nil represents this data is nil or not.
+ attr_accessor :is_nil
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+ # true or raise
+ def check_lexical_format(value)
+ screen_data(value)
+ true
+ end
+
+ # set accepts a string which follows lexical space (ex. String: "+123"), or
+ # an object which follows canonical space (ex. Integer: 123).
+ def set(value)
+ if value.nil?
+ @is_nil = true
+ @data = nil
+ _set(nil)
+ else
+ @is_nil = false
+ _set(screen_data(value))
+ end
+ end
+
+ # to_s creates a string which follows lexical space (ex. String: "123").
+ def to_s()
+ if @is_nil
+ ""
+ else
+ _to_s
+ end
+ end
+
+private
+
+ def init(type, value)
+ super(type)
+ set(value)
+ end
+
+ # raises ValueSpaceError if check failed
+ def screen_data(value)
+ value
+ end
+
+ def _set(value)
+ @data = value
+ end
+
+ def _to_s
+ @data.to_s
+ end
+end
+
+class XSDNil < XSDAnySimpleType
+ Type = QName.new(Namespace, NilLiteral)
+ Value = 'true'
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+end
+
+
+###
+## Primitive datatypes.
+#
+class XSDString < XSDAnySimpleType
+ Type = QName.new(Namespace, StringLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+ @@strict_ces_validation = false
+
+ def self.strict_ces_validation=(strict_ces_validation)
+ @@strict_ces_validation = strict_ces_validation
+ end
+
+ def self.strict_ces_validation
+ @@strict_ces_validation
+ end
+
+private
+
+ def screen_data(value)
+ if ::XSD::XSDString.strict_ces_validation
+ externalces = XSD::Charset.encoding
+ unless XSD::Charset.is_ces(value, externalces)
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ end
+ value
+ end
+end
+
+class XSDBoolean < XSDAnySimpleType
+ Type = QName.new(Namespace, BooleanLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ if value.is_a?(String)
+ str = value.strip
+ if str == 'true' || str == '1'
+ true
+ elsif str == 'false' || str == '0'
+ false
+ else
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
+ end
+ else
+ value ? true : false
+ end
+ end
+end
+
+class XSDDecimal < XSDAnySimpleType
+ Type = QName.new(Namespace, DecimalLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+ def nonzero?
+ (@number != '0')
+ end
+
+private
+
+ def screen_data(d)
+ if d.is_a?(String)
+ # Integer("00012") => 10 in Ruby.
+ d.sub!(/^([+\-]?)0*(?=\d)/, "\\1")
+ end
+ screen_data_str(d)
+ end
+
+ def screen_data_str(str)
+ /^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ str.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
+ end
+ sign = $1 || '+'
+ int_part = $2
+ frac_part = $3
+ int_part = '0' if int_part.empty?
+ frac_part = frac_part ? frac_part.sub(/0+$/, '') : ''
+ point = - frac_part.size
+ number = int_part + frac_part
+ # normalize
+ if sign == '+'
+ sign = ''
+ elsif sign == '-'
+ if number == '0'
+ sign = ''
+ end
+ end
+ [sign, point, number]
+ end
+
+ def _set(data)
+ if data.nil?
+ @sign = @point = @number = @data = nil
+ return
+ end
+ @sign, @point, @number = data
+ @data = _to_s
+ @data.freeze
+ end
+
+ # 0.0 -> 0; right?
+ def _to_s
+ str = @number.dup
+ if @point.nonzero?
+ str[@number.size + @point, 0] = '.'
+ end
+ @sign + str
+ end
+end
+
+module FloatConstants
+ NaN = 0.0/0.0
+ POSITIVE_INF = +1.0/0.0
+ NEGATIVE_INF = -1.0/0.0
+ POSITIVE_ZERO = +1.0/POSITIVE_INF
+ NEGATIVE_ZERO = -1.0/POSITIVE_INF
+ MIN_POSITIVE_SINGLE = 2.0 ** -149
+end
+
+class XSDFloat < XSDAnySimpleType
+ include FloatConstants
+ Type = QName.new(Namespace, FloatLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ # "NaN".to_f => 0 in some environment. libc?
+ if value.is_a?(Float)
+ return narrow32bit(value)
+ end
+ str = value.to_s.strip
+ if str == 'NaN'
+ NaN
+ elsif str == 'INF'
+ POSITIVE_INF
+ elsif str == '-INF'
+ NEGATIVE_INF
+ else
+ if /^[+\-\.\deE]+$/ !~ str
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
+ end
+ # Float("-1.4E") might fail on some system.
+ str << '0' if /e$/i =~ str
+ begin
+ return narrow32bit(Float(str))
+ rescue ArgumentError
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!)
+ end
+ end
+ end
+
+ def _to_s
+ if @data.nan?
+ 'NaN'
+ elsif @data.infinite? == 1
+ 'INF'
+ elsif @data.infinite? == -1
+ '-INF'
+ else
+ sign = XSDFloat.positive?(@data) ? '+' : '-'
+ sign + sprintf("%.10g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
+ end
+ end
+
+ # Convert to single-precision 32-bit floating point value.
+ def narrow32bit(f)
+ if f.nan? || f.infinite?
+ f
+ elsif f.abs < MIN_POSITIVE_SINGLE
+ XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
+ else
+ f
+ end
+ end
+
+ def self.positive?(value)
+ (1 / value) > 0.0
+ end
+end
+
+# Ruby's Float is double-precision 64-bit floating point value.
+class XSDDouble < XSDAnySimpleType
+ include FloatConstants
+ Type = QName.new(Namespace, DoubleLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ # "NaN".to_f => 0 in some environment. libc?
+ if value.is_a?(Float)
+ return value
+ end
+ str = value.to_s.strip
+ if str == 'NaN'
+ NaN
+ elsif str == 'INF'
+ POSITIVE_INF
+ elsif str == '-INF'
+ NEGATIVE_INF
+ else
+ begin
+ return Float(str)
+ rescue ArgumentError
+ # '1.4e' cannot be parsed on some architecture.
+ if /e\z/i =~ str
+ begin
+ return Float(str + '0')
+ rescue ArgumentError
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!)
+ end
+ else
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!)
+ end
+ end
+ end
+ end
+
+ def _to_s
+ if @data.nan?
+ 'NaN'
+ elsif @data.infinite? == 1
+ 'INF'
+ elsif @data.infinite? == -1
+ '-INF'
+ else
+ sign = (1 / @data > 0.0) ? '+' : '-'
+ sign + sprintf("%.16g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
+ end
+ end
+end
+
+class XSDDuration < XSDAnySimpleType
+ Type = QName.new(Namespace, DurationLiteral)
+
+ attr_accessor :sign
+ attr_accessor :year
+ attr_accessor :month
+ attr_accessor :day
+ attr_accessor :hour
+ attr_accessor :min
+ attr_accessor :sec
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ /^([+\-]?)P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/ =~ value.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ if $5 and !$6 and !$7 and !$8
+ # allows durations lower than a day such as 'PT5S'.
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ sign = $1
+ year = $2.to_i
+ month = $3.to_i
+ day = $4.to_i
+ hour = $6.to_i
+ min = $7.to_i
+ sec = $8 ? XSDDecimal.new($8) : 0
+ [sign, year, month, day, hour, min, sec]
+ end
+
+ def _set(data)
+ if data.nil?
+ @sign = @year = @month = @day = @hour = @min = @sec = @data = nil
+ return
+ end
+ @sign, @year, @month, @day, @hour, @min, @sec = data
+ @data = _to_s
+ @data.freeze
+ end
+
+ def _to_s
+ str = ''
+ str << @sign if @sign
+ str << 'P'
+ l = ''
+ l << "#{ @year }Y" if @year.nonzero?
+ l << "#{ @month }M" if @month.nonzero?
+ l << "#{ @day }D" if @day.nonzero?
+ r = ''
+ r << "#{ @hour }H" if @hour.nonzero?
+ r << "#{ @min }M" if @min.nonzero?
+ r << "#{ @sec }S" if @sec.nonzero?
+ str << l
+ unless r.empty?
+ str << "T" << r
+ end
+ if l.empty? and r.empty?
+ str << "0D"
+ end
+ str
+ end
+end
+
+
+require 'rational'
+require 'date'
+
+module XSDDateTimeImpl
+ DayInSec = 86400 # 24 * 60 * 60
+ DayInMicro = 86400_000_000
+
+ def to_obj(klass)
+ if klass == Time
+ to_time
+ elsif klass == Date
+ to_date
+ elsif klass == DateTime
+ to_datetime
+ else
+ nil
+ end
+ end
+
+ def to_time
+ begin
+ if @data.offset * DayInSec == Time.now.utc_offset
+ d = @data
+ usec = (d.sec_fraction * DayInMicro).round
+ Time.local(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
+ else
+ d = @data.newof
+ usec = (d.sec_fraction * DayInMicro).round
+ Time.gm(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
+ end
+ rescue ArgumentError
+ nil
+ end
+ end
+
+ def to_date
+ Date.new0(@data.class.jd_to_ajd(@data.jd, 0, 0), 0, @data.start)
+ end
+
+ def to_datetime
+ data
+ end
+
+ def tz2of(str)
+ /^(?:Z|(?:([+\-])(\d\d):(\d\d))?)$/ =~ str
+ sign = $1
+ hour = $2.to_i
+ min = $3.to_i
+
+ of = case sign
+ when '+'
+ of = +(hour.to_r * 60 + min) / 1440 # 24 * 60
+ when '-'
+ of = -(hour.to_r * 60 + min) / 1440 # 24 * 60
+ else
+ 0
+ end
+ of
+ end
+
+ def of2tz(offset)
+ diffmin = offset * 24 * 60
+ if diffmin.zero?
+ 'Z'
+ else
+ ((diffmin < 0) ? '-' : '+') << format('%02d:%02d',
+ (diffmin.abs / 60.0).to_i, (diffmin.abs % 60.0).to_i)
+ end
+ end
+
+ def screen_data(t)
+ # convert t to a DateTime as an internal representation.
+ if t.respond_to?(:to_datetime) # 1.9 or later
+ t.to_datetime
+ elsif t.is_a?(DateTime)
+ t
+ elsif t.is_a?(Date)
+ t = screen_data_str(t)
+ t <<= 12 if t.year < 0
+ t
+ elsif t.is_a?(Time)
+ jd = DateTime.civil_to_jd(t.year, t.mon, t.mday, DateTime::ITALY)
+ fr = DateTime.time_to_day_fraction(t.hour, t.min, [t.sec, 59].min) +
+ t.usec.to_r / DayInMicro
+ of = t.utc_offset.to_r / DayInSec
+ DateTime.new0(DateTime.jd_to_ajd(jd, fr, of), of, DateTime::ITALY)
+ else
+ screen_data_str(t)
+ end
+ end
+
+ def add_tz(s)
+ s + of2tz(@data.offset)
+ end
+end
+
+class XSDDateTime < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, DateTimeLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^([+\-]?\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ if $1 == '0000'
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ year = $1.to_i
+ if year < 0
+ year += 1
+ end
+ mon = $2.to_i
+ mday = $3.to_i
+ hour = $4.to_i
+ min = $5.to_i
+ sec = $6.to_i
+ secfrac = $7
+ zonestr = $8
+ data = DateTime.civil(year, mon, mday, hour, min, sec, tz2of(zonestr))
+ if secfrac
+ diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / DayInSec
+ data += diffday
+ # FYI: new0 and jd_to_rjd are not necessary to use if you don't have
+ # exceptional reason.
+ end
+ [data, secfrac]
+ end
+
+ def _set(data)
+ if data.nil?
+ @data = @secfrac = nil
+ return
+ end
+ @data, @secfrac = data
+ end
+
+ def _to_s
+ year = (@data.year > 0) ? @data.year : @data.year - 1
+ s = format('%.4d-%02d-%02dT%02d:%02d:%02d',
+ year, @data.mon, @data.mday, @data.hour, @data.min, @data.sec)
+ if @data.sec_fraction.nonzero?
+ if @secfrac
+ s << ".#{ @secfrac }"
+ else
+ s << sprintf("%.16f",
+ (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '')
+ end
+ end
+ add_tz(s)
+ end
+end
+
+class XSDTime < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, TimeLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ hour = $1.to_i
+ min = $2.to_i
+ sec = $3.to_i
+ secfrac = $4
+ zonestr = $5
+ data = DateTime.civil(1, 1, 1, hour, min, sec, tz2of(zonestr))
+ if secfrac
+ diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / DayInSec
+ data += diffday
+ end
+ [data, secfrac]
+ end
+
+ def _set(data)
+ if data.nil?
+ @data = @secfrac = nil
+ return
+ end
+ @data, @secfrac = data
+ end
+
+ def _to_s
+ s = format('%02d:%02d:%02d', @data.hour, @data.min, @data.sec)
+ if @data.sec_fraction.nonzero?
+ if @secfrac
+ s << ".#{ @secfrac }"
+ else
+ s << sprintf("%.16f",
+ (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '')
+ end
+ end
+ add_tz(s)
+ end
+end
+
+class XSDDate < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, DateLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^([+\-]?\d{4,})-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ year = $1.to_i
+ if year < 0
+ year += 1
+ end
+ mon = $2.to_i
+ mday = $3.to_i
+ zonestr = $4
+ DateTime.civil(year, mon, mday, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ year = (@data.year > 0) ? @data.year : @data.year - 1
+ s = format('%.4d-%02d-%02d', year, @data.mon, @data.mday)
+ add_tz(s)
+ end
+end
+
+class XSDGYearMonth < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, GYearMonthLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^([+\-]?\d{4,})-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ year = $1.to_i
+ if year < 0
+ year += 1
+ end
+ mon = $2.to_i
+ zonestr = $3
+ DateTime.civil(year, mon, 1, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ year = (@data.year > 0) ? @data.year : @data.year - 1
+ s = format('%.4d-%02d', year, @data.mon)
+ add_tz(s)
+ end
+end
+
+class XSDGYear < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, GYearLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^([+\-]?\d{4,})(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ year = $1.to_i
+ if year < 0
+ year += 1
+ end
+ zonestr = $2
+ DateTime.civil(year, 1, 1, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ year = (@data.year > 0) ? @data.year : @data.year - 1
+ s = format('%.4d', year)
+ add_tz(s)
+ end
+end
+
+class XSDGMonthDay < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, GMonthDayLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^--(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ mon = $1.to_i
+ mday = $2.to_i
+ zonestr = $3
+ DateTime.civil(1, mon, mday, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ s = format('--%02d-%02d', @data.mon, @data.mday)
+ add_tz(s)
+ end
+end
+
+class XSDGDay < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, GDayLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^---(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ mday = $1.to_i
+ zonestr = $2
+ DateTime.civil(1, 1, mday, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ s = format('---%02d', @data.mday)
+ add_tz(s)
+ end
+end
+
+class XSDGMonth < XSDAnySimpleType
+ include XSDDateTimeImpl
+ Type = QName.new(Namespace, GMonthLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(t)
+ /^--(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
+ end
+ mon = $1.to_i
+ zonestr = $2
+ DateTime.civil(1, mon, 1, 0, 0, 0, tz2of(zonestr))
+ end
+
+ def _to_s
+ s = format('--%02d', @data.mon)
+ add_tz(s)
+ end
+end
+
+class XSDHexBinary < XSDAnySimpleType
+ Type = QName.new(Namespace, HexBinaryLiteral)
+
+ # String in Ruby could be a binary.
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+ def set_encoded(value)
+ if /^[0-9a-fA-F]*$/ !~ value
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ @data = String.new(value).strip
+ @is_nil = false
+ end
+
+ def string
+ [@data].pack("H*")
+ end
+
+private
+
+ def screen_data(value)
+ value.unpack("H*")[0].tr('a-f', 'A-F')
+ end
+end
+
+class XSDBase64Binary < XSDAnySimpleType
+ Type = QName.new(Namespace, Base64BinaryLiteral)
+
+ # String in Ruby could be a binary.
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+ def set_encoded(value)
+ if /^[A-Za-z0-9+\/=]*$/ !~ value
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ @data = String.new(value).strip
+ @is_nil = false
+ end
+
+ def string
+ @data.unpack("m")[0]
+ end
+
+private
+
+ def screen_data(value)
+ [value].pack("m").strip
+ end
+end
+
+class XSDAnyURI < XSDAnySimpleType
+ Type = QName.new(Namespace, AnyURILiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ begin
+ URI.parse(value.to_s.strip)
+ rescue URI::InvalidURIError
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.", $!)
+ end
+ end
+end
+
+class XSDQName < XSDAnySimpleType
+ Type = QName.new(Namespace, QNameLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ /^(?:([^:]+):)?([^:]+)$/ =~ value.to_s.strip
+ unless Regexp.last_match
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ prefix = $1
+ localpart = $2
+ [prefix, localpart]
+ end
+
+ def _set(data)
+ if data.nil?
+ @prefix = @localpart = @data = nil
+ return
+ end
+ @prefix, @localpart = data
+ @data = _to_s
+ @data.freeze
+ end
+
+ def _to_s
+ if @prefix
+ "#{ @prefix }:#{ @localpart }"
+ else
+ "#{ @localpart }"
+ end
+ end
+end
+
+
+###
+## Derived types
+#
+class XSDNormalizedString < XSDString
+ Type = QName.new(Namespace, NormalizedStringLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ if /[\t\r\n]/ =~ value
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ value
+ end
+end
+
+class XSDToken < XSDNormalizedString
+ Type = QName.new(Namespace, TokenLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ if /\A / =~ value or / \Z/ =~ value or value.index(' ')
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ value
+ end
+end
+
+class XSDLanguage < XSDToken
+ Type = QName.new(Namespace, LanguageLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # RFC 3066 syntax check
+ if /\A[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})?\z/ !~ value
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
+ end
+ value
+ end
+end
+
+class XSDNMTOKEN < XSDToken
+ Type = QName.new(Namespace, NMTOKENLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDNMTOKENS < XSDNMTOKEN
+ Type = QName.new(Namespace, NMTOKENSLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ # derived by list
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDName < XSDToken
+ Type = QName.new(Namespace, NameLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDNCName < XSDName
+ Type = QName.new(Namespace, NCNameLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDID < XSDNCName
+ Type = QName.new(Namespace, IDLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDIDREF < XSDNCName
+ Type = QName.new(Namespace, IDREFLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDIDREFS < XSDIDREF
+ Type = QName.new(Namespace, IDREFSLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ # derived by list
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDENTITY < XSDNCName
+ Type = QName.new(Namespace, ENTITYLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ super
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDENTITIES < XSDENTITY
+ Type = QName.new(Namespace, ENTITIESLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data(value)
+ # derived by list
+ # TODO: check lexical space and convert to a value
+ value
+ end
+end
+
+class XSDInteger < XSDDecimal
+ Type = QName.new(Namespace, IntegerLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def screen_data_str(str)
+ begin
+ data = Integer(str)
+ rescue ArgumentError
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!)
+ end
+ unless validate(data)
+ raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
+ end
+ data
+ end
+
+ def _set(value)
+ @data = value
+ end
+
+ def _to_s()
+ @data.to_s
+ end
+
+ def validate(v)
+ max = maxinclusive
+ min = mininclusive
+ (max.nil? or v <= max) and (min.nil? or v >= min)
+ end
+
+ def maxinclusive
+ nil
+ end
+
+ def mininclusive
+ nil
+ end
+
+ PositiveMinInclusive = 1
+ def positive(v)
+ PositiveMinInclusive <= v
+ end
+end
+
+class XSDNonPositiveInteger < XSDInteger
+ Type = QName.new(Namespace, NonPositiveIntegerLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ 0
+ end
+
+ def mininclusive
+ nil
+ end
+end
+
+class XSDNegativeInteger < XSDNonPositiveInteger
+ Type = QName.new(Namespace, NegativeIntegerLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ -1
+ end
+
+ def mininclusive
+ nil
+ end
+end
+
+class XSDLong < XSDInteger
+ Type = QName.new(Namespace, LongLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +9223372036854775807
+ end
+
+ def mininclusive
+ -9223372036854775808
+ end
+end
+
+class XSDInt < XSDLong
+ Type = QName.new(Namespace, IntLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +2147483647
+ end
+
+ def mininclusive
+ -2147483648
+ end
+end
+
+class XSDShort < XSDInt
+ Type = QName.new(Namespace, ShortLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +32767
+ end
+
+ def mininclusive
+ -32768
+ end
+end
+
+class XSDByte < XSDShort
+ Type = QName.new(Namespace, ByteLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +127
+ end
+
+ def mininclusive
+ -128
+ end
+end
+
+class XSDNonNegativeInteger < XSDInteger
+ Type = QName.new(Namespace, NonNegativeIntegerLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ nil
+ end
+
+ def mininclusive
+ 0
+ end
+end
+
+class XSDUnsignedLong < XSDNonNegativeInteger
+ Type = QName.new(Namespace, UnsignedLongLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +18446744073709551615
+ end
+
+ def mininclusive
+ 0
+ end
+end
+
+class XSDUnsignedInt < XSDUnsignedLong
+ Type = QName.new(Namespace, UnsignedIntLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +4294967295
+ end
+
+ def mininclusive
+ 0
+ end
+end
+
+class XSDUnsignedShort < XSDUnsignedInt
+ Type = QName.new(Namespace, UnsignedShortLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +65535
+ end
+
+ def mininclusive
+ 0
+ end
+end
+
+class XSDUnsignedByte < XSDUnsignedShort
+ Type = QName.new(Namespace, UnsignedByteLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ +255
+ end
+
+ def mininclusive
+ 0
+ end
+end
+
+class XSDPositiveInteger < XSDNonNegativeInteger
+ Type = QName.new(Namespace, PositiveIntegerLiteral)
+
+ def initialize(value = nil)
+ init(Type, value)
+ end
+
+private
+
+ def maxinclusive
+ nil
+ end
+
+ def mininclusive
+ 1
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb
new file mode 100644
index 00000000..5387ce02
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb
@@ -0,0 +1,20 @@
+# XSD4R - XML Schema Datatype 1999 support
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+
+
+module XSD
+ Namespace.replace('http://www.w3.org/1999/XMLSchema')
+ InstanceNamespace.replace('http://www.w3.org/1999/XMLSchema-instance')
+ AnyTypeLiteral.replace('ur-type')
+ AnySimpleTypeLiteral.replace('ur-type')
+ NilLiteral.replace('null')
+ NilValue.replace('1')
+ DateTimeLiteral.replace('timeInstant')
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb
new file mode 100644
index 00000000..57733a82
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb
@@ -0,0 +1,33 @@
+# XSD4R - Charset handling with iconv.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'iconv'
+
+
+module XSD
+
+
+class IconvCharset
+ def self.safe_iconv(to, from, str)
+ iconv = Iconv.new(to, from)
+ out = ""
+ begin
+ out << iconv.iconv(str)
+ rescue Iconv::IllegalSequence => e
+ out << e.success
+ ch, str = e.failed.split(//, 2)
+ out << '?'
+ warn("Failed to convert #{ch}")
+ retry
+ end
+ return out
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb
new file mode 100644
index 00000000..4602ee59
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb
@@ -0,0 +1,68 @@
+# XSD4R - XML Mapping for Ruby
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 "soap/parser"
+require 'soap/encodingstyle/literalHandler'
+require "soap/generator"
+require "soap/mapping"
+require "soap/mapping/wsdlliteralregistry"
+
+
+module XSD
+
+
+module Mapping
+ MappingRegistry = SOAP::Mapping::LiteralRegistry.new
+
+ def self.obj2xml(obj, elename = nil, io = nil)
+ Mapper.new(MappingRegistry).obj2xml(obj, elename, io)
+ end
+
+ def self.xml2obj(stream, klass = nil)
+ Mapper.new(MappingRegistry).xml2obj(stream, klass)
+ end
+
+ class Mapper
+ MAPPING_OPT = {
+ :default_encodingstyle => SOAP::LiteralNamespace,
+ :generate_explicit_type => false,
+ :root_type_hint => true
+ }.freeze
+
+ def initialize(registry)
+ @registry = registry
+ end
+
+ def obj2xml(obj, elename = nil, io = nil)
+ opt = MAPPING_OPT.dup
+ unless elename
+ if definition = @registry.elename_schema_definition_from_class(obj.class)
+ elename = definition.elename
+ opt[:root_type_hint] = false
+ end
+ end
+ elename = SOAP::Mapping.to_qname(elename) if elename
+ soap = SOAP::Mapping.obj2soap(obj, @registry, elename, opt)
+ if soap.elename.nil? or soap.elename == XSD::QName::EMPTY
+ soap.elename =
+ XSD::QName.new(nil, SOAP::Mapping.name2elename(obj.class.to_s))
+ end
+ generator = SOAP::Generator.new(opt)
+ generator.generate(soap, io)
+ end
+
+ def xml2obj(stream, klass = nil)
+ parser = SOAP::Parser.new(MAPPING_OPT)
+ soap = parser.parse(stream)
+ SOAP::Mapping.soap2obj(soap, @registry, klass)
+ end
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb
new file mode 100644
index 00000000..ec604249
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb
@@ -0,0 +1,132 @@
+# XSD4R - WSDL named element collection.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module XSD
+
+
+class NamedElements
+ include Enumerable
+
+ def initialize
+ @elements = []
+ @cache = {}
+ end
+
+ def dup
+ o = NamedElements.new
+ o.elements = @elements.dup
+ o
+ end
+
+ def freeze
+ super
+ @elements.freeze
+ self
+ end
+
+ def empty?
+ size == 0
+ end
+
+ def size
+ @elements.size
+ end
+
+ def [](idx)
+ if idx.is_a?(Numeric)
+ @elements[idx]
+ else
+ @cache[idx] ||= @elements.find { |item| item.name == idx }
+ end
+ end
+
+ def find_name(name)
+ @elements.find { |item| item.name.name == name }
+ end
+
+ def keys
+ collect { |element| element.name }
+ end
+
+ def each
+ @elements.each do |element|
+ yield(element)
+ end
+ end
+
+ def <<(rhs)
+ @elements << rhs
+ self
+ end
+
+ def delete(rhs)
+ rv = @elements.delete(rhs)
+ @cache.clear
+ rv
+ end
+
+ def +(rhs)
+ o = NamedElements.new
+ o.elements = @elements + rhs.elements
+ @cache.clear
+ o
+ end
+
+ def concat(rhs)
+ @elements.concat(rhs.elements)
+ @cache.clear
+ self
+ end
+
+ def uniq
+ o = NamedElements.new
+ o.elements = uniq_elements
+ o
+ end
+
+ def uniq!
+ @elements.replace(uniq_elements)
+ @cache.clear
+ end
+
+ def find_all
+ o = NamedElements.new
+ each do |ele|
+ o << ele if yield(ele)
+ end
+ o
+ end
+
+ Empty = NamedElements.new.freeze
+
+protected
+
+ def elements=(rhs)
+ @elements = rhs
+ end
+
+ def elements
+ @elements
+ end
+
+private
+
+ def uniq_elements
+ dict = {}
+ elements = []
+ @elements.each do |ele|
+ unless dict.key?(ele.name)
+ dict[ele.name] = ele
+ elements << ele
+ end
+ end
+ elements
+ end
+end
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb
new file mode 100644
index 00000000..b3427666
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb
@@ -0,0 +1,182 @@
+# XSD4R - XML Schema Namespace library
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/datatypes'
+
+
+module XSD
+
+
+class NS
+ Namespace = 'http://www.w3.org/XML/1998/namespace'
+
+ KNOWN_TAG = {
+ XSD::Namespace => 'xsd',
+ XSD::InstanceNamespace => 'xsi',
+ }
+
+ class Assigner
+ attr_reader :known_tag
+
+ def initialize(known_tag)
+ @known_tag = known_tag.dup
+ @count = 0
+ end
+
+ def assign(ns)
+ if @known_tag.key?(ns)
+ return @known_tag[ns]
+ end
+ @count += 1
+ "n#{@count}"
+ end
+ end
+
+ attr_reader :default_namespace
+
+ class FormatError < Error; end
+
+public
+
+ def initialize(tag2ns = nil)
+ @tag2ns = tag2ns || ns_default
+ @ns2tag = @tag2ns.invert
+ @assigner = nil
+ @default_namespace = nil
+ end
+
+ def known_tag
+ @assigner ||= Assigner.new(default_known_tag)
+ @assigner.known_tag
+ end
+
+ def assign(ns, tag = nil)
+ if tag == ''
+ if ns.empty?
+ @default_namespace = nil
+ else
+ @default_namespace = ns
+ end
+ tag
+ else
+ @assigner ||= Assigner.new(default_known_tag)
+ tag ||= @assigner.assign(ns)
+ @ns2tag[ns] = tag
+ @tag2ns[tag] = ns
+ tag
+ end
+ end
+
+ def assigned?(ns)
+ @default_namespace == ns or @ns2tag.key?(ns)
+ end
+
+ def assigned_as_tagged?(ns)
+ @ns2tag.key?(ns)
+ end
+
+ def assigned_tag?(tag)
+ @tag2ns.key?(tag)
+ end
+
+ def clone_ns
+ cloned = self.class.new(@tag2ns.dup)
+ cloned.assigner = @assigner
+ cloned.assign(@default_namespace, '') if @default_namespace
+ cloned
+ end
+
+ def name(qname)
+ if qname.namespace == @default_namespace
+ qname.name
+ elsif tag = @ns2tag[qname.namespace]
+ "#{tag}:#{qname.name}"
+ else
+ raise FormatError.new("namespace: #{qname.namespace} not defined yet")
+ end
+ end
+
+ # no default namespace
+ def name_attr(qname)
+ if tag = @ns2tag[qname.namespace]
+ "#{tag}:#{qname.name}"
+ else
+ raise FormatError.new("namespace: #{qname.namespace} not defined yet")
+ end
+ end
+
+ def compare(ns, name, rhs)
+ if (ns == @default_namespace)
+ return true if (name == rhs)
+ end
+ @tag2ns.each do |assigned_tag, assigned_ns|
+ if assigned_ns == ns && "#{assigned_tag}:#{name}" == rhs
+ return true
+ end
+ end
+ false
+ end
+
+ # $1 and $2 are necessary.
+ ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z')
+
+ def parse(str, local = false)
+ if ParseRegexp =~ str
+ if (name = $2) and (ns = @tag2ns[$1])
+ return XSD::QName.new(ns, name)
+ end
+ end
+ XSD::QName.new(local ? nil : @default_namespace, str)
+ end
+
+ # For local attribute key parsing
+ #
+ # =>
+ # {}bar, {urn:a}baz
+ def parse_local(elem)
+ ParseRegexp =~ elem
+ if $2
+ ns = @tag2ns[$1]
+ name = $2
+ if !ns
+ raise FormatError.new("unknown namespace qualifier: #{$1}")
+ end
+ elsif $1
+ ns = nil
+ name = $1
+ else
+ raise FormatError.new("illegal element format: #{elem}")
+ end
+ XSD::QName.new(ns, name)
+ end
+
+ def each_ns
+ @ns2tag.each do |ns, tag|
+ yield(ns, tag)
+ end
+ end
+
+protected
+
+ def assigner=(assigner)
+ @assigner = assigner
+ end
+
+private
+
+ def ns_default
+ {'xml' => Namespace}
+ end
+
+ def default_known_tag
+ KNOWN_TAG
+ end
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb
new file mode 100644
index 00000000..10377e21
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb
@@ -0,0 +1,79 @@
+# XSD4R - XML QName definition.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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.
+
+
+module XSD
+
+
+class QName
+ attr_reader :namespace
+ attr_reader :name
+ attr_accessor :source
+
+ def initialize(namespace = nil, name = nil)
+ @namespace = namespace
+ @name = name
+ @source = nil
+ end
+
+ def dup_name(name)
+ XSD::QName.new(@namespace, name)
+ end
+
+ def dump(predefined_ns = nil)
+ ns = predefined_ns
+ ns ||= @namespace.nil? ? 'nil' : @namespace.dump
+ name = @name.nil? ? 'nil' : @name.dump
+ "XSD::QName.new(#{ns}, #{name})"
+ end
+
+ def match(rhs)
+ if rhs.namespace and (rhs.namespace != @namespace)
+ return false
+ end
+ if rhs.name and (rhs.name != @name)
+ return false
+ end
+ true
+ end
+
+ def ==(rhs)
+ !rhs.nil? and @namespace == rhs.namespace and @name == rhs.name
+ end
+
+ def ===(rhs)
+ (self == rhs)
+ end
+
+ def eql?(rhs)
+ (self == rhs)
+ end
+
+ def hash
+ @namespace.hash ^ @name.hash
+ end
+
+ def to_s
+ "{#{ namespace }}#{ name }"
+ end
+
+ def inspect
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__,
+ "{#{ namespace }}#{ name }")
+ end
+
+ NormalizedNameRegexp = /^\{([^}]*)\}(.*)$/
+ def parse(str)
+ NormalizedNameRegexp =~ str
+ self.new($1, $2)
+ end
+
+ EMPTY = QName.new.freeze
+end
+
+
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb
new file mode 100644
index 00000000..c3f29649
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb
@@ -0,0 +1,82 @@
+# XSD4R - XML Instance parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser/parser'
+require 'soap/property'
+
+
+module XSD
+
+
+module XMLParser
+ def create_parser(host, opt)
+ XSD::XMLParser::Parser.create_parser(host, opt)
+ end
+ module_function :create_parser
+
+ # $1 is necessary.
+ NSParseRegexp = Regexp.new("^xmlns:?(.*)$")
+
+ def filter_ns(ns, attrs)
+ ns_updated = false
+ if attrs.nil? or attrs.empty?
+ return [ns, attrs]
+ end
+ newattrs = {}
+ attrs.each do |key, value|
+ if NSParseRegexp =~ key
+ unless ns_updated
+ ns = ns.clone_ns
+ ns_updated = true
+ end
+ # tag == '' means 'default namespace'
+ # value == '' means 'no default namespace'
+ tag = $1 || ''
+ ns.assign(value, tag)
+ else
+ newattrs[key] = value
+ end
+ end
+ return [ns, newattrs]
+ end
+ module_function :filter_ns
+end
+
+
+end
+
+
+PARSER_LIBS = [
+ 'libxmlparser',
+ 'xmlparser',
+ 'xmlscanner',
+ 'rexmlparser'
+]
+# Get library prefs
+opt = ::SOAP::Property.loadproperty('soap/property')
+use_libxml = (opt and opt['parser'] and opt['parser']['use_libxml'] and opt['parser']['use_libxml'] == 'false') ? false : true
+# Try to load XML processor.
+loaded = false
+PARSER_LIBS.each do |name|
+ begin
+ lib = "xsd/xmlparser/#{name}"
+ require lib unless !use_libxml && name == 'libxmlparser'
+ # XXX: for a workaround of rubygems' require inconsistency
+ # XXX: MUST BE REMOVED IN THE FUTURE
+ raise LoadError unless XSD::XMLParser.constants.find { |c|
+ c.to_s.downcase == name.downcase
+ }
+ loaded = true
+ break
+ rescue LoadError
+ end
+end
+unless loaded
+ raise RuntimeError.new("XML processor module not found.")
+end
+
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb.orig b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb.orig
new file mode 100644
index 00000000..2880c557
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb.orig
@@ -0,0 +1,76 @@
+# XSD4R - XML Instance parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser/parser'
+
+
+module XSD
+
+
+module XMLParser
+ def create_parser(host, opt)
+ XSD::XMLParser::Parser.create_parser(host, opt)
+ end
+ module_function :create_parser
+
+ # $1 is necessary.
+ NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE')
+
+ def filter_ns(ns, attrs)
+ ns_updated = false
+ if attrs.nil? or attrs.empty?
+ return [ns, attrs]
+ end
+ newattrs = {}
+ attrs.each do |key, value|
+ if NSParseRegexp =~ key
+ unless ns_updated
+ ns = ns.clone_ns
+ ns_updated = true
+ end
+ # tag == '' means 'default namespace'
+ # value == '' means 'no default namespace'
+ tag = $1 || ''
+ ns.assign(value, tag)
+ else
+ newattrs[key] = value
+ end
+ end
+ return [ns, newattrs]
+ end
+ module_function :filter_ns
+end
+
+
+end
+
+
+# Try to load XML processor.
+loaded = false
+[
+ 'xsd/xmlparser/libxmlparser',
+ 'xsd/xmlparser/xmlparser',
+ 'xsd/xmlparser/xmlscanner',
+ 'xsd/xmlparser/rexmlparser',
+].each do |lib|
+ begin
+ require lib
+ # XXX: for a workaround of rubygems' require inconsistency
+ # XXX: MUST BE REMOVED IN THE FUTURE
+ name = lib.sub(/^.*\//, '')
+ raise LoadError unless XSD::XMLParser.constants.find { |c|
+ c.downcase == name
+ }
+ loaded = true
+ break
+ rescue LoadError
+ end
+end
+unless loaded
+ raise RuntimeError.new("XML processor module not found.")
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/libxmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/libxmlparser.rb
new file mode 100644
index 00000000..9202f9d3
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/libxmlparser.rb
@@ -0,0 +1,119 @@
+# XSD4R - XMLParser XML parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser'
+require 'xml/libxml'
+
+
+module XSD
+module XMLParser
+
+
+class LibXMLParser < XSD::XMLParser::Parser
+ include XML::SaxParser::Callbacks
+
+ def do_parse(string_or_readable)
+ if string_or_readable.respond_to?(:read)
+ string = string_or_readable.read
+ else
+ string = string_or_readable
+ end
+ # XMLParser passes a String in utf-8.
+ @charset = 'utf-8'
+ @parser = XML::SaxParser.string(string)
+ @parser.callbacks = self
+ @parser.parse
+ end
+
+ ENTITY_REF_MAP = {
+ 'lt' => '<',
+ 'gt' => '>',
+ 'amp' => '&',
+ 'quot' => '"',
+ 'apos' => '\''
+ }
+
+ #def on_internal_subset(name, external_id, system_id)
+ # nil
+ #end
+
+ #def on_is_standalone()
+ # nil
+ #end
+
+ #def on_has_internal_subset()
+ # nil
+ #end
+
+ #def on_has_external_subset()
+ # nil
+ #end
+
+ #def on_start_document()
+ # nil
+ #end
+
+ #def on_end_document()
+ # nil
+ #end
+
+ def on_start_element_ns(name, attributes, prefix, uri, namespaces)
+ name = "#{prefix}:#{name}" unless prefix.nil?
+ namespaces.each do |key,value|
+ nsprefix = key.nil? ? "xmlns" : "xmlns:#{key}"
+ attributes[nsprefix] = value
+ end
+ start_element(name, attributes)
+ end
+
+ def on_end_element(name)
+ end_element(name)
+ end
+
+ def on_reference(name)
+ characters(ENTITY_REF_MAP[name])
+ end
+
+ def on_characters(chars)
+ characters(chars)
+ end
+
+ #def on_processing_instruction(target, data)
+ # nil
+ #end
+
+ #def on_comment(msg)
+ # nil
+ #end
+
+ def on_parser_warning(msg)
+ warn(msg)
+ end
+
+ def on_parser_error(msg)
+ raise ParseError.new(msg)
+ end
+
+ def on_parser_fatal_error(msg)
+ raise ParseError.new(msg)
+ end
+
+ def on_cdata_block(cdata)
+ characters(cdata)
+ end
+
+ def on_external_subset(name, external_id, system_id)
+ nil
+ end
+
+ add_factory(self)
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb
new file mode 100644
index 00000000..4bdd895f
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb
@@ -0,0 +1,100 @@
+# XSD4R - XML Instance parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/qname'
+require 'xsd/ns'
+require 'xsd/charset'
+
+
+module XSD
+module XMLParser
+
+
+class Parser
+ class ParseError < Error; end
+ class FormatDecodeError < ParseError; end
+ class UnknownElementError < FormatDecodeError; end
+ class UnknownAttributeError < FormatDecodeError; end
+ class UnexpectedElementError < FormatDecodeError; end
+ class ElementConstraintError < FormatDecodeError; end
+ class ParserError < ParseError; end
+
+ @@parser_factory = nil
+
+ def self.factory
+ @@parser_factory
+ end
+
+ def self.create_parser(host, opt = {})
+ unless @@parser_factory
+ raise ParserError.new("illegal XML parser configuration")
+ end
+ @@parser_factory.new(host, opt)
+ end
+
+ def self.add_factory(factory)
+ if $DEBUG
+ puts "Set #{ factory } as XML processor."
+ end
+ @@parser_factory = factory
+ end
+
+public
+
+ attr_accessor :charset
+
+ def initialize(host, opt = {})
+ @host = host
+ @charset = opt[:charset] || nil
+ end
+
+ def parse(string_or_readable)
+ @textbuf = ''
+ prologue
+ do_parse(string_or_readable)
+ epilogue
+ end
+
+private
+
+ def do_parse(string_or_readable)
+ raise ParserError.new(
+ 'Method do_parse must be defined in derived class.')
+ end
+
+ def start_element(name, attrs)
+ @host.start_element(name, attrs)
+ end
+
+ def characters(text)
+ @host.characters(text)
+ end
+
+ def end_element(name)
+ @host.end_element(name)
+ end
+
+ def prologue
+ end
+
+ def epilogue
+ end
+
+ def xmldecl_encoding=(charset)
+ if @charset.nil?
+ @charset = charset
+ else
+ # Definition in a stream (like HTTP) has a priority.
+ p "encoding definition: #{ charset } is ignored." if $DEBUG
+ end
+ end
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb
new file mode 100644
index 00000000..76ac75c8
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb
@@ -0,0 +1,58 @@
+# XSD4R - REXMLParser XML parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser'
+require 'rexml/streamlistener'
+require 'rexml/document'
+
+
+module XSD
+module XMLParser
+
+
+class REXMLParser < XSD::XMLParser::Parser
+ include REXML::StreamListener
+
+ def do_parse(string_or_readable)
+ source = nil
+ source = REXML::SourceFactory.create_from(string_or_readable)
+ source.encoding = charset if charset
+ # Listener passes a String in utf-8.
+ @charset = 'utf-8'
+ REXML::Document.parse_stream(source, self)
+ end
+
+ def epilogue
+ end
+
+ def tag_start(name, attrs)
+ start_element(name, attrs)
+ end
+
+ def tag_end(name)
+ end_element(name)
+ end
+
+ def text(text)
+ characters(text)
+ end
+
+ def cdata(content)
+ characters(content)
+ end
+
+ def xmldecl(version, encoding, standalone)
+ # Version should be checked.
+ end
+
+ add_factory(self)
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb
new file mode 100644
index 00000000..c7a9f65a
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb
@@ -0,0 +1,50 @@
+# XSD4R - XMLParser XML parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser'
+require 'xml/parser'
+
+
+module XSD
+module XMLParser
+
+
+class XMLParser < XSD::XMLParser::Parser
+ class Listener < XML::Parser
+ begin
+ require 'xml/encoding-ja'
+ include XML::Encoding_ja
+ rescue LoadError
+ # uconv may not be installed.
+ end
+ end
+
+ def do_parse(string_or_readable)
+ # XMLParser passes a String in utf-8.
+ @charset = 'utf-8'
+ @parser = Listener.new
+ @parser.parse(string_or_readable) do |type, name, data|
+ case type
+ when XML::Parser::START_ELEM
+ start_element(name, data)
+ when XML::Parser::END_ELEM
+ end_element(name)
+ when XML::Parser::CDATA
+ characters(data)
+ else
+ raise FormatDecodeError.new("Unexpected XML: #{ type }/#{ name }/#{ data }.")
+ end
+ end
+ end
+
+ add_factory(self)
+end
+
+
+end
+end
diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb
new file mode 100644
index 00000000..c4d3d74e
--- /dev/null
+++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb
@@ -0,0 +1,149 @@
+# XSD4R - XMLScan XML parser library.
+# Copyright (C) 2000-2007 NAKAMURA, Hiroshi .
+
+# 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 'xsd/xmlparser'
+require 'xmlscan/scanner'
+
+
+module XSD
+module XMLParser
+
+
+class XMLScanner < XSD::XMLParser::Parser
+ include XMLScan::Visitor
+
+ def do_parse(string_or_readable)
+ @attrs = {}
+ @curattr = nil
+ @scanner = XMLScan::XMLScanner.new(self)
+ @scanner.kcode = XSD::Charset.charset_str(charset) if charset
+ @scanner.parse(string_or_readable)
+ end
+
+ def scanner_kcode=(charset)
+ @scanner.kcode = XSD::Charset.charset_str(charset) if charset
+ self.xmldecl_encoding = charset
+ end
+
+ ENTITY_REF_MAP = {
+ 'lt' => '<',
+ 'gt' => '>',
+ 'amp' => '&',
+ 'quot' => '"',
+ 'apos' => '\''
+ }
+
+ def parse_error(msg)
+ raise ParseError.new(msg)
+ end
+
+ def wellformed_error(msg)
+ raise NotWellFormedError.new(msg)
+ end
+
+ def valid_error(msg)
+ raise NotValidError.new(msg)
+ end
+
+ def warning(msg)
+ warn(msg)
+ end
+
+ # def on_xmldecl; end
+
+ def on_xmldecl_version(str)
+ # 1.0 expected.
+ end
+
+ def on_xmldecl_encoding(str)
+ self.scanner_kcode = str
+ end
+
+ # def on_xmldecl_standalone(str); end
+
+ # def on_xmldecl_other(name, value); end
+
+ # def on_xmldecl_end; end
+
+ # def on_doctype(root, pubid, sysid); end
+
+ # def on_prolog_space(str); end
+
+ # def on_comment(str); end
+
+ # def on_pi(target, pi); end
+
+ def on_chardata(str)
+ characters(str)
+ end
+
+ def on_cdata(str)
+ characters(str)
+ end
+
+ def on_etag(name)
+ end_element(name)
+ end
+
+ def on_entityref(ref)
+ characters(ENTITY_REF_MAP[ref])
+ end
+
+ def on_charref(code)
+ characters([code].pack('U'))
+ end
+
+ def on_charref_hex(code)
+ on_charref(code)
+ end
+
+ # def on_start_document; end
+
+ # def on_end_document; end
+
+ def on_stag(name)
+ @attrs = {}
+ end
+
+ def on_attribute(name)
+ @attrs[name] = @curattr = ''
+ end
+
+ def on_attr_value(str)
+ @curattr << str
+ end
+
+ def on_attr_entityref(ref)
+ @curattr << ENTITY_REF_MAP[ref]
+ end
+
+ def on_attr_charref(code)
+ @curattr << [code].pack('U')
+ end
+
+ def on_attr_charref_hex(code)
+ on_attr_charref(code)
+ end
+
+ # def on_attribute_end(name); end
+
+ def on_stag_end_empty(name)
+ on_stag_end(name)
+ on_etag(name)
+ end
+
+ def on_stag_end(name)
+ start_element(name, @attrs)
+ end
+
+ add_factory(self)
+end
+
+
+end
+end
diff --git a/vendor/plugins/auto_complete/README b/vendor/plugins/auto_complete/README
deleted file mode 100644
index e08a8151..00000000
--- a/vendor/plugins/auto_complete/README
+++ /dev/null
@@ -1,23 +0,0 @@
-Example:
-
- # Controller
- class BlogController < ApplicationController
- auto_complete_for :post, :title
- end
-
- # View
- <%= text_field_with_auto_complete :post, title %>
-
-By default, auto_complete_for limits the results to 10 entries,
-and sorts by the given field.
-
-auto_complete_for takes a third parameter, an options hash to
-the find method used to search for the records:
-
- auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
-
-For more examples, see script.aculo.us:
-* http://script.aculo.us/demos/ajax/autocompleter
-* http://script.aculo.us/demos/ajax/autocompleter_customized
-
-Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
diff --git a/vendor/plugins/auto_complete/Rakefile b/vendor/plugins/auto_complete/Rakefile
deleted file mode 100644
index 5af4e826..00000000
--- a/vendor/plugins/auto_complete/Rakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test auto_complete plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for auto_complete plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'Auto Complete'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/vendor/plugins/auto_complete/init.rb b/vendor/plugins/auto_complete/init.rb
deleted file mode 100644
index 87bf027d..00000000
--- a/vendor/plugins/auto_complete/init.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-ActionController::Base.send :include, AutoComplete
-ActionController::Base.helper AutoCompleteMacrosHelper
\ No newline at end of file
diff --git a/vendor/plugins/auto_complete/lib/auto_complete.rb b/vendor/plugins/auto_complete/lib/auto_complete.rb
deleted file mode 100644
index 4afc7c2e..00000000
--- a/vendor/plugins/auto_complete/lib/auto_complete.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-module AutoComplete
-
- def self.included(base)
- base.extend(ClassMethods)
- end
-
- #
- # Example:
- #
- # # Controller
- # class BlogController < ApplicationController
- # auto_complete_for :post, :title
- # end
- #
- # # View
- # <%= text_field_with_auto_complete :post, title %>
- #
- # By default, auto_complete_for limits the results to 10 entries,
- # and sorts by the given field.
- #
- # auto_complete_for takes a third parameter, an options hash to
- # the find method used to search for the records:
- #
- # auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
- #
- # For help on defining text input fields with autocompletion,
- # see ActionView::Helpers::JavaScriptHelper.
- #
- # For more examples, see script.aculo.us:
- # * http://script.aculo.us/demos/ajax/autocompleter
- # * http://script.aculo.us/demos/ajax/autocompleter_customized
- module ClassMethods
- def auto_complete_for(object, method, options = {})
- define_method("auto_complete_for_#{object}_#{method}") do
- find_options = {
- :conditions => [ "LOWER(#{method}) LIKE ?", '%' + params[object][method].downcase + '%' ],
- :order => "#{method} ASC",
- :limit => 10 }.merge!(options)
-
- @items = object.to_s.camelize.constantize.find(:all, find_options)
-
- render :inline => "<%= auto_complete_result @items, '#{method}' %>"
- end
- end
- end
-
-end
\ No newline at end of file
diff --git a/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb b/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb
deleted file mode 100644
index 1d25ee47..00000000
--- a/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-module AutoCompleteMacrosHelper
- # Adds AJAX autocomplete functionality to the text input field with the
- # DOM ID specified by +field_id+.
- #
- # This function expects that the called action returns an HTML
list,
- # or nothing if no entries should be displayed for autocompletion.
- #
- # You'll probably want to turn the browser's built-in autocompletion off,
- # so be sure to include an autocomplete="off" attribute with your text
- # input field.
- #
- # The autocompleter object is assigned to a Javascript variable named field_id_auto_completer.
- # This object is useful if you for example want to trigger the auto-complete suggestions through
- # other means than user input (for that specific case, call the activate method on that object).
- #
- # Required +options+ are:
- # :url:: URL to call for autocompletion results
- # in url_for format.
- #
- # Addtional +options+ are:
- # :update:: Specifies the DOM ID of the element whose
- # innerHTML should be updated with the autocomplete
- # entries returned by the AJAX request.
- # Defaults to field_id + '_auto_complete'
- # :with:: A JavaScript expression specifying the
- # parameters for the XMLHttpRequest. This defaults
- # to 'fieldname=value'.
- # :frequency:: Determines the time to wait after the last keystroke
- # for the AJAX request to be initiated.
- # :indicator:: Specifies the DOM ID of an element which will be
- # displayed while autocomplete is running.
- # :tokens:: A string or an array of strings containing
- # separator tokens for tokenized incremental
- # autocompletion. Example: :tokens => ',' would
- # allow multiple autocompletion entries, separated
- # by commas.
- # :min_chars:: The minimum number of characters that should be
- # in the input field before an Ajax call is made
- # to the server.
- # :on_hide:: A Javascript expression that is called when the
- # autocompletion div is hidden. The expression
- # should take two variables: element and update.
- # Element is a DOM element for the field, update
- # is a DOM element for the div from which the
- # innerHTML is replaced.
- # :on_show:: Like on_hide, only now the expression is called
- # then the div is shown.
- # :after_update_element:: A Javascript expression that is called when the
- # user has selected one of the proposed values.
- # The expression should take two variables: element and value.
- # Element is a DOM element for the field, value
- # is the value selected by the user.
- # :select:: Pick the class of the element from which the value for
- # insertion should be extracted. If this is not specified,
- # the entire element is used.
- # :method:: Specifies the HTTP verb to use when the autocompletion
- # request is made. Defaults to POST.
- def auto_complete_field(field_id, options = {})
- function = "var #{field_id}_auto_completer = new Ajax.Autocompleter("
- function << "'#{field_id}', "
- function << "'" + (options[:update] || "#{field_id}_auto_complete") + "', "
- function << "'#{url_for(options[:url])}'"
-
- js_options = {}
- js_options[:tokens] = array_or_string_for_javascript(options[:tokens]) if options[:tokens]
- js_options[:callback] = "function(element, value) { return #{options[:with]} }" if options[:with]
- js_options[:indicator] = "'#{options[:indicator]}'" if options[:indicator]
- js_options[:select] = "'#{options[:select]}'" if options[:select]
- js_options[:paramName] = "'#{options[:param_name]}'" if options[:param_name]
- js_options[:frequency] = "#{options[:frequency]}" if options[:frequency]
- js_options[:method] = "'#{options[:method].to_s}'" if options[:method]
-
- { :after_update_element => :afterUpdateElement,
- :on_show => :onShow, :on_hide => :onHide, :min_chars => :minChars }.each do |k,v|
- js_options[v] = options[k] if options[k]
- end
-
- function << (', ' + options_for_javascript(js_options) + ')')
-
- javascript_tag(function)
- end
-
- # Use this method in your view to generate a return for the AJAX autocomplete requests.
- #
- # Example action:
- #
- # def auto_complete_for_item_title
- # @items = Item.find(:all,
- # :conditions => [ 'LOWER(description) LIKE ?',
- # '%' + request.raw_post.downcase + '%' ])
- # render :inline => "<%= auto_complete_result(@items, 'description') %>"
- # end
- #
- # The auto_complete_result can of course also be called from a view belonging to the
- # auto_complete action if you need to decorate it further.
- def auto_complete_result(entries, field, phrase = nil)
- return unless entries
- items = entries.map { |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field])) }
- content_tag("ul", items.uniq)
- end
-
- # Wrapper for text_field with added AJAX autocompletion functionality.
- #
- # In your controller, you'll need to define an action called
- # auto_complete_for to respond the AJAX calls,
- #
- def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {})
- (completion_options[:skip_style] ? "" : auto_complete_stylesheet) +
- text_field(object, method, tag_options) +
- content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") +
- auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options))
- end
-
- private
- def auto_complete_stylesheet
- content_tag('style', <<-EOT, :type => Mime::CSS)
- div.auto_complete {
- width: 350px;
- background: #fff;
- }
- div.auto_complete ul {
- border:1px solid #888;
- margin:0;
- padding:0;
- width:100%;
- list-style-type:none;
- }
- div.auto_complete ul li {
- margin:0;
- padding:3px;
- }
- div.auto_complete ul li.selected {
- background-color: #ffb;
- }
- div.auto_complete ul strong.highlight {
- color: #800;
- margin:0;
- padding:0;
- }
- EOT
- end
-
-end
diff --git a/vendor/plugins/auto_complete/test/auto_complete_test.rb b/vendor/plugins/auto_complete/test/auto_complete_test.rb
deleted file mode 100644
index dc9a5c91..00000000
--- a/vendor/plugins/auto_complete/test/auto_complete_test.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../../test/test_helper'))
-
-class AutoCompleteTest < Test::Unit::TestCase
- include AutoComplete
- include AutoCompleteMacrosHelper
-
- include ActionView::Helpers::UrlHelper
- include ActionView::Helpers::TagHelper
- include ActionView::Helpers::TextHelper
- include ActionView::Helpers::FormHelper
- include ActionView::Helpers::CaptureHelper
-
- def setup
- @controller = Class.new do
- def url_for(options)
- url = "http://www.example.com/"
- url << options[:action].to_s if options and options[:action]
- url
- end
- end
- @controller = @controller.new
- end
-
-
- def test_auto_complete_field
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" });
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){alert('me');}");
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :frequency => 2);
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" },
- :after_update_element => "function(element,value){alert('You have chosen: '+value)}");
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch');
- assert_dom_equal %(),
- auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get);
- end
-
- def test_auto_complete_result
- result = [ { :title => 'test1' }, { :title => 'test2' } ]
- assert_equal %(