【问题标题】:QuickBooks WebConnector Null Values: Object reference not set to an instance of an objectQuickBooks WebConnector Null 值:对象引用未设置为对象的实例
【发布时间】:2014-09-02 20:22:45
【问题描述】:

这是由 here 发起的极其痛苦的 QuickBooks WebConnector 传奇的延续。

目标

我正在尝试将 Clojure 与 Axis 2 结合使用,以使用 QuickBooks WebConnector(从现在开始为 QBWC)访问 QuickBooks 数据。 QBWC 使用 SOAP 与外部应用程序通信,这就是我的 Clojure 应用程序使用 Axis 2 的原因。

进展

经过数十次排列和 150 多个小时,我终于找到了创建 Axis2 (SOAP) WebService 的简单方法。我使用 WSDL2Java 生成器从我从 Intuit 的开发人员门户获得的 QBWC WSDL 生成 Java 代码。我关注了this method from the Axis2 site's user guide,并且与 QuickBooks SDK 提供的(令人难以忍受的古老)示例类一样,它会自动生成类以及我修改的框架类的方法以适当地处理请求和输出响应。

问题

但是,问题是由于某种奇怪的原因,在 QBWC(即 SOAP 客户端)和我创建的 SOAP 服务之间传递的所有消息似乎都是 null 或空的。例如,下面是System.out 窗格中的几行(通过等效于System.out.println 打印):

ServerVersionResponse below!
Input: nil
ClientVersionResponse below!
Input: #<ClientVersion com.intuit.developer.ClientVersion@214a61eb>
Proceeding with client version nil... ; client version here should be a String and is retrieved using clientVersion.getStrVersion()
AuthenticateResponse below!
Input: #<Authenticate com.intuit.developer.Authenticate@2f8d9bb2>
Attempting to log in as nil with password nil... ; both should be Strings - retrieved using authenticate.getStrUserName() and .getStrPassword()

日志文件

在 QBWC 日志文件中显示如下:

QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="">
QBWebConnector.SOAPWebService.do_serverVersion() : This application sent a null for server version. Allowing update operation.
QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.1.0.27">
QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'SOCAccess', username = 'alexandergunnarson'
QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="alexandergunnarson"><password=<MaskedForSecurity>
QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Object reference not set to an instance of an object.
More info:
StackTrace =    at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)

结论

我完全遵循了 Axis2 指令似乎所说的内容,比我尝试过的其他配置排列要多得多。是什么导致了这里的问题?

提前感谢您的帮助!

【问题讨论】:

    标签: soap clojure quickbooks wsdl2java


    【解决方案1】:

    问题是我试图使用 AxisSimpleServer,但由于某种原因,它不起作用。我改为使用 Tomcat 服务器,从我正在使用的文件(类文件、services.xml 文件、服务的 WSDL 文件)创建一个 .aar,并将其复制到 AXIS2_HOME/WEB-INF/services 目录。然后一切都运行良好!

    100 多小时的极其令人沮丧的冒险,但它终于有了一个快乐的结局!

    【讨论】:

      【解决方案2】:

      这很奇怪,但就我而言,我做了三个步骤:

      • 打开窗口 -> 首选项 -> Web 服务(从左侧菜单)-> Axis Emitter -> 启用(更喜欢为包装的 XML 数组类型构建 bean,而不是直接数组
      • 从 WebContent\wsdl\your-wsdl-file.wsdl 中删除您的 wsdl 文件
      • 在你实现的类上添加@WebService注解,并在其中的每个方法上添加@WebMethod

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-12-25
        • 2019-03-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多