We've added ability to implement this. Follow the discussion at https://github.com/roundlake/wash_out/issues/73
Malformed XML response using Washout gem
-
02-12-2021 - |
Question
I'm using the Washout Gem to connect to the Quickbooks Web Connector from Rails 3.2.8. I need to format a return as "<tns:AuthenticateResult>
", but I have not been able to find a way. Instead I get "<AuthenticateResult xsi:type="tns:AuthenticateResult">
".
I've tried changing both snakecase and camelcase values. Any help would be greatly
appreciated.
What I need
<?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>
What I am getting
<?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>
My code
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
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow