根據特定的WSDL實現WebService。客戶端無法更改。正確處理來自客戶端的請求,但客戶端因爲變量中的名稱空間而抱怨響應。從Spyne響應變量中刪除命名空間
我想要什麼(基於WSDL的soapUI響應):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://callback.foo.com/">
<soapenv:Header/>
<soapenv:Body>
<cal:foo_statusResponse>
<result>SUCCESS</result>
<notify>Thanks!</notify>
</cal:foo_statusResponse>
</soapenv:Body>
</soapenv:Envelope>
什麼我收到(通知tns:
的變量造成驗證問題):
<senv:Envelope xmlns:tns="http://callback.foo.com/" xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:foo_statusResponse>
<tns:result>SUCCESS</tns:result>
<tns:notify>Thanks!</tns:notify>
</tns:foo_statusResponse>
</senv:Body>
</senv:Envelope>
Java客戶端拋出此例外:
[com.sun.istack.SAXParseException2; lineNumber:2; columnNumber:162; 意外元素(URI:「http://callback.foo.com/」,本地:「結果」)。 預期元件< {}結果>,< {}通知>]
執行代碼段:
class fooStatusRS(ComplexModel):
result = Unicode()
notify = Unicode()
class foo_callback(ServiceBase):
@srpc(Unicode, Unicode, Unicode, Unicode, statusbarInfo, anotherResponse,
_out_header=None,
_out_variable_names=("result", "notify"),
_returns=(Unicode, Unicode),
_out_message_name="foo_statusResponse",
_operation_name="foo_status_rq")
def foo_status(foo_id, reply, ref, status, statusbar, another):
if foo_id:
print foo_id
return fooStatusRS(result="SUCCESS", notify="Foo received!")
application.interface is deprecated synce at least 2.10:http://spyne.io/docs/2.10/reference/application.html – blueCat 2016-10-13 15:44:41
它沒有https://github.com/arskom/spyne/blob/master /spyne/application.py#L107 – thebat 2016-12-02 11:33:00