<div dir="ltr"><div><div><div>hello, it's me again with my stubborn soap and xml request.please take a look at this code and the output, just tell if i'm missing something - i don't get it.<br> <br></div> ---- > code<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">'''
<br>Created on 30.09.2013
<br> <br>@author: i.sehic
<br>'''
<br>import SOAPpy
<br>from xml.etree.ElementTree import Element, SubElement, tostring
<br>import pprint
<br> <br>class HotelbedsRequests():
<br>
<br> def __init__(self):
<br> self.wsdlFile = '<a href="http://testapi.interface-xml.com/appservices">http://testapi.interface-xml.com/appservices</a> /ws/FrontendService?wsdl'
<br> self.server = SOAPpy.WSDL.Proxy(self.wsdlFile)
<br>
<br> def sendPriceRequest(self, adults, children_, hotel = "", room = "", board = ""):
<br> <br> header = """<?xml version="1.0" encoding="UTF-8"?>"""
<br>
<br> root = Element('soapenv:Envelope', {"soapenv:encodingStyle":"<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>", "xmlns:soapenv":"<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>", "xmlns:xsi":"<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" })
<br> body = SubElement(root, "soapenv:Body")
<br> getrequest = SubElement(body, "hb:getHotelValuedAvail", {"xmlns:hb":"<a href="http://axis.frontend.hydra.hotelbeds.com">http://axis.frontend.hydra.hotelbeds.com</a>", "xsi:type":"xsd:string"})
<br> getavailrp = SubElement(getrequest, "HotelValuedAvailRQ", {"echoToken":"DummyEchoToken", "sessionId":"DummySessionId", "xmlns":"<a href="http://www.hotelbeds.com/schemas/2005/06/messages">http://www.hotelbeds.com/schemas/2005/06/messages</a>", "xmlns:xsi":"<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>", "xsi:schemaLocation":"<a href="http://www.hotelbeds.com/schemas/2005/06/messages">http://www.hotelbeds.com/schemas/2005/06/messages</a> HotelValuedAvailRQ.xsd"})
<br> language = SubElement(getavailrp, "Language")
<br> language.text = "ENG"
<br> credentials = SubElement(getavailrp, "Credentials")
<br> user = SubElement(credentials, "User")
<br> user.text = "xxxxxxxxxxxx"
<br> pw = SubElement(credentials, "Password")
<br> pw.text = "xxxxxxxxxxxx"
<br> paginationdata = SubElement(getavailrp, "PaginationData", {"pageNumber":'1'})
<br> checkin = SubElement(getavailrp, "CheckInDate", {"date":"20130814"})
<br> checkout = SubElement(getavailrp, "CheckOutDate", {"date":"20130819"})
<br> desti = SubElement(getavailrp, "Destination", {"code":"PMI", "type": "SIMPLE"})
<br> occupancylist = SubElement(getavailrp, "OccupancyList")
<br> occupancyhotel = SubElement(occupancylist, "HotelOccupancy")
<br> roomcount = SubElement(occupancyhotel, "RoomCount")
<br> roomcount.text = "1"
<br> occu = SubElement(occupancyhotel, "Occupancy")
<br> adult = SubElement(occu, "AdultCount")
<br> adult.text = str(adults)
<br> #adult.text = str(adult)
<br> children = SubElement(occu, "ChildCount")
<br> children.text = str(children_)
<br> #children.text = str(children)
<br>
<br>
<br> xmlstring = header + tostring(root)
<br> pprint.pprint(xmlstring)
<br>
<br>
<br> print self.server.methods.keys()
<br>
<br> self.server.getHotelValuedAvail(xmlstring)
<br> callInfo = self.server.methods['getHotelValuedAvail']
<br> <br> print callInfo.inparams
<br> print callInfo.inparams[0].name
<br> print callInfo.inparams[0].type
<br>
<br> print callInfo.outparams
<br> print callInfo.outparams[0].name
<br> print callInfo.outparams[0].type
<br>
<br>
<br> def readHotelPriceResponse(self):
<br> pass
<br>
<br>
<br>
<br>HotelbedsRequests().sendPriceRequest(2, 1)
<br></blockquote><br></div>----->output:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">/usr/lib/pymodules/python2.6/SOAPpy/wstools/XMLSchema.py:2871: DeprecationWarning: object.__init__() takes no parameters<br>
tuple.__init__(self, args)<br>'<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope soapenv:encodingStyle="<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>" xmlns:soapenv="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"><soapenv:Body><hb:getHotelValuedAvail xmlns:hb="<a href="http://axis.frontend.hydra.hotelbeds.com">http://axis.frontend.hydra.hotelbeds.com</a>" xsi:type="xsd:string"><HotelValuedAvailRQ echoToken="DummyEchoToken" sessionId="DummySessionId" xmlns="<a href="http://www.hotelbeds.com/schemas/2005/06/messages">http://www.hotelbeds.com/schemas/2005/06/messages</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:schemaLocation="<a href="http://www.hotelbeds.com/schemas/2005/06/messages">http://www.hotelbeds.com/schemas/2005/06/messages</a> HotelValuedAvailRQ.xsd"><Language>ENG</Language><Credentials><User>xxxx</User><Password>xxxx</Password></Credentials><PaginationData pageNumber="1" /><CheckInDate date="20130814" /><CheckOutDate date="20130819" /><Destination code="PMI" type="SIMPLE" /><OccupancyList><HotelOccupancy><RoomCount>1</RoomCount><Occupancy><AdultCount>2</AdultCount><ChildCount>1</ChildCount></Occupancy></HotelOccupancy></OccupancyList></HotelValuedAvailRQ></hb:getHotelValuedAvail></soapenv:Body></soapenv:Envelope>'<br>
[u'purchaseConfirm', u'getHotelCategoryList', u'getZoneGroupList', u'getPurchaseList', u'getHotelRoomTypeGroupList', u'purchaseCancel', u'getTicketValuation', u'getCountryList', u'getHotelBoardGroupList', u'getPurchaseDetail', u'serviceAdd', u'getHotelDetail', u'cancelProtectionAdd', u'getIncomingOfficeList', u'purchaseFlush', u'getTicketCountryList', u'getCarCountryList', u'cancelProtectionRemove', u'getCarValuedAvail', u'getTicketDetail', u'getCancelProtectionAvail', u'serviceRemove', u'getCarInfoSet', u'getIncomingOfficeDetail', u'getHotelBoardList', u'getDestinationGroupList', u'getHotelCategoryGroupList', u'getHotelList', u'getTransferValuedAvail', u'getHotelValuedAvail', u'getTicketAvail', u'getTicketClassificationList', u'getTransferCountryList', u'getHotelCountryList']<br>
Traceback (most recent call last):<br> File "soappy.py", line 71, in <module><br> HotelbedsRequests().sendPriceRequest(2, 1)<br> File "soappy.py", line 54, in sendPriceRequest<br> self.server.getHotelValuedAvail(xmlstring)<br>
File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 470, in __call__<br> return self.__r_call(*args, **kw)<br> File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 492, in __r_call<br>
self.__hd, self.__ma)<br> File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 363, in __call<br> config = self.config)<br> File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 187, in call<br>
r.endheaders()<br> File "/usr/lib/python2.6/httplib.py", line 904, in endheaders<br> self._send_output()<br> File "/usr/lib/python2.6/httplib.py", line 776, in _send_output<br> self.send(msg)<br>
File "/usr/lib/python2.6/httplib.py", line 735, in send<br> self.connect()<br> File "/usr/lib/python2.6/httplib.py", line 716, in connect<br> self.timeout)<br> File "/usr/lib/python2.6/socket.py", line 514, in create_connection<br>
raise error, msg<br>socket.error: [Errno 110] Connection timed out<br></blockquote><br></div>what could cause this socket error?and what is this Deprecation Warning?i don't get it anymore, i tried all the possible ways - with simple http request i get an internal server error [500].i wrote an email to the people at hotelbeds services 7 days ago, still waiting for the reply.how do i make this API, i cannot get simple xml request through.<br>
<div><div><div><div><div><br></div></div></div></div></div></div>