使用Washout gem格式错误的XML响应

时间:2012-11-27 20:16:16

标签: ruby-on-rails soap qbwc

我正在使用Washout Gem从Rails 3.2.8连接到Quickbooks Web Connector。我需要将返回格式设置为“<tns:AuthenticateResult>”,但我无法找到方法。相反,我得到“<AuthenticateResult xsi:type="tns:AuthenticateResult">”。 我试过更改snakecase和camelcase值。任何帮助都会很大 赞赏。


我需要什么

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://developer.intuit.com/">
    <SOAP-ENV:Body>
        <ns1:authenticateResponse>
            <ns1:authenticateResult>
                <ns1:string>15c9ce293bd3f41b761c21635b14fa06</ns1:string>
                <ns1:string></ns1:string>
            </ns1:authenticateResult>
        </ns1:authenticateResponse>
    </SOAP-ENV:Body>

我得到了什么

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://developer.intuit.com/">
  <soap:Body>
    <tns:authenticateResponse>
      <AuthenticateResult xsi:type="tns:AuthenticateResult">
        <String xsi:type="xsd:string">abf36037372fa6cf089dbdbc33b11771908afe57</String>
        <String xsi:type="xsd:string"></String>
      </AuthenticateResult>
    </tns:authenticateResponse>
  </soap:Body>

我的代码

soap_action "authenticate",
              :args => {:strUserName => :string, :strPassword => :string},
              :return => { :authenticate_result => [{string: [:string]}]}
  def authenticate
    username = params[:strUserName]
    password = params[:strPassword]
    if (Role.find_by_token(username))
      if QuickbooksImportStatus.find_by_token(username).blank?
        QuickbooksImportStatus.create(:username => User.find(Role.find_by_token(username).user_id).username)
      end
      render :soap => {:authenticate_result => [{string: [username, '']}]}
    end
  end

1 个答案:

答案 0 :(得分:0)

我们已经添加了实现此功能的能力。按照https://github.com/roundlake/wash_out/issues/73

上的讨论进行操作