i'm probably very annoying and boring with these python web service :)and
sorry for the previous message reply subject,wont happen again...
the thing is, i'm provided with some service provider documentation,
including xml request example, xml response example, wsdl file for the
protocol defintion, and xsd file for every request type.
i've played around with LXML and SUDS, and i got this :
xml parsing (i don't really know if i need this, but i made it just to see
how it works ):
try:
from lxml import etree
except ImportError:
import xml.etree.ElementTree as etree
#
document = etree.parse(HotelValuedAvailRQ.xml)
root = document.getroot()
#namespaces used
xmlns = ''
xsi = '{http://www.hotelbeds.com/schemas/2005/06/messages}'
#
user = document.find('//{namespace}User'.format(namespace=namespace))
user.text = '' #set hotelbeds user(text)
password =
document.find('//{namespace}Password'.format(namespace=namespace))
password.text = '' #set hotelbeds password(text)
language =
document.find('//{namespace}Language'.format(namespace=namespace))
language.text = '' #set hotelbeds response language(text)
#set number of pages for xml response(attribute)
PaginationData = root[2].set('pageNumber', '4')
#set check in date, format :'20130509'
CheckInDate = root[3].set('date', '')
#set check out date
CheckOutDate = root[4].set('date', '')
#set dest code, set dest type
Destination = root[5].set('code', ''); root[5].set('type', '')
#set the room count
RoomCount =
document.find('//{namespace}RoomCount'.format(namespace=namespace))
RoomCount.text = ''
#set number of adults
AdultCount =
document.find('//{namespace}AdultCount'.format(namespace=namespace))
RoomCount.text = ''
#set number of children
ChildCount =
document.find('//{namespace}ChildCount'.format(namespace=namespace))
ChildCount.text = '3'
document.write('HotelValuedAvailRQ.xml')
print '---Changes saved'
and i also made this, some suds experiment :
import logging
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
#logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
#logging.getLogger('suds.transport').setLevel(logging.DEBUG)
#logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsse').setLevel(logging.DEBUG)
from suds.client import Client
url = 'http://xxx.xxx.xxx.xxx/appservices/ws/FrontendService?wsdl'
client = Client(url)
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 (0)
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, )