1

I am trying to create session using SessionCreateRQ soap service. where I have created object using HttpWebRequest https://sws3-crt.cert.sabre.com, and i have add the WSDL to service reference in my program

    String username = "username";
    String Pass = "Pass";
    String Ippc = "iPseudo";
    String ppc = "pseudo";
    String domain = "DEFAULT";

    DateTime dt = DateTime.UtcNow;
    string tstamp = dt.ToString("s") + "Z";



    sessionRQ.MessageHeader msgheader = new sessionRQ.MessageHeader();

    msgheader.ConversationId = "GetsessionRQ";

    //Message Header message header from //
    sessionRQ.From from = new sessionRQ.From();
    sessionRQ.PartyId frompartid = new sessionRQ.PartyId();
    sessionRQ.PartyId[] frompartidarr = new sessionRQ.PartyId[1];
    frompartid.Value = "";
    frompartidarr[0] = frompartid;
    from.PartyId = frompartidarr;
    msgheader.From = from;

    //message Header, To //
    sessionRQ.To to = new sessionRQ.To();
    sessionRQ.PartyId topartid = new sessionRQ.PartyId();
    sessionRQ.PartyId[] topartidarr = new sessionRQ.PartyId[1];
    topartid.Value = "";
    topartidarr[0] = topartid;
    to.PartyId = topartidarr;
    msgheader.To = to;


    msgheader.CPAId = Ippc;
    msgheader.Action = "SessionCreateRQ";
    sessionRQ.Service services = new sessionRQ.Service();
    services.Value = "SessionCreate";
    msgheader.Service = services;


    sessionRQ.MessageData msgData = new sessionRQ.MessageData();
    msgData.MessageId = "adong";
    msgData.Timestamp = tstamp;
    msgheader.MessageData = msgData;


    sessionRQ.Security security = new sessionRQ.Security();
    sessionRQ.SecurityUsernameToken securityusertoken = new 
    sessionRQ.SecurityUsernameToken();
    securityusertoken.Username = username;
    securityusertoken.Password = Pass;
    securityusertoken.Organization = Ippc;
    securityusertoken.Domain = ppc;
    security.UsernameToken = securityusertoken;

    sessionRQ.SessionCreateRQ req = new sessionRQ.SessionCreateRQ();
    sessionRQ.SessionCreateRQPOS pos = new sessionRQ.SessionCreateRQPOS();
    sessionRQ.SessionCreateRQPOSSource source = new 
    sessionRQ.SessionCreateRQPOSSource();
    source.PseudoCityCode = Ippc;
    pos.Source = source;
    req.POS = pos;

    sessionRQ.SessionCreateRQService servicesobj = new 
    sessionRQ.SessionCreateRQService();
    servicesobj.MessageHeaderValue = msgheader;
    servicesobj.SecurityValue = security;



    sessionRQ.SessionCreateRS resp = new sessionRQ.SessionCreateRS();
    try
    {
        resp = servicesobj.SessionCreateRQ(req);
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.ToString());
    }

    string a, b;

    a = msgheader.ConversationId;
    b = security.BinarySecurityToken;

i got error like this : "The request was aborted: Could not create SSL/TLS secure channel". is there something wrong with my code?. and i have followed this code Consuming Sabre soap services using .net

Adong
  • 13
  • 4
  • Looks like the Url is wrong. Can you try using https://sws-crt.cert.havail.sabre.com Also can you post ur RQ/RS xml log. https://developer.sabre.com/resources/getting_started_with_sabre_apis/about_sabre_apis/sabre_apis_environments – Imran Momin Jan 25 '19 at 14:35
  • i have been using this Url : http://webservices.sabre.com/wsdl/sabreXML1.0.00/usg/SessionCreateRQ.wsdl, but i got the same error, can you help me further Dear Mr. Momin, thank you very much – Adong Jan 28 '19 at 09:56
  • Adong - you need to post the HttpWebRequest to https://sws-crt.cert.havail.sabre.com - The URL you shared is of WSDL - schema for the service – Imran Momin Jan 29 '19 at 14:37

