0
我們在SOAP webservice中遇到了性能問題。這個webservice是用Spyne構建的。使用Spyne與SOAP的性能問題
我認爲可以通過改變接口的接口來解決這個問題,接口只會返回必要的數據,因爲我們向客戶端發送大的soap對象。
例子:
我們具有很多特性的面料SOAP對象,見下圖:
class Fabric(ComplexModel):
__namespace__ = 'vadain.webservice.curtainconfig'
id = Mandatory.Integer
"Fabric ID"
articleNumber = String
"Article Number"
name = Mandatory.Unicode
"Fabric Name"
color = Mandatory.Unicode
"Color"
width = Float
"Fabric Width"
widthType = WidthType
"Width Type"
supplier = Mandatory.Unicode
supplierId = Integer
"Supplier"
ETC.
還有更多!
我們已經實現了兩個接口尋找面料,讓面料,見下圖:
搜索面料:
@rpc(Unicode, _returns=soap.Fabric.customize(max_occurs='unbounded'))
def fabricsWithName(ctx, name):
--Code to get all fabrics with name
return fabrics
獲取面料:
@rpc(Integer, _returns=soap.Fabric)
def getFabric(ctx, fabric_id):
--Code to get fabric from ID
return fabric
灼熱面料的接口將返回所有織物的特性,但這不是必需的。可以更改只返回結構名稱和ID。
我該如何改變這種接口的'fabricsWithName'將只返回結構名稱和ID,這將解決性能問題?