2016-04-22 12 views
0

wash_out gemを使用して作成したSOAPサービスからxml応答を取得できません。今のところ、ウォッシュアウトのサンプルコードのように整数を文字列に変換するsoapレスポンスが必要です。私がここで間違っていることは何ですか?wash_out gemエラーsoap_configメソッドへのアクセス

私のコントローラのコードは次のとおりです。サーバーは、次のRPCのWSDLで応答

soap_service namespace: 'http://localhost:3000/api/accounts/wsdl' 
soap_action "get_new_account", 
      :args => :integer, 
      :return => :string 
def get_new_account 
render :soap => params[:value].to_s 
end 

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost:3000/api/accounts/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="api_accounts" targetNamespace="http://localhost:3000/api/accounts/wsdl"> 
<types> 
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:3000/api/accounts/wsdl"></schema> 
</types> 
<portType name="api_accounts_port"> 
<operation name="get_new_account"> 
<input message="tns:get_new_account"/> 
<output message="tns:get_new_account_response"/> 
</operation> 
</portType> 
<binding name="api_accounts_binding" type="tns:api_accounts_port"> 
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
<operation name="get_new_account"> 
<soap:operation soapAction="get_new_account"/> 
<input> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:3000/api/accounts/wsdl"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:3000/api/accounts/wsdl"/> 
</output> 
</operation> 
</binding> 
<service name="service"> 
<port name="api_accounts_port" binding="tns:api_accounts_binding"> 
<soap:address location="http://localhost:3000/api/accounts/action"/> 
</port> 
</service> 
<message name="get_new_account"> 
<part name="value" type="xsd:int"/> 
</message> 
<message name="get_new_account_response"> 
<part name="value" type="xsd:string"/> 
</message> 
</definitions> 

SOAPクライアントは、次のメッセージ送信されます。

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> 
    <Body> 
     <get_new_account xmlns="http://localhost:3000/api/accounts/wsdl"> 
      <value>123</value> 
     </get_new_account> 
    </Body> 
</Envelope> 

サーバーを次の内部エラーで失敗します。

詳細私のレールの環境に210
Started POST "/api/accounts/action" for ::1 at 2016-04-22 11:29:10 -0400 

NoMethodError (undefined method `soap_config' for AccountsController:Class): 
    wash_out (0.9.2) lib/wash_out/router.rb:18:in `parse_soap_action' 

は、私も自分のGemfileを含める:

source 'https://rubygems.org' 

ruby '2.3.0' 
#ruby-gemset=washout 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.2' 
#ruby-gemset=washout 

gem 'therubyracer' 
# Use sqlite3 as the database for Active Record 
#gem 'sqlite3' 

# Use SCSS for stylesheets 
gem 'bootstrap-sass', '~> 3.3.6' 
gem 'sass-rails', '>= 3.2' 
gem 'sprockets-rails' 

# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
gem 'utf8_enforcer_workaround' 


gem 'autoprefixer-rails', '>= 5.2.1' 
gem 'pg' 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
# gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Wash Out Soap Service 
gem 'wash_out', '0.9.2' 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 
    gem 'annotate' 
    gem 'rspec-rails' 
    gem 'factory_girl_rails' 

    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 
    gem 'capistrano' 
    gem 'capistrano-bundler' 
    gem 'capistrano-passenger' 
    gem 'capistrano-rails' 
    # gem 'capistrano-rvm' 
end 

group :test do 
    gem 'faker', '1.4.2' 
    gem 'capybara' 
    gem 'selenium-webdriver' 
    gem 'database_cleaner' 
    gem 'guard-rspec' 
    gem 'launchy' 
end 

答えて

2

これはwash_outは、コントローラが間違って見つけたことを意味しています。

GEMソースコード(wash_out-0.9.2/LIB/wash_out/router.rb):

class Router 
    def initialize(controller_name) # controller_name = "accounts" 
    # @controller_name = AccountController 
    # the controller maybe incorrect. 
    @controller_name = "#{controller_name.to_s}_controller".camelize 
    end 
    ... 
end 

GEMは、コントローラが正しい見出されていることを確認してください。

お使いのコントローラのコードは次のとおりです。

class Api::AccountsController < ApplicationController 
    soap_service namespace: 'http://localhost:3000/api/accounts/wsdl' 
    soap_action "get_new_account", 
     :args => :integer, 
     :return => :string 
    def get_new_account 
    render :soap => params[:value].to_s 
    end 
end 

右cofing/routes.rbをコードは次のとおりです。

wash_out "Api::Accounts" 

上記のコードはバージョン0.9.2で働いています。

バージョン0.10.0、あなたはこれを行うことができます。

wash_out :accounts, module: "Api" 
関連する問題