这是史诗痛苦的QuickBooks WebConnector传奇的延续here。
我正在尝试使用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指令所说的内容,比我尝试过的其他配置排列要多得多。是什么导致了这个问题?
我提前感谢您的帮助!
答案 0 :(得分:1)
问题是我试图使用AxisSimpleServer,因为某些原因,它不起作用。我改为使用Tomcat服务器,从我正在使用的文件(类文件,services.xml文件,服务的WSDL文件)创建.aar,并将其复制到AXIS2_HOME/WEB-INF/services
目录。然后一切都很好!
非常令人沮丧的100多个小时的冒险,但它终于得到了一个圆满的结论!
答案 1 :(得分:0)
这很奇怪,但就我而言,我做了三个步骤: