• Accessing PTV xServer internet in .NET applications

    There are two ways to access PTV xServer internet in .NET applications. You can download the PTV .NET client access assemblies and add them to your project. Or you can generate client access classes from the WSDL using WCF or SoapHttpClientProtocol. The following tutorials show how to access PTV xServer internet on these different ways.

    Which method is the best for you depends on your specific requirements. We can sum up the advantages of both approaches.

    Advantages of the PTV .NET client access classes:

    • Shared basic types: Common types (e.g. CPoint) can be used througout all xServer, without the need of mapping from one xServer type to another xServer type.
    • Flat type system: There are no additional "wrapped" container classes for the PTV clients. The WSDL-generated classes are more verbose.
    • Nullable value types: If a boolean or numeric type is optional, a Nullable wrapper is created, e.g. DimaId = new NullableInt(2). This is much less error-prone than the additional xSpecified value, which is generated by wsdl import.
    • Simple initialization: The credentials can be set in the constructor of the client class, you do not need to set up the WCF transport protocol configuration or quotas.
    • Integrated exception mapping: Exceptions are mapped to typed xServer exceptions (e.g. XRouteException). You do not have to parse the xServer exception from the generic .NET WebException.
    • Job-Helper: The generated client has integrated helper functions for easy access to the job-style api functions. For example you can just invoke runPlanBasicTours, which automatically polls the progress and blocks the client until the result is returned.

    Advantages of WSDL-generated access classes:

    • Works for all .NET-based frameworks: The PTV .NET client access classes only support ".NET classic", typically used for Microsoft Windows clients and ASP.NET. WCF-generated classes can also be applied to other .NET flavors, like Windows RT, Windows Phone or Silverlight.
    • Better fine-tuning and configuration: The implementation of the basic web access classes is not hidden. You can directly change the properties of the basic WCF classes.
    • Control the generation: For WSDL generation you can specify the generation of asynchronous methods or the .NET types used for collections.
    • No dependencies: If you import the WSDL using Visual Studio, there are no third-party dependencies required. The third-party dependencies of the PTV .NET client access classes can cause conflicts with the libraries of your applications, if you are using the same libraries.
    • Support for signed assemblies: The assemblies for the PTV-generated classes are unsigned. If you want to use xServer from a signed application, you cannot use these assemblies.
    • Easy update: To reflect the changes of new functions for new xServer internet versions, you only have to click "Refresh" on the service reference in Visual Studio.