Travelport Galileo uAPI 用の python soapclient を開発する必要があります。
これは、Travelport Universal API の 30 日間の試用資格情報です。
ユニバーサル API ユーザー ID: ユニバーサル API/uAPI2514620686-0edbb8e4
ユニバーサル API パスワード: D54HWfck9nRZNPbXmpzCGwc95
ガリレオ (1G) の支店コード: P7004130
URL: https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/
これはドキュメントガリレオからの引用です
HTTP ヘッダー
HTTP ヘッダーには以下が含まれます。
以下によって異なる SOAP エンドポイント: 地理的地域。リクエストされたサービス。前の例では、エンドポイントに HotelService が使用されています。ただし、サービス名はリクエスト トランザクションに基づいて変更されます。gzip 圧縮。これはオプションですが、強くお勧めします。レスポンスで gzip 圧縮を受け入れるには、ヘッダーに「Accept-Encoding: gzip,deflate」を指定します。
標準の基本的な承認パターンに従う承認。「Authorization: Basic」に続くテキストは、Base 64 を使用してエンコードできます。この機能は、ほとんどのプログラミング言語でサポートされています。認証資格情報の構文には、Travelport によって割り当てられたユーザー名とパスワードの前に、プレフィックス「Universal API/」を含める必要があります。POST https://americas.universal-api.pp.travelport.com/ B2BGateway/connect/uAPI/HotelService HTTP/2.0
Accept-Encoding: gzip,deflate
コンテンツタイプ: text/xml;charset=UTF-8
SOAPアクション: ""
権限: Basic UniversalAPI/ユーザー名:パスワード
コンテンツの長さ: 長さ
これは私のpythonコードです
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 週間、この問題を解決しようとしているので、可能であれば解決策を教えてください。