2015-12-30 24 views
1

所以我用肥皂水,jurko爲python3和我有一個像這樣在我的要求值:使用Python的泡沫作爲一個SOAP客戶端並未能處理NoneType

`Date = None` 

日期是不是必填字段。我遇到的問題是,當它處理請求,我得到的錯誤:

WebFault: Server raised fault: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://webservices.soapclient.com/v11:request. The InnerException message was 'There was an error deserializing the object of type WebServices.Posting.Request. The value '' cannot be parsed as the type 'DateTime'.'. Please see InnerException for more details.'

任何線索我怎麼能傳遞一個有效NoneType讓我的客戶不會將其轉換爲一個空字符串?

回答

0

如果日期字段是可選的,則應完全忽略它,並且不要嘗試傳遞任何值(即使它設置爲NoneType)。

+0

好主意,關於如何刪除泡沫字段的任何想法? – Rob

+0

我的建議是在調用'client.service.soap_method(arg1 = x,arg2 = y,arg3 = z)'時使用命名參數,並且不傳遞可選參數作爲參數。 – Cahit

+0

如果你在使用複雜類型時遇到這個問題,我也遇到了這個相關的問題,可能會有所幫助:http://stackoverflow.com/questions/9388180/suds-generates-empty-elements-how-to-remove -他們 – Cahit