Soap 《生物武器公约》:“;“索引超出范围”;在do_authenticate()中

Soap 《生物武器公约》:“;“索引超出范围”;在do_authenticate()中,soap,quickbooks,qbxml,qbwc,Soap,Quickbooks,Qbxml,Qbwc,我正在使用QuickBooks WebConnector 2.2.0.71和我的WCF web服务(在.NET 4.6.1上)。按WebConnectorserverVersion和clientVersion中的“Update selected”后,成功处理了请求,但authenticate失败: 20170705.06:31:00 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate

我正在使用QuickBooks WebConnector 2.2.0.71和我的WCF web服务(在.NET 4.6.1上)。按WebConnector
serverVersion
clientVersion
中的“Update selected”后,成功处理了请求,但
authenticate
失败:

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

20170705.06:31:00 UTC:QBWebConnector.SOAPWebService.do_authenticate():***使用以下参数调用authenticate():QBWC程序员指南第21页

返回到authenticate调用的将是一个最多包含四个字符串的字符串数组

数组的第一个成员是会话令牌,它可以是GUID或您要用于标识会话的任何其他内容。QBWC将在会话的后续回调中返回此令牌

字符串数组的第二个成员可以包含多种内容

a。如果身份验证调用中的用户名和密码无效,则应提供值“nvu”

b。另一方面,如果用户数据是有效的,但您没有为该用户做任何工作,那么您将提供值“none”

c。如果您确实要为该用户执行工作,则可以提供要在当前更新中使用的公司的完整路径名

d。如果要使用QuickBooks公司当前在客户端打开的任何内容,只需提供一个空字符串

字符串数组的可选第三个成员包含下次更新前等待的秒数。你可以用它来告诉QBWC客户端在指定的时间内不要打扰你

字符串数组的可选第四个成员包含用作web服务的最小RunEverynSeconds时间的秒数,它告诉QBWC需要联系web服务的频率


我不知道为什么文档末尾的身份验证与此不同。

通过将
[XmlSerializerFormat]
添加到
iSeries
,解决了这个问题,因此responce变为

<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>

d0297d33-859d-4259-a598-5fbf328bac3b
nvu
3.
60
使用时,不要忘记设置SoapSerializer:
app.UseSoapEndpoint(settings.QbWcServiceRelativeUrl,new BasicHttpBinding(){Namespace=WfcService.Namespace},SoapSerializer.XmlSerializer)
<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>