JavaScript SOAP客户端抛出未捕获的类型错误
JavaScript SOAP client throwing an Uncaught TypeError
我正在使用guru4的soap客户端编写一个简单的"Hello world"程序。我从Chrome控制台Uncaught TypeError: Cannot read property 'documentElement' of null
得到一个错误。
这是我的JavaScript。
<script src="soapclient.js"></script>
<script type="text/javascript">
function say_hello()
{
var pl = new SOAPClientParameters();
pl.add("name", "john");
pl.add("times", 2);
SOAPClient.invoke("http://192.168.1.100:7789/", "say_hello", pl, true, say_hello_callBack);
}
function say_hello_callBack(r)
{
alert(r);
}
</script>
这是我试图与之交互的服务器。
import soaplib
from soaplib.core.service import soap
from soaplib.core.service import DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array
'''
This is a simple HelloWorld example to show the basics of writing
a webservice using soaplib, starting a server, and creating a service
client.
'''
class HelloWorldService(DefinitionBase):
@soap(String, Integer, _returns=Array(String))
def say_hello(self, name, times):
'''
Docstrings for service methods appear as documentation in the wsdl
<b>what fun</b>
@param name the name to say hello to
@param the number of times to say hello
@return the completed array
'''
results = []
for i in range(0, times):
results.append('Hello, %s' % name)
return results
if __name__=='__main__':
try:
from wsgiref.simple_server import make_server
soap_application = soaplib.core.Application([HelloWorldService], 'tns')
wsgi_application = wsgi.Application(soap_application)
print "listening to http://0.0.0.0:7789"
print "wsdl is at: http://127.0.0.1:7789/?wsdl"
server = make_server('localhost', 7789, wsgi_application)
server.serve_forever()
except ImportError:
print "Error: example server code requires Python >= 2.5"
我有一种感觉,这个错误正在发生,因为我依赖于SOAP客户端内置的XML生成器。
您可以打开'Web Developer Tools' (Ctrl+Shift+J)并查看JS代码。可能没有WSDL。可能结果消息的名称不被这个"JavaScript SOAP客户端"支持(它应该被命名为MethodName + "Result"
,例如LoginResult)。
相关文章:
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- 如何解决这种情况下的非法调用类型错误
- 未捕获的类型错误:$(..).dataTable不是函数
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- 未捕获的类型错误:topFrame.window.changeSelectedBarStyle不是函数,原因是什么
- 类型错误:url未定义extjs 4正在填充组合框
- 未捕获的类型错误:无法读取属性'中止'的未定义
- 类型错误'未定义'不是对象(正在评估'navigator.connection.type'
- 未捕获的类型错误:无法设置属性'innerHTML'如果为null,则将脚本移动到正文不会;不起作用
- 未捕获的类型错误:undefined不是函数$
- 输入类型文件的未捕获类型错误
- 未捕获的类型错误:无法设置属性'背景'的未定义
- "未捕获类型错误/丢弃意外“;因为一句台词而出现?(HTML w/<脚本>)
- Javascript未捕获类型错误:无法读取属性'0'的未定义