Rails控制器通过INVOKE(BPEL)活动处理为HTML而不是SOAP

时间:2015-08-30 12:30:37

标签: ruby-on-rails soap bpel wash-out

我创建了一个简单的Web服务,只能连接两个字符串。我用wash_out gem创建了这个web服务。所以我的网络服务在我的rails服务器上。

使用concat方法的

控制器:

class ContextserverController < ApplicationController
  include WashOut::SOAP

  soap_service namespace: 'urn:WashOut', wsdl_style: 'document'

  soap_action "concat",
    :args   => { :concatRequest => {:a => :string, :b => :string }},
    :return => {:result => :string}

  def concat
    # something I want to do in ruby
    puts "*******************************************************************"
    puts "************************   CONCAT   *******************************"
    puts "*******************************************************************"

    puts params
    puts params[:concatRequest][:a]
    puts params[:concatRequest][:b]
    result = params[:concatRequest][:a] + params[:concatRequest][:b]
    puts "ERGEBNIS: " + result
    puts "*******************************************************************"
    # and then send response to BPEL process
    render :soap => ( { :result => result } )
  end
end

另一方面,我有我的BPEL流程,我想要发送这个Web服务。 当我想调用这个过程......

[INVOKE] Failure during invoke: Error sending message (mex={PartnerRoleMex#hqejbhcnphraka328skerr [PID {http://localhost:8080/test}TestProcess-5609] calling org.apache.ode.bpel.epr.WSAEndpoint@1f939560.concat(...) Status ASYNC}): SOAP message MUST NOT contain a Document Type Declaratio
[BpelRuntimeContextImpl] ActivityRecovery: Registering activity 15, failure reason: Error sending message (mex={PartnerRoleMex#hqejbhcnphraka328skerr [PID {http://localhost:8080/test}TestProcess-5609] calling org.apache.ode.bpel.epr.WSAEndpoint@1f939560.concat(...) Status ASYNC}): SOAP message MUST NOT contain a Document Type Declaratio on channel 27

在rails服务器日志中,我看到以下内容:

Processing by ContextserverController#concat as HTML
#<ActionDispatch::Http::Headers:0x007fc82a9c56b8>
*******************************************************************
************************   CONCAT   *******************************
*******************************************************************
{}
Completed 500 Internal Server Error in 12ms

我认为问题是处理为 HTML 。 如果我使用eclipse Web Service Explorer测试Web服务,Web服务将在 SOAP 中处理!

当我使用Web Service Explorer直接测试Web服务时:

Processing by ContextserverController#concat as SOAP
*******************************************************************
************************   CONCAT   *******************************
*******************************************************************
{"concatRequest"=>{"a"=>"a", "b"=>"b"}}
a
b
ERGEBNIS: ab
*******************************************************************
  Rendered /Users/jordan/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/wash_out-0.9.2/app/views/wash_with_soap/document/response.builder (1.2ms)

所以我不明白为什么在我调用这个过程时这个过程会以HTML的形式执行。

1 个答案:

答案 0 :(得分:0)

Web Service Explorer可能会发送“接受”消息。标题包含&#39; application / soap + xml&#39;,这不是由BPEL流程完成的。您可以检查request.env以获取action_dispatch.request.accepts的内容,以查看您正在接收的Accept标头。