我正在实现一个现有的WSDL,它为消息和类型使用不同的命名空间。
<message name="searchDetailRequest">
<part element="ixa:searchDetail" name="body" />
</message>
<message name="searchDetailResponse">
<part element="ixa:searchDetailResponse" name="result" />
</message>
<operation name="searchDetail">
<input message="tns:searchDetailRequest" />
<output message="tns:searchDetailResponse" />
</operation>
我尝试过这样的事情来表示不同的命名空间:
class RXIType(ComplexModel):
__namespace__ = 'urn:badger/ixa'
class searchDetailRequest(RXIType):
intput = Unicode()
class searchDetailResponse(RXIType):
output = Unicode()
class TestService(ServiceBase):
@rpc(searchDetailRequest, _returns=searchDetailResponse, _body_style='bare')
def searchDetail(cls, body):
pass
soap = Application((TestService,),
'urn:badger/definitions',
in_protocol=Soap11(),
out_protocol=Soap11()
)
当我尝试运行它时会生成异常:
Traceback (most recent call last):
File "./manage.py", line 14, in <module>
from soapbridge import app
File "/home/danni/src/GIT/s2x-hsnet-soap-bridge/soapbridge/__init__.py", line 52, in <module>
out_protocol=Soap11()
File "/home/danni/src/GIT/s2x-hsnet-soap-bridge/python_env/src/spyne/spyne/application.py", line 111, in __init__
self.in_protocol.set_app(self)
File "/home/danni/src/GIT/s2x-hsnet-soap-bridge/python_env/src/spyne/spyne/protocol/xml.py", line 324, in set_app
xml_schema.build_validation_schema()
File "/home/danni/src/GIT/s2x-hsnet-soap-bridge/python_env/src/spyne/spyne/interface/xml_schema/_base.py", line 221, in build_validation_schema
self.validation_schema = etree.XMLSchema(etree.parse(f))
File "xmlschema.pxi", line 90, in lxml.etree.XMLSchema.__init__ (src/lxml/lxml.etree.c:174715)
lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'type': References from this schema to components in the namespace 'urn:badger' are not allowed, since not indicated by an import statement., line 9
日志记录输出告诉我这是Spyne中的错误...请帮助!
答案 0 :(得分:0)
这确实是一个错误,已在主人等待释放时修复。如果您迫不及待,请执行:
pip install -e git://github.com/arskom/spyne.git@60ed622b088c13f4f84c81f1f43302edbc7f6027#egg=spyne
问题就会消失