Exemplo n.º 1
0
        public PocztaPolskaService.Przesylka track(String number)
        {
            CustomBinding          customBinding = new CustomBinding();
            SecurityBindingElement security      = SecurityBindingElement.CreateUserNameOverTransportBindingElement();

            security.IncludeTimestamp = false;
            customBinding.Elements.Add(security);
            TextMessageEncodingBindingElement encoding = new TextMessageEncodingBindingElement();

            encoding.MessageVersion = MessageVersion.Soap11;
            customBinding.Elements.Add(encoding);
            HttpsTransportBindingElement httpsTransportBindingElement = new HttpsTransportBindingElement();

            httpsTransportBindingElement.RequireClientCertificate = false;
            httpsTransportBindingElement.UseDefaultWebProxy       = false;
            customBinding.Elements.Add(httpsTransportBindingElement);

            System.ServiceModel.EndpointAddress endpointAddress = new System.ServiceModel.EndpointAddress(@"https://tt.poczta-polska.pl/Sledzenie/services/Sledzenie.SledzenieHttpSoap11Endpoint/");

            PocztaPolskaService.SledzeniePortTypeClient client = new PocztaPolskaService.SledzeniePortTypeClient(customBinding, endpointAddress);
            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            PocztaPolskaService.Przesylka przesylka = client.sprawdzPrzesylke(number);
            return(przesylka);
        }
        public PocztaPolskaService.Przesylka Get(string id)
        {
            TrackerModel model = new TrackerModel();

            PocztaPolskaService.Przesylka przesylka = model.track(id);
            return(przesylka);
        }