我需要爲Travelport Galileo uAPI開發python soapclient。Travelport Galileo python SoapClient
這是Travelport的通用API 30天試驗憑證
通用API用戶ID:通用API/uAPI2514620686-0edbb8e4
通用API密碼:D54HWfck9nRZNPbXmpzCGwc95
分行代碼爲伽利略(1G) :P7004130
網址:https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/
這是從報價文檔伽利略
HTTP頭
中的HTTP報頭包括:
SOAP端點,其通過改變: 地理區域。 請求的服務。在前面的例子中,HotelService用於端點;但是,服務名稱是根據請求事務修改的。 gzip壓縮,這是可選的,但強烈建議。要在響應中接受gzip壓縮,請在標題中指定「Accept-Encoding:gzip,deflate」。
授權,它遵循標準的基本授權模式。 「授權:基本」後面的文本可以使用Base 64進行編碼。大多數編程語言都支持該功能。 授權憑證的語法必須在由Travelport分配的用戶名和密碼前包含前綴「Universal API /」。 POST https://americas.universal-api.pp.travelport.com/ B2BGateway /連接/ uAPI/HotelService HTTP/2.0
接受編碼:gzip,放氣
內容類型:文本/ XML;字符集= UTF-8
的SOAPAction: 「」
授權:基本UniversalAPI /用戶名:密碼
的Content-Length:長度
這是我的蟒蛇代碼
import urllib2
import base64
import suds
class HTTPSudsPreprocessor(urllib2.BaseHandler):
def http_request(self, req):
message = \
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:air="http://www.travelport.com/schema/air_v16_0" xmlns:com="http://www.travelport.com/schema/common_v13_0" -->
<soapenv:header>
<soapenv:body>
<air:availabilitysearchreq xmlns:air="http://www.travelport.com/schema/air_v16_0" xmlns:com="http://www.travelport.com/schema/common_v13_0" authorizedby="Test" targetbranch="P7004130">
<air:searchairleg>
<air:searchorigin>
<com:airport code="LHR">
</com:airport></air:searchorigin>
<air:searchdestination>
<com:airport code="JFK">
</com:airport></air:searchdestination>
<air:searchdeptime preferredtime="2011-11-08">
</air:searchdeptime></air:searchairleg>
</air:availabilitysearchreq>
</soapenv:body>
"""
auth = base64.b64encode('Universal API/uAPI2514620686-0edbb8e4:D54HWfck9nRZNPbXmpzCGwc95')
req.add_header('Content-Type', 'text/xml; charset=utf-8')
req.add_header('Accept', 'gzip,deflate')
req.add_header('Cache-Control','no-cache')
req.add_header('Pragma', 'no-cache')
req.add_header('SOAPAction', '')
req.add_header('Authorization', 'Basic %s'%(auth))
return req
https_request = http_request
URL = "https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/"
https = suds.transport.https.HttpTransport()
opener = urllib2.build_opener(HTTPSudsPreprocessor)
https.urlopener = opener
suds.client.Client(URL, transport = https)
但它不工作。
Traceback (most recent call last):
File "soap.py", line 42, in <module>
suds.client.Client(URL, transport = https)
File "/usr/local/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/local/lib/python2.7/site-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/local/lib/python2.7/site-packages/suds/wsdl.py", line 136, in __init__
d = reader.open(url)
File "/usr/local/lib/python2.7/site-packages/suds/reader.py", line 79, in open
d = self.download(url)
File "/usr/local/lib/python2.7/site-packages/suds/reader.py", line 95, in download
fp = self.options.transport.open(Request(url))
File "/usr/local/lib/python2.7/site-packages/suds/transport/http.py", line 64, in open
raise TransportError(str(e), e.code, e.fp)
suds.transport.TransportError: HTTP Error 500: Dynamic backend host not specified
我試圖解決這個問題,在過去的2周,所以如果可以的話,請告訴我的解決方案。
我不熟悉這個特定主題,但是您確定要在此處發佈登錄憑據嗎? –
感謝您的回覆。沒問題,這是30天的試用憑證 –
嗨,我不熟悉這個網絡服務平臺,但我似乎是你正在離開一個參數。看看[link] https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014798066 [/ link]看來你必須設置後端服務器,您正在嘗試與之通話。 – hlasso