Python, suds, manage array answer
This is a sample code:
from suds.client import Client
url = 'WSDLURL'
client = Client(url)
result = client.service.Research('value')
Result contains:
(ArrayOfProducts){
Product[] =
(Product){
Id = 218
Code = "C024"
Name = "test2"
Avaiable = True
UrlDownload = None
MetaData =
(ArrayOfMetaData){
MetaData[] =
(MetaData){
CoderepositoryISO = "16701"
Title = "1ST"
},
}
},
(Product){
Id = 219
Code = "C025"
Name = "test3"
Avaiable = True
UrlDownload = None
MetaData =
(ArrayOfMetaData){
MetaData[] =
(MetaData){
CoderepositoryISO = "16702"
Title = "2ND"
},
}
},
...
开发者_JAVA百科
There is a way, in python or suds, to access directly to the contained data cycling on the products with a for? (e.g.: Product.Id, Product.Code, etc.)
Perfect... Thanks to J.F. Sebastian I find the right way... This is the working code:
from suds.client import Client
url = 'wsdl'
client = Client(url)
html_out = ""
result = client.service.Research('a')
for p in result.Product:
print p.Id
print p.Name
精彩评论