help with SUDS

I

Ismar Sehic

hello, i'm trying to make a wrapper for making xml requests to hotelbeds.com site.
this is what i got:


import logging
from suds.xsd.doctor import ImportDoctor, Import
from suds.plugin import Plugin
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
from suds.client import Client
url = 'http://xxx.xxx.xxx.xx/appservices/ws/FrontendService?wsdl'

imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
doctor = ImportDoctor(imp)
client = Client(url, doctor = doctor)

print client

rw = client.service.getHotelValuedAvail()
print rw)
print client
****************
which gives me following result :
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913

Service ( FrontendServiceService ) tns="http://www.hotelbeds.com/wsdl/2005/06"
Prefixes (1)
ns0 = "http://schemas.xmlsoap.org/soap/encoding/"
Ports (1):
(FrontendService)
Methods (34):
cancelProtectionAdd(xs:anyType cancelProtectionAdd, )
cancelProtectionRemove(xs:anyType cancelProtectionRemove, )
getCancelProtectionAvail(xs:anyType getCancelProtectionAvail, )
getCarCountryList(xs:anyType getCarCountryList, )
getCarInfoSet(xs:anyType getCarInfoSet, )
getCarValuedAvail(xs:anyType getCarValuedAvail, )
getCountryList(xs:anyType getCountryList, )
getDestinationGroupList(xs:anyType getDestinationGroupList, )
getHotelBoardGroupList(xs:anyType getHotelBoardGroupList, )
getHotelBoardList(xs:anyType getHotelBoardList, )
getHotelCategoryGroupList(xs:anyType getHotelCategoryGroupList, )
getHotelCategoryList(xs:anyType getHotelCategoryList, )
getHotelCountryList(xs:anyType getHotelCountryList, )
getHotelDetail(xs:anyType getHotelDetail, )
getHotelList(xs:anyType getHotelList, )
getHotelRoomTypeGroupList(xs:anyType getHotelRoomTypeGroupList, )
getHotelValuedAvail(xs:anyType getHotelValuedAvail, )
getIncomingOfficeDetail(xs:anyType getIncomingOfficeDetail, )
getIncomingOfficeList(xs:anyType getIncomingOfficeList, )
getPurchaseDetail(xs:anyType getPurchaseDetail, )
getPurchaseList(xs:anyType getPurchaseList, )
getTicketAvail(xs:anyType getTicketAvail, )
getTicketClassificationList(xs:anyType getTicketClassificationList, )
getTicketCountryList(xs:anyType getTicketCountryList, )
getTicketDetail(xs:anyType getTicketDetail, )
getTicketValuation(xs:anyType getTicketValuation, )
getTransferCountryList(xs:anyType getTransferCountryList, )
getTransferValuedAvail(xs:anyType getTransferValuedAvail, )
getZoneGroupList(xs:anyType getZoneGroupList, )
purchaseCancel(xs:anyType purchaseCancel, )
purchaseConfirm(xs:anyType purchaseConfirm, )
purchaseFlush(xs:anyType purchaseFlush, )
serviceAdd(xs:anyType serviceAdd, )
serviceRemove(xs:anyType serviceRemove, )
Types (48):
ns0:Array
ns0:ENTITIES
ns0:ENTITY
ns0:ID
ns0:IDREF
ns0:IDREFS
ns0:NCName
ns0:NMTOKEN
ns0:NMTOKENS
ns0:NOTATION
ns0:Name
ns0:QName
ns0:Struct
ns0:anyURI
ns0:arrayCoordinate
ns0:base64
ns0:base64Binary
ns0:boolean
ns0:byte
ns0:date
ns0:dateTime
ns0:decimal
ns0:double
ns0:duration
ns0:float
ns0:gDay
ns0:gMonth
ns0:gMonthDay
ns0:gYear
ns0:gYearMonth
ns0:hexBinary
ns0:int
ns0:integer
ns0:language
ns0:long
ns0:negativeInteger
ns0:nonNegativeInteger
ns0:nonPositiveInteger
ns0:normalizedString
ns0:positiveInteger
ns0:short
ns0:string
ns0:time
ns0:token
ns0:unsignedByte
ns0:unsignedInt
ns0:unsignedLong
ns0:unsignedShort



DEBUG:suds.client:sending to (http://212.170.239.71:9091/appservices
/ws/FrontendService)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://axis.frontend.hydra.hotelbeds.com"
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org
/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:getHotelValuedAvail/>
</ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction': u'""', 'Content-Type': 'text/xml; charset=utf-8'}
Traceback (most recent call last):
File "soaptest.py", line 23, in <module>
rw = client.service.getHotelValuedAvail()
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py", line 637, in send
reply = transport.send(request)
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/transport/https.py", line 64, in send
return HttpTransport.send(self, request)
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/transport/http.py", line 77, in send
fp = self.u2open(u2request)
File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/transport/http.py", line 118, in u2open
return url.open(u2request, timeout=tm)
File "/usr/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1172, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1147, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>
**********************************************************************

this is how the xml request should look like:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<hb:getHotelValuedAvail
xmlns:hb="http://axis.frontend.hydra.hotelbeds.com" xsi:type="xsd:string">
<HotelValuedAvailRQ echoToken="DummyEchoToken"
sessionId="DummySessionId"
xmlns="http://www.hotelbeds.com/schemas/2005/06/messages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd">
<Language>ENG</Language>
<Credentials>
<User>TEST</User>
<Password>TEST</Password>
</Credentials>
<PaginationData pageNumber="1"/>
<CheckInDate date="20130709"/>
<CheckOutDate date="20130711"/>
<Destination code="PMI" type="SIMPLE"/>
<OccupancyList>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>
</OccupancyList>
</HotelValuedAvailRQ>
</hb:getHotelValuedAvail>
</soapenv:Body>
</soapenv:Envelope>

i cannot use any of these methods with suds, i keep getting type not found errors.is it a problem with namespaces, or the wsdl file is corrupted?if you have any idea, i would really appreciate it.thanks.
 
D

dieter

Ismar Sehic said:
hello, i'm trying to make a wrapper for making xml requests to hotelbeds.com site.
...
File "/usr/lib/python2.6/urllib2.py", line 1172, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1147, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>

This indicates a problem of the service you are contacting:
"suds" tries to open a connection to the service url defined
in the WSDL, but it does not get a response within a reasonable
time frame.

The problem might be temporary (a temporary overload of the
corresponding service) - or they may be some error in the
WSDL - or some firewall may interfere with your request - or ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top