Reputation: 1216
I'm using QuickBooks WebConnector 2.2.0.71 and my WCF web service (on .NET 4.6.1). After pressing "Update selected" in WebConnector serverVersion
and clientVersion
requests successfully processed, but authenticate
failed:
20170705.06:31:00 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="username"><password=<MaskedForSecurity>
20170705.06:31:00 UTC : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Index Out Of Range.
More info:
StackTrace = в QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = QBWebConnector
Response of my WCF service (from WCF Test Client):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<authenticateResponse xmlns="http://developer.intuit.com/">
<authenticateResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:string>a3f10876-e027-419d-8dd8-3752a852ddae</a:string>
<a:string>nvu</a:string>
<a:string>3</a:string>
<a:string>60</a:string>
<a:string>60</a:string>
</authenticateResult>
</authenticateResponse>
</s:Body>
</s:Envelope>
Docs says "Your callback must return A string array with 4 possible elements. The first element contains either NONE or NVU (invalid user) or BUSY., or empty string, or a string that is the QB company file name." but in samples first element is guid token, so I send array of 5 elements.
Same error occured when I send not an array, but int value, so I guess - maybe something wrong with my xml?
Upvotes: 0
Views: 233
Reputation: 1216
Solved by adding [XmlSerializerFormat]
to IService
, so responce become
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<authenticateResponse xmlns="http://developer.intuit.com/">
<authenticateResult>
<string>d0297d33-859d-4259-a598-5fbf328bac3b</string>
<string>nvu</string>
<string>3</string>
<string>60</string>
</authenticateResult>
</authenticateResponse>
</s:Body>
</s:Envelope>
Upvotes: 0
Reputation: 2656
Page 21 of the QBWC Programmers Guide.
Your return to the authenticate call will be a string array with a maximum of four strings.
The first member of the array is a session token, which could be a GUID or anything else that you want to use to identify the session. This token will be returned by QBWC in subsequent callbacks in the session.
The second member of the string array can contain a variety of things.
a. If the username and password in the authenticate call is invalid, you would supply the value “nvu”.
b. If on the other hand the user data is valid but you have no work to do for that user, you would supply the value “none”.
c. If you do have work to do for the that user, you can supply the full pathname of the company to be used in the current update.
d. If you want to use whatever QuickBooks company is currently open at the client end, simply supply an empty string.
The optional third member of the string array contains the number of seconds to wait before the next update. You would use this to in effect tell that QBWC client not to bother you for a specified time.
The optional fourth member of the string array contains the number of seconds to be used as the MinimumRunEveryNSeconds time for your web service, which tells QBWC how frequently your web service needs to be contacted.
I am not sure why the Authenticate at the end of the doc is different than this.
Upvotes: 0