- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
(是的,我意识到这个问题与another question posted类似;但是,这个问题从未得到回答。)
目的
我试图将Clojure与Axis 2一起使用QuickBooks WebConnector(从现在开始使用QBWC)访问QuickBooks数据。 QBWC使用SOAP与外部应用程序进行通信,因此这就是我的Clojure应用程序使用Axis 2作为SOAP接口的原因。我使用来自GitHub的micha's clj-soap来提供与Axis 2的Java调用的更高级别(抽象)的Clojure互操作。
问题
问题在于通过QBWC对我的SOAP Web服务进行身份验证。使用我的SOAP Web服务的authenticate
方法,QBWC引发错误。在QBWC日志文件中,它表示以下内容:
QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message: Object reference not set to an instance of an object.
StackTrace = at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = QBWebConnector
developer.intuit.com.SOCAccess
的类,并定义了与QBWC通信所需的许多方法(包括
authenticate
,
serverVersion
等)。指示返回值或参数类型。Clojure编译成Java字节码,默认情况下不使用强类型,这转化为大多数类型提示
Object
,但是由于Java2WSDL的工作方式,因此需要强类型。例如:
^String
最终显示为
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
^Object
最终显示为
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType"/>
^"[Ljava.lang.String;"
与
String[]
相同,并以
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
结尾)
(soap/defservice developer.intuit.com.SOCAccess
(authenticate2 ^"[Ljava.lang.String;" [^String username ^String password]
(authenticate2* username password))
(authenticate ^"[Ljava.lang.String;" [^String username ^String password]
(authenticate* username password))
(prefix35authenticate ^"[Ljava.lang.String;" [^String username ^String password]
(authenticate* username password))
(sendRequestXML ^Object
[^String ticket ^String hcp-response ^String company-file-name ^String qb-xml-country
^Integer qb-xml-major-vers, ^Integer qb-xml-minor-vers]
(send-request-xml ticket hcp-response company-file-name qb-xml-country qb-xml-major-vers qb-xml-minor-vers))
(receiveResponseXML ^Integer [^String ticket ^String response ^String hresult ^String message]
(receive-response-xml ticket response hresult message))
(connectionError ^Object [^String ticket ^String hresult ^String message]
(connection-error ticket hresult message))
(getLastError ^String [^String ticket]
(get-last-error ticket))
(closeConnection ^String [^String ticket]
(close-connection ticket))
(getServerVersion ^String [^String ticket] (server-version ticket))
(serverVersion ^String [^String ticket] (server-version ticket))
(clientVersion ^String [^String version] (client-version version))
(interactiveDone ^String [^String ticket] (interactive-done ticket))
(interactiveRejected ^String [^String ticket ^String reason] (interactive-rejected ticket reason)))
AxisServer
并使用类名称
.addService
调用
"developer.intuit.com.SOCAccess"
后,输出窗口将输出以下内容:该类名称是从上面的代码编译的类:
Jul 07, 2014 11:22:20 AM org.apache.axis2.transport.http.server.DefaultConnectionListener run
INFO: Listening on port 6060
(authenticate "my-username" "my-password")
时,返回值应该是
String[]
,并且println()输出表明它确实是
String[]
,但是返回值仅显示为数组的第一个元素,这很奇怪。我的猜测是这是QBWC中
Object reference not set to an instance of an object
错误的原因,因为它试图获取
String
的第n个元素,就好像它是一个数组一样。
20140707.20:06:40 UTC : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'SOCAccess' has STARTED
20140707.20:06:40 UTC : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20140707.20:06:40 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20140707.20:06:40 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: SOCAccess
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): SOCAccess
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: http://localhost:6060/axis2/services/SOCAccess
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="">
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : This application sent a null for server version. Allowing update operation.
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.1.0.27">
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'SOCAccess', username = 'alexandergunnarson'
20140707.20:06:40 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="alexandergunnarson"><password=<MaskedForSecurity>
20140707.20:06:40 UTC : 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)
Source = QBWebConnector
20140707.20:06:40 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20140707.20:06:40 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20140707.20:06:40 UTC : QBWebConnector.WebServiceManager.DoUpdateSelected() : Update completed with errors. See log (QWClog.txt) for details.
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soapenv:Body>
<axis2ns34:authenticate xmlns:axis2ns34=\"http://developer.intuit.com/\">
<axis2ns35:args0 xmlns:axis2ns35=\"http://developer.intuit.com/\">
alexandergunnarson
</axis2ns35:args0>
<axis2ns36:args1 xmlns:axis2ns36=\"http://developer.intuit.com/\">
password
</axis2ns36:args1>
</axis2ns34:authenticate>
</soapenv:Body>
</soapenv:Envelope>
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soapenv:Body>
<ns:authenticateResponse xmlns:ns=\"http://developer.intuit.com/\">
<return>my-session-token</return>
<return>none</return>
<return>60</return>
<return>60</return>
</ns:authenticateResponse>
</soapenv:Body>
</soapenv:Envelope>
QBWebConnectorSvcStub
类的源代码,特别关注某些方法(首先编辑
authenticate
,
serverVersion
和
clientVersion
,因为这是QBWC首先调用的)。对于这些方法,我将返回值绑定到Clojure类中的函数,将QBWebConnectorSvcStub方法的输入传递给相应的Clojure函数,并返回所述函数的输出。基本上,我让Clojure函数完成了工作,而
QBWebConnectorSvcStub
充当了SOAP中间人。
clientVersion
可以按预期工作,如日志所示:
Received from clientVersion() following parameter:<clientVersionRet="">
:
QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'QBWebConnectorSvcStub', 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.
<ns:authenticateResponse xmlns:ns="http://developer.intuit.com/">
<return xmlns:ax22="http://io.java/xsd" xmlns:ax21="http://rmi.java/xsd" xmlns:ax25="http://developer.intuit.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax25:QBWebConnectorSvcStub_AuthenticateResponse">
<authenticateResult>
<string xmlns="http://developer.intuit.com/">
my-session-token
</string>
<string xmlns="http://developer.intuit.com/">
nvu
</string>
<string xmlns="http://developer.intuit.com/">
60
</string>
<string xmlns="http://developer.intuit.com/">
60
</string>
</authenticateResult>
<authenticateResultSpecified>
true
</authenticateResultSpecified>
</return>
</ns:authenticateResponse>
最佳答案
我不确定您的QBC文件是什么样(为Quickbooks Web Connector定义应用程序的xml文件),但是我通过将样式设置从更改为解决了类似的问题<Style>RPC</Style>
至<Style>DocWrapped</Style>
如果未定义,请尝试使用“ DocWrapped”或“ RPC”值。 QBWC_proguide中的样式的详细信息:
Web服务使用的SOAP编码样式。如果未提供,
默认使用的是文档。
文档是.NET在以下情况下使用的标准编码样式:
[WebMethod]属性应用于函数声明。
(可选)您可以指定值DocWrapped。 DocWrapped
与我们构建的Axis Web服务可以很好地互操作
建议使用WSDL2Java从中生成Java Web类
Web连接器使用的标准WSDL(http://
developer.intuit.com/uploadedFiles/Support/
QBWebConnectorSvc.wsdl)
或者,可以选择指定值RPC。 RPC样式是
Java类为Axis时,Axis使用的标准编码样式
通过JWS或自动将其转换为SOAP服务
Java2WSDL工具。
关于java - 使用QuickBooks Web Connector的身份验证问题:对象引用未设置为对象的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24618311/
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: template pass by value or const reference or…? 以下对于将函数
我用相同的参数列表重载了一个运算符两次。但返回类型不同: T& operator()(par_list){blablabla} const T& operator()(par_list){bla
假设我有实现接口(interface) I 的 Activity A。我的 ViewModel 类 (VM) 持有对实现接口(interface) I 的对象的引用: class A extends
PHP 如何解释 &$this ?为什么允许? 我遇到了以下问题,这看起来像是 PHP 7.1 和 7.2 中的错误。它与 &$this 引用和跨命名空间调用以及 call_user_func_arr
谁能解释一下下面“&”的作用: class TEST { } $abc =& new TEST(); 我知道这是引用。但是有人可以说明我为什么以及什么时候需要这样的东西吗?或者给我指向一个对此有很好解
引用变量是一个别名,也就是说,它是某个已存在变量的另一个名字。一旦把引用初始化为某个变量,就可以使用该引用名称或变量名称来指向变量。 C++ 引用 vs 指针 引用很容易与指针混淆,它们之间有三
目录 引言 背景 结论 引言 我选择写C++中的引用是因为我感觉大多数人误解了引用。而我之所以有这个感受是因为我主持过很多C++的面试,并且我很少
Perl 中的引用是指一个标量类型可以指向变量、数组、哈希表(也叫关联数组)甚至函数,可以应用在程序的任何地方 创建引用 定义变量的时候,在变量名前面加个 \,就得到了这个变量的一个引用 $sc
我编写了一个将从主脚本加载的 Perl 模块。该模块使用在主脚本中定义的子程序(我不是维护者)。 对于主脚本中的一个子例程,需要扩展,但我不想修补主脚本。相反,我想覆盖我的模块中的函数并保存对原始子例
我花了几个小时试图掌握 F# Quotations,但我遇到了一些障碍。我的要求是从可区分的联合类型中取出简单的函数(只是整数、+、-、/、*)并生成一个表达式树,最终将用于生成 C 代码。我知道使用
很多时候,问题(尤其是那些标记为 regex 的问题)询问验证密码的方法。似乎用户通常会寻求密码验证方法,包括确保密码包含特定字符、匹配特定模式和/或遵守最少字符数。这篇文章旨在帮助用户找到合适的密码
我想通过 MIN 函数内的地址(例如,C800)引用包含文本的最后一个单元格。你能帮忙吗? Sub Set_Formula() ' ----------------------------- Dim
使用常规的 for 循环,我可以做类似的事情: for (let i = 0; i < objects.length; i++) { delete objects[i]; } 常规的 for-
在 Cucumber 中,您定义了定义 BDD 语法的步骤;例如,您的测试可能有: When I navigate to step 3 然后你可以定义一个步骤: When /^I navigate t
这是什么UnaryExpression的目的,以及应该怎样使用? 最佳答案 它需要一个 Expression对象并用另一个 Expression 包裹它.例如,如果您有一个用于 lambda 的表达式
给出以下内容 $("#identifier div:first, #idetifier2").fadeOut(300,function() { // I need to reference jus
我不知道我要找的东西的正确术语,但我要找的是一个完整的引用,可以放在双引号之间的语句,比如 *, node()、@* 以及所有列出的 here加上任何其他存在的。 我链接到的答案提供了一些细节,但还
This question's answers are a community effort。编辑现有答案以改善此职位。它当前不接受新的答案或互动。 这是什么? 这是常见问答的集合。这也是一个社区Wi
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
考虑下一个代码: fn get_ref(slice: &'a Vec, f: fn(&'a Vec) -> R) -> R where R: 'a, { f(slice) } fn m
我是一名优秀的程序员,十分优秀!