Hi Jurko,
the wdsl i´m trying is:
http://xml.trendoperadora.com.br/hotelservices.asmx?WSDL
i´m using this functions to call:
self.objClient is defined here
def objClientSOAP(self):
try:
imp =
Import('http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('http://xml.trendoperadora.com.br/hotelservices.asmx')
d = ImportDoctor(imp)
client = Client(self.WSDL, doctor=d)
except WebFault, e:
return e
self.objClient = client
return client
def SearchHotel(self, DestinationId, CheckIn, CheckOut,
RoomsInformation, MaxAvrNightPrice, AvailableOnly, ):
soapRequest = self.objClient.factory.create('SearchHotelRequest')
soapRequest.DestinationId = DestinationId
soapRequest.CheckIn = CheckIn
soapRequest.CheckOut = CheckOut
soapRequest.RoomsInformation = RoomsInformation
soapRequest.MaxAvrNightPrice = MaxAvrNightPrice
soapRequest.AvailableOnly = AvailableOnly
response = self.objClient.service.SearchHotel(soapRequest)
self.lastXml = self.objClient.last_sent()
return response
here is the response
http://pastebin.com/Tbjk88Di
i can access some objects with
response.diffgram.SearchHotelResult.Hotel[index]
but in some cases the data inside some objects contais non asccii chars
with causes a python fault. how can i avoid this?
Thanks in advance.
Tobias
Hi.
On 28.11.2013. 2:22, Tobias Ramos Rocha wrote:
Hello people,
i´m receiving data from a webservice and trying pass data to python
objects. Logging says that suds succeeds in receive the response from
server.
But when i try to loop the response python raises and unicode error.
here is the part where is the problem
.
.
.
response = client.service.SearchHotel(SearchHotelRequest)
hoteis = response.diffgram.SearchHotelResult[1]
for hotel in hoteis:
hotel Error in formatting: 'ascii' codec can't encode character
u'\xca'
in position 2: ordinal not in range(128)
Is there another way to extract data from response ?
If you send us the exact WSDL and the exact HTTP response to your query,
someone can take a look.
Hope this helps.
Best regards,
Jurko Gospodnetic'
_______________________________________________
suds mailing list
suds@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/suds