Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://mojafirma.com/post")> _
Public Class PostalWebService
    Inherits System.Web.Services.WebService

    <WebMethod(Description:="Pobiera informacje o lokalizacji paczki.")> _
    Public Function GetPackageInfo(ByVal TrackID As String) _
      As ClientPackageInfo
        System.Threading.Thread.Sleep(TimeSpan.FromSeconds(20))
        Dim PackageInfo As Package
        PackageInfo = GetPackageRecordFromDB(TrackID)
        Return PackageInfo.BasicInfo
    End Function

    Private Function GetPackageRecordFromDB(ByVal TrackID As String) _
      As Package
        ' Kod dostępu do bazy danych.
        Dim PackageInfo As New Package()

        ' Aby przeprowadzić prosty test, usuń znak komentarza z dwóch poniższych wierszy.
        PackageInfo.BasicInfo.PackageID = TrackID
        PackageInfo.BasicInfo.DeliveryDate = Now

        Return PackageInfo
    End Function

End Class

Public Class Package
    Public BasicInfo As New ClientPackageInfo
    Public CreditCardNumber As String
End Class

Public Class ClientPackageInfo
    Public PackageID As String
    Public DeliveryDate As Date
End Class