2 Answers2

1

Apparently your code is not the problem (but just in case, replace the part services.Value = "SessionCreate" to services.Value = "SessionCreateRQ";), Sabre have been changed the connection configurations in some environments, Sabre has lots of endpoints that each one points to different environment configuration.

You must have to set-up the SecurityProtocol and do not forget to check out in your Sabre proxy class what is the endpoint configured

> Try to add those lines in the top of your class/method responsible for create session.

You should have something like this:

private string DummyCreateMySabreSession()
{

    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 |         System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Ssl3;
    System.Net.ServicePointManager.Expect100Continue = true;
    System.Net.ServicePointManager.DefaultConnectionLimit = 9999;

    Security security = new Security
    {
        UsernameToken = new SecurityUsernameToken
        {
            Username = "", //Your username
            Password = "", //Your password
            Organization = "", //Your organization
            Domain = "" //Your domain
        }
    };
    MessageHeader messageHeader = new MessageHeader
    {
        From = new From
        {
            PartyId = new PartyId[1]{
                new PartyId{
                    type = "urn:x12.org:IO5:01",
                    Value = "app.stackoverflow.com"
                }
            }
        },
        To = new To
        {
            PartyId = new PartyId[1]{
                new PartyId{
                    type = "urn:x12.org:IO5:01",
                    Value = "sws-crt.cert.sabre.com"
                }
            }
        }   
        ConversationId = "stk@stackoverflow.com",
        Service = new Service
        {
            type = "OTA",
            Value = "SessionCreateRQ"
        },
        Action = "SessionCreateRQ",
        MessageData = new MessageData
        {
            MessageId = "", // Unique Hash key per transaction
            Timestamp = DateTime.UtcNow.ToString("s") + "z"
        }
    };
    SessionCreateRQ sessionCreateRQ = new SessionCreateRQ
    {
        POS = new SessionCreateRQPOS
        {
            Source = new SessionCreateRQPOSSource
            {
                PseudoCityCode = "" //Your organization
            }
        },
        returnContextID = true,
        returnContextIDSpecified = false
    };

    SessionCreateRQService sessionCreateRQService = new SessionCreateRQService
    {
        MessageHeaderValue = messageHeader,
        SecurityValue = security
    };

    SessionCreateRS scRSService = sessionCreateRQService.SessionCreateRQ(sessionCreateRQ);

}
Mr Milk
  • 144
  • 9
  • thank you Mr.Milk, i did what you told me to do, but i got "BinarySecurityToken is null " is there something wrong in my code? – Adong Feb 08 '19 at 06:00
  • I got this "BinarySecurityToken is null " – Adong Feb 11 '19 at 07:40
  • SabreSesh.SessionCreateRS AltLangID: null altLangIDField: null ConversationId: "Gettoken" conversationIdField: "Gettoken" EchoToken: null echoTokenField: null Errors: null errorsField: null PrimaryLangID: null primaryLangIDField: null SequenceNmbr: null sequenceNmbrField: null status: "Approved" statusField: "Approved" Success: null successField: null Target: Production targetField: Production TimeStamp: null timeStampField: null Warnings: null warningsField: null – Adong Feb 11 '19 at 07:41
  • Your request may have some parameters missing, Keep in your mind to use a serializationObject to understand better Sabre response, because what you have been posted does means nothing, because your are showing a null object, in a nutshell some fault happened, but you did not catch it, the correct thing to do to debug is: get the Sabre response and serialize it and check out the error message. I'm will add in my answer a method that works properly. – Mr Milk Feb 11 '19 at 20:05
0

If you don't want to manually modify the TLS settings, make sure you are targeting the correct .NET Framework. I believe the .NET framework 4.7.x defaults to the correct TLS Version.

drtrobridge
  • 419
  • 3
  • 10