我正在使用Washout Gem从 Rails 3.2.8 连接到 Quickbooks Web 连接器。我需要将返回格式设置为“ <tns:AuthenticateResult>
”,但我一直找不到方法。相反,我得到“ <AuthenticateResult xsi:type="tns:AuthenticateResult">
”。我试过同时改变蛇形和驼峰值。任何帮助将不胜感激。
我需要的
<?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