QuickBooks WebConnector Null Values: Object refere

2019-06-10 04:27发布

问题:

This is a continuation of the epically painful QuickBooks WebConnector saga initiated here.

Objective

I'm trying to use Clojure with Axis 2 to access QuickBooks data using the QuickBooks WebConnector (QBWC from now on). QBWC uses SOAP to communicate with external applications, so that's why my Clojure application uses Axis 2.

Progress

After tens of permutations and over 150 hours, I've finally found the easy way to create an Axis2 (SOAP) WebService. I use the WSDL2Java generator to generate Java code from the QBWC WSDL I obtained from Intuit's developer portal. I followed this method from the Axis2 site's user guide and, much as the (unbearably ancient) example classes that the QuickBooks SDK provides, it automatically generates classes along with a skeleton class whose methods I modified to appropriately handle requests and output responses.

Issue

However, the issue is that for some strange reason all the messages passed between the QBWC (i.e., the SOAP client) and the SOAP service I've created seem to be either null or empty. For example, here's a few lines from the System.out pane (printed via the equivalent of 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()

Log File

In the QBWC log file it says the following:

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)

Conclusion

I've followed exactly what the Axis2 instructions seem to have said, much more so than in other configuration permutations I've tried. What's causing the issue here?

I appreciate your help in advance!

回答1:

The issue was that I was trying to use an AxisSimpleServer when that, for some reason, wouldn't work. I instead used a Tomcat server, created an .aar from the files I was working with (class files, services.xml file, the WSDL file for the service), and copied it to the AXIS2_HOME/WEB-INF/services directory. Then everything ran totally fine!

An extremely frustrating 100+ hour adventure but it finally has a happy conclusion!



回答2:

It's strange, but in my case, i did three steps:

  • Open Window -> Preferences -> Web Services(from left menu) -> Axis Emitter -> Enable (Prefers building beans to straight arrays for wrapped XML array types
  • delete your wsdl file from WebContent\wsdl\your-wsdl-file.wsdl
  • add @WebService annotation on your implemented class and add @WebMethod on every method inside it