Welcome to Dream.In.Code
Become a C# Expert!

Join 150,413 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,011 people online right now. Registration is fast and FREE... Join Now!




fedex

 
Reply to this topicStart new topic

fedex, gating if(reply.HighestSeverity == NotificationSeverityType.SUCCESS)

belucky19@gmail.com
28 Mar, 2008 - 04:50 AM
Post #1

New D.I.C Head
*

Joined: 28 Mar, 2008
Posts: 1

CODE
class Program
    {
        static void Main(string[] args)
        {
            TrackService trackService = new TrackService();
            TrackRequest request = new TrackRequest(); // Build a track request object
            TrackDetail det = new TrackDetail();
          
            //
            
            request.WebAuthenticationDetail = new WebAuthenticationDetail();
            request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
            //request.WebAuthenticationDetail.UserCredential.
            request.WebAuthenticationDetail.UserCredential.Key = "bgwNo9GWSFah2w66 "; // Replace "XXX" with the Key
            request.WebAuthenticationDetail.UserCredential.Password = "Code:39vUaU2DYiIOe78LHq01sVMNl"; // Replace "XXX" with the Password
            //
            request.ClientDetail = new ClientDetail();
            request.ClientDetail.AccountNumber = "510087909"; // Replace "XXX" with clients account number
            request.ClientDetail.MeterNumber = "1228702"; // Replace "XXX" with clients meter number
            //
            request.TransactionDetail = new TransactionDetail();
            request.TransactionDetail.CustomerTransactionId = "***Tracking v2 Request using VC#***";  //This is a reference field for the customer.  Any value can be used and will be provided in the response.
            //
            request.Version = new VersionId(); // Creates the Version element with all child elements populated from the wsdl
            //
            request.PackageIdentifier = new TrackPackageIdentifier(); // Tracking information
           request.PackageIdentifier.Value = "0986655645"; // Replace with tracking number or door tag
           request.PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG;
            //
            request.ShipDateRangeBegin = DateTime.Now; // Date range and shippers account number
            request.ShipDateRangeEnd = DateTime.Now.AddDays(2);
            //
            request.Destination = new Address(); // Destination information
            request.Destination.City = "Alaska";
            request.Destination.StateOrProvinceCode = "AK";
            request.Destination.PostalCode = "99504";
            request.Destination.CountryCode = "US";
            //
          // Initialize the service
            //
            TrackReply reply = trackService.track(request);
            try
            {
              
               // Console.WriteLine("track details"+trackService.Credentials.ToString() );// This is the call to the web service passing in a request object and returning a reply object
                if (reply.HighestSeverity == NotificationSeverityType.SUCCESS) // check if the call was successful
                {
                    Console.WriteLine("Trackinbg details\n");
                    foreach (TrackDetail trackDetail in reply.TrackDetails) // Track details for each package
                    {
                        //Console.WriteLine("Package # {} - Package count {1}", trackDetail.PackageSequenceNumber.ToString().Trim(), trackDetail.PackageCount.ToString());
                        Console.WriteLine("Package # {} " + trackDetail.PackageCount);
                        Console.WriteLine("Tracking number {0}", trackDetail.TrackingNumber);
                        Console.WriteLine("Tracking number unique identifier {0}", trackDetail.TrackingNumberUniqueIdentifier);
                        Console.WriteLine("Status {0} description {1}", trackDetail.StatusCode, trackDetail.StatusDescription);
                        
                        if (trackDetail.OtherIdentifiers != null)
                        {
                            Console.WriteLine("Other identifiers\n");
                            foreach (TrackPackageIdentifier identifier in trackDetail.OtherIdentifiers)
                            {
                                Console.WriteLine("{0} {1}", identifier.Type, identifier.Value);
                            }
                        }
                        Console.WriteLine("Packaging {0}", trackDetail.Packaging);
                        Console.WriteLine("Package weight {0} {1}", trackDetail.PackageWeight.Value, trackDetail.PackageWeight.Units);
                        Console.WriteLine("Shipment weight {0} {1}", trackDetail.ShipmentWeight.Value, trackDetail.ShipmentWeight.Units);
                        Console.WriteLine("Packaging {0}", trackDetail.Packaging);
                        Console.WriteLine("Ship date & time", trackDetail.ShipTimestamp);
                        Console.WriteLine("Destination {0}, {1}, {2}", trackDetail.DestinationAddress.City, trackDetail.DestinationAddress.PostalCode, trackDetail.DestinationAddress.CountryCode);
                    }
                }
                else
                {
                    Console.WriteLine(reply.Notifications[0].Message);
                }
            }
            catch (SoapException e)
            {
                Console.WriteLine(e.Detail.InnerText);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine("Press any key to quit !");
            Console.ReadKey();
        }
    }

User is offlineProfile CardPM
+Quote Post

zakary
RE: Fedex
28 Mar, 2008 - 04:55 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 420



Thanked: 8 times
Dream Kudos: 175
My Contributions
what is your question here.

This post has been edited by zakary: 28 Mar, 2008 - 05:42 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:00PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month