teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

require追記

2020/11/25 07:26

投稿

tkshp
tkshp

スコア174

title CHANGED
File without changes
body CHANGED
@@ -33,6 +33,8 @@
33
33
 
34
34
  SOAPクライアントのrubyファイル[Railsプロジェクト/sample/test.rb]を下記のように組んでみました。
35
35
  ```
36
+ require "savon"
37
+
36
38
  class Test
37
39
  def execute
38
40
  client = Savon.client(wsdl: "http://localhost:3000/test_soap?sample.wsdl")

1

追記

2020/11/25 07:25

投稿

tkshp
tkshp

スコア174

title CHANGED
File without changes
body CHANGED
@@ -27,4 +27,43 @@
27
27
 
28
28
  ### 補足情報(FW/ツールのバージョンなど)
29
29
 
30
- Ruby on Rails 6
30
+ Ruby on Rails 6
31
+
32
+ #### 追記
33
+
34
+ SOAPクライアントのrubyファイル[Railsプロジェクト/sample/test.rb]を下記のように組んでみました。
35
+ ```
36
+ class Test
37
+ def execute
38
+ client = Savon.client(wsdl: "http://localhost:3000/test_soap?sample.wsdl")
39
+ client.operations # 使えるオペレーションの一覧がでる
40
+ response = client.call(:find_user, message: { id: 42 }) # find_userというオペレーションでid 42をとってこいみたいな。
41
+ response.body # HTTPレスポンスのボディ、hashで値が入っています。
42
+ puts response
43
+ end
44
+ end
45
+
46
+ test = Test.new
47
+ test.execute
48
+ ```
49
+
50
+ すると、下記のエラーが出てしまうのですが、どういった対処をすればよいですか。
51
+ ```
52
+ $ rails runner sample/test.rb
53
+ Traceback (most recent call last):
54
+ 22: from bin/rails:9:in `<main>'
55
+ 21: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
56
+      (省略)
57
+ 2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
58
+ 1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
59
+ C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- savon (LoadError)
60
+ ```
61
+
62
+ 確かめてみると、gemのsavonが入っているような挙動はします。
63
+ ```
64
+ $ gem list savon
65
+
66
+ *** LOCAL GEMS ***
67
+
68
+ savon (2.12.1)
69
+ ```