Closed ben-ward closed 11 years ago
SOAP is not a protocol where you typically care what's going on inside XML transport. Can you please describe me a reason of all this? Why would you want to have exactly this output?
My apologies. I'm attempting to use washout as a SOAP server to take requests from QBWC. The Authenticate request from QBWC is getting processed fine in Rails but QBWC doesn't like the response. QBWC returns "There is an error in XML document (10, 28)." This is poor error messaging from the Quickbooks Web Connector (QBWC). If I knew what was malformed about it, I could work on it. I guess I need to check the Intuit forums instead.
Here is the log from QBWC.
20121130.03:23:07 UTC : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'ImportQuickbookToCheqbook_BenCo', username = 'abf36037372fa6cf089dbdbc33b11771908afe57'
20121130.03:23:07 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *\ Calling authenticate() with following parameters:
Quickbooks makes a validator tool that checks the xml.
Here is a good request altered by hand. Note the fifth line. <tns:authenticateResult>
<?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>
<tns:authenticateResult>
<String xsi:type="xsd:string">abc111</String>
<String xsi:type="xsd:string">none</String>
</tns:authenticateResult>
</tns:authenticateResponse>
</soap:Body>
</soap:Envelope>
Here is a bad request I'm currently sending. Note the fifth line. <AuthenticateResult xsi:type="tns:AuthenticateResult">
<?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">abc111</String>
<String xsi:type="xsd:string">none</String>
</AuthenticateResult>
</tns:authenticateResponse>
</soap:Body>
</soap:Envelope>
Here is the error.
Requested validation for QB US or Online Ed. (qbxml), file has processing instruction indicating <?qwc... obeying processing instruction
Line: 5
LinePos: 61
Src Text: <AuthenticateResult xsi:type="tns:AuthenticateResult">
Reason: Type '{http://developer.intuit.com/}AuthenticateResult' is not found in Schema.
Thanks again for your help.
You can achieve that by turning camelization off and forcing the following options:
soap_action "authenticate",
:args => {:strUserName => :string, :strPassword => :string},
:return => { "tns:authenticateResult" => [{"tns:string" => [:string]}] },
:response_tag => "tns:authenticateResponse"
Don't forget to update wash_out to the latest (0.5.4) release and also use same string values among render :soap => ...
result hash keys.
Thanks! This was a huge help. :response_tag was the option I was missing!
I am trying to use the example code you posted above and am not getting the expected output. Using the soap_action as defined in your last response, 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="urn:WashOut">
<soap:Body>
<tns:authenticateResponse>
<tns:authenticateResult xsi:type="tns:tns:authenticateResult">
<tns:string xsi:type="xsd:string">sokAF1syyAr2Ci2Hay1K</tns:string>
<tns:string xsi:type="xsd:string">none</tns:string>
</tns:authenticateResult>
</tns:authenticateResponse>
</soap:Body>
</soap:Envelope>
The render soap call is
render soap: {"tns:authenticateResult" => [{"tns:string" => response}]}
Any thoughts on how to get rid of the xsi:type="tns:tns:authenticateResult ?
Do you use QuickBook too? :)
Yes - I am also dealing with the abominations that is Quickbooks :-(
Do you have a solution for the issue I posted? Am I going something wrong?
Give me a bit of time. I'll take a closer look soon.
@klancaster well. After playing with it a bit... Can you just remove tns
prefixes?
soap_action "authenticate",
:args => {:strUserName => :string, :strPassword => :string},
:return => { "authenticateResult" => [{"string" => [:string]}] },
:response_tag => "tns:authenticateResponse"
I need to know what Quickbooks responds to this. It's pretty difficult to debug without a client :\
@inossidabile For anyone else who runs into this issue with the authenticate SOAP response for Quickbooks Web Connector (QBWC), the following worked for me:
soap_action 'authenticate', :args => {:strUserName => :string, :strPassword => :string}, :return => {'tns:authenticateResult' => {'tns:string' => [:string]}}, :response_tag => 'authenticateResponse'
My authenticate method has the follow return:
render :soap => {'tns:authenticateResult' => {'tns:string' => auth_array}}
where auth_array is a ruby array with the two string values QBWC is expecting.
wash_out is a well-executed and helpful gem :+1:. Thank you. Quickbooks is awful to integrate with :-1:
how to get rid of "xsi:type" in each element?
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
What I am getting
My code