Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travelport Galileo python SoapClient

I need to develop python soapclient for Travelport Galileo uAPI.

This is 30-day trial credentials for Travelport Universal API

Universal API User ID: Universal API/uAPI2514620686-0edbb8e4

Universal API Password: D54HWfck9nRZNPbXmpzCGwc95

Branch Code for Galileo (1G): P7004130

URLs: https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/

This is quote from documentation galileo

HTTP Header

The HTTP header includes:

SOAP endpoints, which vary by: Geographical region. Requested service. In the preceding example, the HotelService is used for the endpoint; however, the service name is modified based on the request transaction. gzip compression, which is optional, but strongly recommended. To accept gzip compression in the response, specify “Accept-Encoding: gzip,deflate” in the header.

Authorization, which follows the standard basic authorization pattern. The text that follows “Authorization: Basic” can be encoded using Base 64. This functionality is supported by most programming languages. The syntax of the authorization credentials must include the prefix "Universal API/" before the User Name and Password assigned by Travelport. POST https://americas.universal-api.pp.travelport.com/ B2BGateway/connect/uAPI/HotelService HTTP/2.0

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: ""

Authorization: Basic UniversalAPI/UserName:Password

Content-Length: length

This is i my python code

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)

But it is not working.

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

I'm trying to solve this problem for the past 2 weeks, so if you can, please advise me solution.

like image 262
Tima Ospanov Avatar asked Nov 02 '22 02:11

Tima Ospanov


1 Answers

I think you can try to download WSDL files in ZIP archive from this url https://support.travelport.com/webhelp/uAPI/uAPI.htm#Getting_Started/Universal_API_Schemas_and_WSDLs.htm

So you will be able to generate your client classes using those WSDL files, because there is no WSDL endpoint on the https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/ (like ?wsdl or /.wsdl)

like image 168
Sergey Malyutin Avatar answered Nov 15 '22 05:11

Sergey Malyutin