IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Services Web Discussion :

Web Service innaccessible via Visual Studio 2017


Sujet :

Services Web

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2019
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Janvier 2019
    Messages : 11
    Points : 11
    Points
    11
    Par défaut Web Service innaccessible via Visual Studio 2017
    Bonjour,

    je rencontre un problème concernant le deploiement d un web service que j ai crée.
    Mon web service est installé sur un serveur avec une adresse publique. Via Internet Explorer, le web Service est accessible correctement. Je vois bien la liste de mes fonctions.

    Par contre, je n'arrive pas à me connecter a ce web service en utilisant la meme URL via Visual Studio 2017.
    Je ne comprends pas ce qui diffère.

    Quelle peuvent être les causes de mon problème?

    Merci pour vos réponses.

    Billy21

  2. #2
    Expert confirmé
    Avatar de popo
    Homme Profil pro
    Analyste programmeur Delphi / C#
    Inscrit en
    Mars 2005
    Messages
    2 667
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Analyste programmeur Delphi / C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2005
    Messages : 2 667
    Points : 5 235
    Points
    5 235
    Par défaut
    Montre déjà ce que tu as écrit parce sinon ça va être compliqué de t'expliquer où tu as fais une erreur.

  3. #3
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2019
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Janvier 2019
    Messages : 11
    Points : 11
    Points
    11
    Par défaut
    Je veux bien montré quelque chose, mais quoi?
    Est ce que le code en lui même peut influencer le fait que je n'arrive pas a me connecter a mon webservice via visual studio mais que par Internet explorer si?

    Je pensais plutôt à un problème de config au niveau du serveur web. Mais je ne sais pas dans quelle direction chercher.

    Merci

  4. #4
    Modérateur
    Avatar de DotNetMatt
    Homme Profil pro
    CTO
    Inscrit en
    Février 2010
    Messages
    3 611
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : CTO
    Secteur : Finance

    Informations forums :
    Inscription : Février 2010
    Messages : 3 611
    Points : 9 743
    Points
    9 743
    Billets dans le blog
    3
    Par défaut
    Citation Envoyé par billy21121 Voir le message
    Est ce que le code en lui même peut influencer le fait que je n'arrive pas a me connecter a mon webservice via visual studio mais que par Internet explorer si?
    Sans vouloir te manquer de respect, si je devais parier entre ce qui marche et ce qui ne marche pas, je mettrais toutes mes billes sur le fait qu'IE marche, et aucune sur ton code

    Le probleme est surement dans le code que tu utilises pour te connecter. Reste a trouver ce qui ne va pas...

    En plus de ton code cote client, peux-tu egalement preciser s'il y a un message d'erreur en particulier ? Et si oui, lequel ?
    Less Is More
    Pensez à utiliser les boutons , et les balises code
    Desole pour l'absence d'accents, clavier US oblige
    Celui qui pense qu'un professionnel coute cher n'a aucune idee de ce que peut lui couter un incompetent.

  5. #5
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2019
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Janvier 2019
    Messages : 11
    Points : 11
    Points
    11
    Par défaut
    Bonsoir,

    il n y a pas de manque de respect ou quoique ce soit.
    Merci surtout d avoir prit le temps de répondre a mon post.

    Voici le code de mon fichier.asmx.

    Code VB.NET : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    Option Compare Binary
    Option Explicit On
    Option Infer Off
    Option Strict On
     
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.ComponentModel
    Imports System.IO
    Imports System.Security.Cryptography
    Imports System.Reflection
     
    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    <System.Web.Script.Services.ScriptService()>
    <System.Web.Services.WebService(Namespace:="http://tempuri.org/")>
    <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
    <ToolboxItem(False)>
    Public Class TimeReport
        Inherits System.Web.Services.WebService
     
    #Region "Language"
        Private Const MSG_COMMON_USER_DEACTIVATED As Short = 4016
        Private Const MSG_COMMON_PASSWORD_NOT_DEFINED As Short = 4130
        Private Const MSG_COMMON_NAME_PASSWORD_INC As Short = 4090
        Private Const MSG_COMMON_USERPASSWORD_CORRECT_BUTNOTDEFINED As Short = 4052
    #End Region
     
    #Region "SQL Query"
     
    #End Region
     
        Private oEnvironment As clsEnvironment
        Private oFDeMaSyRights As clsFDeMaSyRights
        Private oFLDB As New clsFLDB
        Private oFADB As New clsFADB
        Private oErr As clsErr
     
        Private oUserId As Integer
        Private oUserName As String
        Private oUserEnd As Date
        Private oUserLoginName As String
        Private oUserLoginPassword As String
        Private oUserLoginPasswordTry As Integer
        Private oErrorMessage As String
        Private oStreamWriter As IO.StreamWriter
        Private oFilePath As String
        Private oKey As String = String.Empty
     
        <WebMethod(True)>
        Public Function Connect(ByVal pLogin As String, ByVal pPassword As String, ByVal pDBId As Integer) As Boolean
     
            Dim mLoginName As String
            Dim mPassword As String
            Dim mErrorOccurred As Boolean
            Dim mErrorCode As Integer = 0
            Dim mSecurityLockTime As Integer
            Dim mMessage As String
            Dim mCollection As New clsCollection
     
            Try
                'Get the key
                oKey = CStr(Application.Item("Key"))
     
                'Log the key
                Log("Key " & oKey)
     
                'Get the login name
                mLoginName = zDecrypt(pLogin).Trim
     
                'Get the password
                mPassword = zDecrypt(pPassword).Trim
     
                'Initialize the different objects
                zInitialize()
     
                'Log the key
                Log("1: " & oFLDB.LDB.Path)
     
                'Initialize the Login object
                oFLDB.Login.Initialize(oEnvironment, oFDeMaSyRights, oFLDB)
     
                'Log the key
                Log("2")
     
                'Refresh the Login information
                oFLDB.Login.Refresh(mLoginName)
     
                'Log the key
                Log("3")
     
                'Refresh the error StoreType
                oFLDB.RefreshErrDebug()
     
                'Log the key
                Log("4")
     
                'Set the user object
                zInit_LoginName(mLoginName)
     
                'Log the key
                Log("5")
     
                'Check the user
                zCheck_User(oUserEnd)
     
                'Log the key
                Log("6")
     
                'Get the Error Code
                mErrorCode = oFLDB.Login.CheckIsPasswordCorrect(oUserId, mLoginName, mPassword, MSG_COMMON_PASSWORD_NOT_DEFINED, MSG_COMMON_NAME_PASSWORD_INC, MSG_COMMON_USERPASSWORD_CORRECT_BUTNOTDEFINED, True)
     
                'Log the key
                Log("7")
     
                'Check if user have exceeded password tries
                mErrorOccurred = zCheck_PasswordTry(oUserId, mSecurityLockTime, mErrorCode)
     
                'Log the key
                Log("8")
     
                'Check if error occurred
                If mErrorOccurred Then
                    'Replace minute into message
                    mMessage = oFLDB.ColLanguage.Text(MSG_COMMON_USER_DEACTIVATED)
                    mMessage = Replace(mMessage, "@SecurityLockTime@", CStr(mSecurityLockTime))
     
                    'Set the error message
                    oErrorMessage = mMessage
     
                    'Log the key
                    Log("1: mErrorOccurred  " & mMessage)
                    Return False
                End If
     
                'Check if Error was found
                If Not mErrorCode = 0 Then
                    'Set the message
                    mMessage = oFLDB.ColLanguage.Text(mErrorCode)
     
                    'Set the label text
                    oErrorMessage = "Login name or password invalid"
     
                    'Log the key
                    Log("2: mErrorOccurred " & oErrorMessage)
                    Return False
                End If
     
                'Log the key
                Log("9")
     
                'Fill the collection
                mCollection.AddStr("FClient")
                mCollection.AddStr("FEmployee")
                mCollection.AddStr("FJob")
                mCollection.AddStr("FPerson")
                mCollection.AddStr("FTimeReport")
                mCollection.AddStr("FTimeReportType")
     
                'Open the FADB
                oFADB.InitializeSelected(oEnvironment, oFDeMaSyRights, oFLDB, pDBId, String.Empty, mCollection)
     
                'Log the key
                Log("ofadb is nothing: " & CStr(oFADB Is Nothing))
     
                'Log the key
                Log("oFLDB is nothing: " & CStr(oFLDB Is Nothing))
     
                'Save the key
                zSaveValue("FADB", oFADB)
                zSaveValue("FLDB", oFLDB)
     
                'Return default value
                Return True
            Catch mException As Exception
                'Log the key
                Log("mException " & mException.Message)
     
                'Set the return parameter
                oErrorMessage = mException.Message
                Return False
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub CreateLogFile()
     
            Try
                'Check if log has to be generate
                If My.Settings.GenerateLogFile = False Then Exit Sub
     
                'Get a file path 
                oFilePath = System.IO.Path.Combine(Server.MapPath("/logs"), "logfile.txt")
     
                'Save the file path
                zSaveValue("FilePath", oFilePath)
     
                'Check if the file exists
                If System.IO.File.Exists(oFilePath) Then
                    'Delete it
                    System.IO.File.Delete(oFilePath)
                End If
     
                'Open the file
                System.IO.File.Create(oFilePath).Close()
            Catch mException As Exception
     
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub Log(ByVal pMessage As String)
     
            Dim mStreamWriter As IO.StreamWriter
            Dim mFilePath As String
     
            Try
                'Check if log has to be generate
                If My.Settings.GenerateLogFile = False Then Exit Sub
     
                'Get the file path
                mFilePath = CStr(Application.Item("FilePath"))
     
                'Open the file
                mStreamWriter = New IO.StreamWriter(mFilePath, True)
     
                'Get query in memory
                mStreamWriter.WriteLine("************* " & Now & "*************")
                mStreamWriter.WriteLine(pMessage)
                mStreamWriter.WriteLine("**************************************" & vbCrLf)
     
                'Close the stream
                mStreamWriter.Close()
            Catch mException As Exception
     
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function ErrorMessage() As String
     
            'Return the error Message
            Return oErrorMessage
     
        End Function
        ''' <summary>Select the user</summary>
        Private Sub zInit_LoginName(ByVal pLoginName As String)
     
            Dim mDS As New clsDS
            Dim mTestSQL As New clsSQL
     
            Try
                'Create the query to select the user
                mTestSQL.Initialize(oFLDB.LDB, oFLDB.SQLArr, Nothing) '(No FVersionLink)
                If oFLDB.LDB.DBType = clsDB.eDBTYPE.MSACCESS Then
                    mTestSQL.Query = "Select * "
                    mTestSQL.Add = "From [User] "
                    mTestSQL.Add = "Where [User].[LoginName] = '@LoginName@' order by [User].[Id]"
                Else
                    mTestSQL.Query = "Select * "
                    mTestSQL.Add = "From [User] "
                    mTestSQL.Add = "Where [User].[LoginName] = '@LoginName@' order by [User].[Id]"
                End If
                mTestSQL.TextFieldRepChar(oFLDB.LDB)
                mTestSQL.ValueWhereStr("@LoginName@") = pLoginName
     
                'Create the query to select the user
                mDS.OpenRS(oFLDB.LDB, mTestSQL)
     
                'Check if record was found
                If mDS.EOF Then
                    'Read the values from recordset
                    oUserId = oFLDB.LDB.IdNone
                    oUserName = String.Empty
                    oUserEnd = oEnvironment.Dates.DATE_START
                    oUserLoginName = String.Empty
                    oUserLoginPassword = String.Empty
                    oUserLoginPasswordTry = 0
                Else
                    'Read the values from recordset
                    oUserId = mDS.ReadValueInt("Id")
                    oUserName = mDS.ReadValueStr("Name")
                    oUserEnd = mDS.ReadValueDate("End")
                    oUserLoginName = mDS.ReadValueStr("LoginName")
                    oUserLoginPassword = mDS.ReadValueStr("LoginPassword")
                    oUserLoginPasswordTry = mDS.ReadValueShort("LoginPasswordTry")
                End If
     
                'Close the recordset
                mDS.CloseRS()
            Catch mException As Exception
                'Close the recordset
                mDS.CloseRS()
            End Try
     
        End Sub
        ''' <summary>Check the user</summary>
        Private Sub zCheck_User(ByVal pUserEndDate As Date)
     
            Try
                'Check the date
                If pUserEndDate < Today And Not pUserEndDate = oEnvironment.Dates.DATE_START Then
                    'Generate an error
                    'oEnvironment.Err.ErrRead(clsDeMaSyNETFrmMisc.MSG_COMMON_USER_ENDDATE, String.Empty)
                End If
            Catch mException As Exception
                'Raise an error
                'oEnvironment.Err.ErrRead(0, String.Empty)
            End Try
     
        End Sub
        ''' <summary>Check password</summary>
        Private Function zCheck_PasswordTry(ByVal pUserId As Integer, ByRef SecurityLockTime As Integer, ByVal pErrorCode As Integer) As Boolean
     
            Dim mAdministratorId As Integer
            Dim mSecurityPasswordTry As Integer
            Dim mSecurityLockTime As Integer
            Dim mCurrentDateTime As Date
            Dim mLogoutTime As Date
            Dim mTimeDifference As Long     'This is correct and will stay
            Dim mErrorOccurred As Boolean = False
     
            Try
                'Get the AdministratorId
                mAdministratorId = oFLDB.FUser.GetAdministratorId
     
                'In case that this is the Administrator, we must do an exception an not count the number of Password tried
                If pUserId = mAdministratorId Then
                    'Return the default value
                    Return False
                End If
     
                'Get the Security Password try and lockTime
                oFLDB.FUserOptions.GetSecurity(pUserId,,,,,, mSecurityPasswordTry, mSecurityLockTime)
     
                'Set the ByRef Values
                SecurityLockTime = mSecurityLockTime
     
                'Get current date time
                mCurrentDateTime = oEnvironment.DateTime.Now
     
                'Get LogoutTime
                mLogoutTime = oFLDB.FUser.GetLogoutTime(pUserId)
     
                'Calculate the Time difference
                mTimeDifference = DateDiff("n", mLogoutTime, mCurrentDateTime)
     
                'Check delay
                If mTimeDifference > mSecurityLockTime And Not mSecurityLockTime = 0 Then
                    'Reset account
                    oFLDB.FUser.dbU_PasswordTry(pUserId, True)
     
                    'Reset Security password try
                    oUserLoginPasswordTry = 0
                End If
     
                'Check if password is correct
                If Not pErrorCode = 0 Then
                    'Set account
                    oFLDB.FUser.dbU_PasswordTry(pUserId, False)
                End If
     
                'Check for password try
                If oUserLoginPasswordTry >= mSecurityPasswordTry And Not mSecurityPasswordTry = 0 Then
                    'Set the Flag
                    mErrorOccurred = True
                End If
     
                'Return the flag, as no error occurred
                Return mErrorOccurred
            Catch mException As Exception
                'As error occurred, return the default value
                Return False
            End Try
     
        End Function
        ''' <summary></summary>
        Private Sub zInitialize()
     
            Dim mINIPathFileName As String
     
            Try
                'Create the object
                oErr = New clsErr
     
                'Initialize the Err object
                oErr.Initialize(Err)
     
                'Create the object
                oEnvironment = New clsEnvironment
     
                'Initialize the environment object
                oEnvironment.Initialize(Nothing, Nothing)
     
                'Set the ADO type
                oEnvironment.eADOTYPE = clsVBNet.eADOTYPE.ADONET
     
                'Create the object
                oFDeMaSyRights = New clsFDeMaSyRights
     
                'Log the settings
                Log("Settings " & My.Settings.INIPathFileName)
     
                'Initialize the object
                oFDeMaSyRights.Initialize(oEnvironment, My.Settings.INIPathFileName)
     
                'Log the settings
                Log("PathFileName " & oFDeMaSyRights.INILicence.PathFileName)
     
                'Initialize the object
                oFLDB.Initialize(oEnvironment, oFDeMaSyRights, True)
            Catch mException As Exception
                'Log the settings
                Log("Error " & mException.Message)
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function FLDB() As String
     
            Dim mFLDB As clsFLDB = Nothing
     
            Try
                'Get the FLDB object
                mFLDB = CType(Session.Item("FLDB"), clsFLDB)
     
                'Check the FLDB
                If mFLDB Is Nothing Then
                    'Return the error Message
                    Return "FLDB is nothing"
                Else
                    'Return the error Message
                    Return mFLDB.LDB.INIFileName()
                End If
            Catch mException As Exception
                'Return the error Message
                Return mException.Message
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function GetClientListOld() As List(Of clsClient)
     
            Dim mLst As New List(Of clsClient)
     
            Try
                'Create instance
                mLst.Add(New clsClient(1, "Client 1"))
                mLst.Add(New clsClient(2, "Client 2"))
                mLst.Add(New clsClient(3, "Client 3"))
     
                'Return the list
                Return mLst
            Catch mException As Exception
                'Return the list
                Return Nothing
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function GetClientList(ByVal pDate As Date) As List(Of clsClient)
     
            Dim mDS As New clsDS
            Dim mSQL As New clsSQL
            Dim mFLDB As clsFLDB
            Dim mFADB As clsFADB
            Dim mEmployeeId As Integer
            Dim mMayTimeReport As Boolean
     
            Dim mClientId As Integer
            Dim mClientName As String
            Dim mLst As New List(Of clsClient)
     
            Try
                'Log 
                Log("GetClientList 1")
     
                'Get he variable
                mFLDB = CType(Application.Item("FLDB"), clsFLDB)
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Log 
                Log("GetClientList 2")
     
                'Get the selected Employee
                mEmployeeId = mFADB.FEmployee.GetId_UserId(mFLDB.Login.UserId)
     
                'Log 
                Log("GetClientList 3")
     
                'Check if MayTimeReport option is activated
                mMayTimeReport = mFADB.FOptions.GetMayTimeReport
     
                'Log 
                Log("GetClientList 4")
     
                'Check the Options
                If mFADB.FOptions.GetTimeReport_OnlyJobEmployeeDivision Then
                    'Display the job based on the rights on divisions
                    mSQL.Initialize(oFADB.ADB, oFLDB.SQLArr, oFADB.FVersionLink)
                    mSQL.Query = mFADB.FClient.GetSQL_KeyCR_MayTimeReport(mEmployeeId, True, , , , , , , pDate)
                Else
                    'Check what Option is set
                    If mMayTimeReport And mFADB.FTimeReport.CheckJobAssignmentRestriction Then
                        'Display all those matching the criteria
                        mSQL.Initialize(oFADB.ADB, oFLDB.SQLArr, oFADB.FVersionLink)
                        mSQL.Query = mFADB.FClient.GetSQL_KeyCR_MayTimeReport(mEmployeeId, , , , , , , , pDate)
                    Else
                        'Display all those matching the criteria
                        mSQL.Initialize(oFADB.ADB, oFLDB.SQLArr, oFADB.FVersionLink)
                        mSQL.Query = mFADB.FClient.GetSQL_KeyCR(, , , , , , pDate)
                    End If
                End If
     
                'Log the query
                Log("mSQL :" & mSQL.Query)
     
                'Open the recordset
                mDS.OpenRS(mFADB.ADB, mSQL)
     
                'Go through all the records
                Do While Not mDS.EOF
                    'Read the values
                    mClientId = mDS.ReadValueInt("Id")
                    mClientName = mDS.ReadValueStr("Result")
     
                    'Add the client to list
                    mLst.Add(New clsClient(mClientId, mClientName))
     
                    'Go to the next records
                    mDS.MoveNext()
                Loop
     
                'Close the recordset
                mDS.CloseRS()
     
                'Log 
                Log("GetClientList 2")
     
                'Return the list
                Return mLst
            Catch mException As Exception
                'Log 
                Log("GetClientList exception:" & mException.Message)
     
                'Get the error in memory
                oErrorMessage = mException.Message
     
                'Close the recordset
                mDS.CloseRS()
     
                'Return the list
                Return mLst
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function GetJobList(ByVal pClientId As Integer, ByVal pDate As Date) As List(Of clsJob)
     
            Dim mSQL As New clsSQL
            Dim mFLDB As clsFLDB
            Dim mFADB As clsFADB
            Dim mEmployeeId As Integer
            Dim mCheckOnDivision As Boolean
            Dim mJobCollection As New clsCollection
            Dim mCounter As Integer
            Dim mJobItem As clsFJob.ItemJob
            Dim mJobId As Integer
            Dim mJobNumber As String
            Dim mLst As New List(Of clsJob)
     
            Try
                'Get he variable
                mFLDB = CType(Application.Item("FLDB"), clsFLDB)
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Get the selected Employee
                mEmployeeId = mFADB.FEmployee.GetId_UserId(mFLDB.Login.UserId)
     
                'Read the options
                mCheckOnDivision = mFADB.FOptions.GetTimeReport_OnlyJobEmployeeDivision
     
                'Get the collection of job
                mJobCollection = mFADB.FJob.GetJobCollection(String.Empty, pClientId, mEmployeeId, String.Empty, pDate, mCheckOnDivision, SDNANET_Convert.clsConvert.eVARBOOLEANSPECIAL.FALSE)
     
                'Go through all Job items in the collection
                For mCounter = mJobCollection.Min To mJobCollection.Max
                    'Get this Item
                    mJobItem = CType(mJobCollection.ItemObject_Index(mCounter), clsFJob.ItemJob)
     
                    'Get the Job Id and Number
                    mJobId = mJobItem.JobId
                    mJobNumber = mJobItem.JobNumber
     
                    'Add the item to the list
                    mLst.Add(New clsJob(mJobId, mJobNumber))
                Next
     
                'Return the list
                Return mLst
            Catch mException As Exception
                'Get the error in memory
                oErrorMessage = mException.Message
     
                'Return the list
                Return mLst
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function GetTimereportTypeList(ByVal pClientId As Integer, ByVal pJobId As Integer, ByVal pDate As Date) As List(Of clsTimeReportType)
     
            Dim mDS As New clsDS
            Dim mSQL As New clsSQL
            Dim mFLDB As clsFLDB
            Dim mFADB As clsFADB
            Dim mLst As New List(Of clsTimeReportType)
     
            Dim mTimeReportTypeId As Integer
            Dim mTimeReportTypeName As String
     
            Try
                'Get he variable
                mFLDB = CType(Application.Item("FLDB"), clsFLDB)
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Get the query
                mSQL.Initialize(oFADB.ADB, oFLDB.SQLArr, oFADB.FVersionLink)
                mSQL.Query = mFADB.FTimeReportType.GetSQL_KeyCR_MayTimeReport(String.Empty, True, pDate, ,,,,,, pClientId, pJobId)
     
                'Log the query
                Log("mSQL :" & mSQL.Query)
     
                'Open the recordset
                mDS.OpenRS(mFADB.ADB, mSQL)
     
                'Go through all the records
                Do While Not mDS.EOF
                    'Read the values
                    mTimeReportTypeId = mDS.ReadValueInt("Id")
                    mTimeReportTypeName = mDS.ReadValueStr("Result")
     
                    'Add the client to list
                    mLst.Add(New clsTimeReportType(mTimeReportTypeId, mTimeReportTypeName))
     
                    'Go to the next records
                    mDS.MoveNext()
                Loop
     
                'Close the recordset
                mDS.CloseRS()
     
                'Return the list
                Return mLst
            Catch mException As Exception
                'Get the error in memory
                oErrorMessage = mException.Message
     
                'Close the recordset
                mDS.CloseRS()
     
                'Return the list
                Return mLst
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub dbInsert(ByVal pTimeReport As clsTimeReport)
     
            Dim mFLDB As clsFLDB
            Dim mFADB As clsFADB
            Dim mTTimeReport As New DeMaSyNET_TADB.clsTTimeReport
     
            Try
                'Get he variable
                mFLDB = CType(Application.Item("FLDB"), clsFLDB)
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Initialize the table object
                mTTimeReport.Initialize(mFADB.ADB)
     
                'Fill the fields
                With mTTimeReport
                    .FDBId.ValueInt = mFADB.FVersionLink.GetDBId(mTTimeReport.T)
                    '.FId.ValueInt =
                    .FNum.ValueInt = 0
                    .FEmployeeId.ValueInt = pTimeReport.EmployeeId
                    .FJobId.ValueInt = pTimeReport.JobId
                    .FDate.ValueDate = pTimeReport.Date
                    .FTimeReportTypeId.ValueInt = pTimeReport.TimeReportTypeId
                    .FJobTaskId.ValueInt = pTimeReport.JobTaskId
                    .FFromTime.ValueStr = pTimeReport.FromTime
                    .FToTime.ValueStr = pTimeReport.ToTime
                    .FHours.ValueDbl = pTimeReport.Hours
                    .FHHMM.ValueDbl = pTimeReport.HHMM
                    .FArticleNumber.ValueDbl = pTimeReport.ArticleNumber
                    .FDescHours.ValueStr = pTimeReport.DescHours
                    .FDescClient.ValueStr = pTimeReport.DescClient
                    .FExpenses.ValueDbl = pTimeReport.Expenses
                    .FACExpenses.ValueDbl = pTimeReport.ACExpenses
                    .FDescExpenses.ValueStr = pTimeReport.DescExpenses
                    .FPeriod.ValueStr = pTimeReport.Period
                    .FCountryId.ValueInt = pTimeReport.CountryId
                    .FBillingRate.ValueDbl = pTimeReport.BillingRate
                    .FACBillingRate.ValueDbl = pTimeReport.ACBillingRate
                    .FHourlyCost.ValueDbl = pTimeReport.HourlyCost
                    .FACHourlyCost.ValueDbl = pTimeReport.ACHourlyCost
                    .FInvoiceTDetailId.ValueInt = pTimeReport.InvoiceTDetailId
                    .FInvoicedType.ValueShort = pTimeReport.InvoicedType
                    .FDescWriteOff.ValueStr = pTimeReport.DescWriteOff
                    .FRollbackInvoicedType.ValueShort = pTimeReport.RollbackInvoicedType
                    .FOrgDBId.ValueInt = pTimeReport.OrgDBId
                    .FStamp.ValueDate = pTimeReport.Stamp
                End With
     
                'Insert the record
                mFADB.FTimeReport.dbIUD_TimeReport(mTTimeReport)
            Catch mException As Exception
     
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub GetEmployeeId(ByRef EmployeeId As Integer)
     
            Dim mFLDB As clsFLDB
            Dim mFADB As clsFADB
            Dim mUserId As Integer
            Dim mEmployeeId As Integer
     
            Try
                'Get he variable
                mFLDB = CType(Application.Item("FLDB"), clsFLDB)
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                Log("FADB is nothing: " & CStr(mFADB Is Nothing))
     
                'Get the user
                mUserId = mFLDB.Login.UserId
     
                Log("mUserId: " & mUserId)
     
                'Get the employee
                mEmployeeId = mFADB.FEmployee.GetId_UserId(mUserId)
     
                Log("mEmployeeId: " & mEmployeeId)
     
                'Set the parameter
                EmployeeId = mEmployeeId
            Catch mException As Exception
     
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub GetDefaultCountryId(ByRef CountryId As Integer)
     
            Dim mDefaultCountryId As Integer
            Dim mFADB As clsFADB
     
            'Get he variable
            mFADB = CType(Application.Item("FADB"), clsFADB)
     
            'Check if it is company or Person
            If Not mFADB.FOptions.GetLicenceCompanyId = mFADB.ADB.IdNone Then
                'Get the default country
                mDefaultCountryId = mFADB.FCompany.GetLegalCountryId(mFADB.FOptions.GetLicenceCompanyId)
            ElseIf Not oFADB.FOptions.GetLicencePersonId = mFADB.ADB.IdNone Then
                'Get the default country
                mDefaultCountryId = mFADB.FPerson.GetLegalCountryId(mFADB.FOptions.GetLicencePersonId)
            End If
     
            'Set the parameter
            CountryId = mDefaultCountryId
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub Key(ByVal pKey As String)
     
            'Save the key
            zSaveValue("Key", pKey)
     
        End Sub
        ''' <summary></summary>
        Private Function zDecrypt(ByVal pEncryptedString As String) As String
     
            Dim mResult As String
     
            Try
                'Check if key is empty
                If oKey = String.Empty Then
                    'Decrypt the string
                    mResult = pEncryptedString
                Else
                    'Decrypt the string
                    mResult = zDecrypt_AES256Bit_Uni(pEncryptedString, "#")
                End If
     
                'Return the result 
                Return mResult
            Catch mException As Exception
                'Return the result 
                Return String.Empty
            End Try
     
        End Function
        '''<summary>This function decrypts data using AES256 algorithm. Key Size is 256 with a 128 block size. The block size is fixed, because Governments could not decrypt more. The Key Size could be 128/192/256, but we chose the 256 Key size.</summary>
        Private Function zDecrypt_AES256Bit_Uni(ByVal pText As String, ByVal pFlagChar As String) As String
     
            Dim mDataToBeDecrypted() As Byte
            Dim mTemp() As Byte
            Dim mIV() As Byte = {122, 241, 10, 71, 132, 74, 125, 39, 222, 91, 45, 51, 14, 211, 69, 62}
            Dim mRijndaelManaged As New RijndaelManaged()
            Dim mMemoryStream As MemoryStream
            Dim mCryptoStream As CryptoStream
            Dim mDecryptionKey() As Byte
            Dim mResult As String
     
            Dim mIntLength As Integer
            Dim mIntRemaining As Integer
            Dim mStrReturnString As String = String.Empty
     
            'Convert base64 encrypted value to byte array 
            mDataToBeDecrypted = Convert.FromBase64String(pText)
     
            '   ********************************************************************
            '   ******   Encryption Key must be 256 bits (32 bytes)           ******
            '   ******   If it exceeds than 32 bytes it will be truncated.    ******
            '   ******   If it is shorter than 32 bytes it will be padded     ******
            '   ******   with selected character.                             ****** 
            '   ********************************************************************
     
            'Initialize the value
            mIntLength = Len(oKey)
     
            If mIntLength >= 32 Then
                oKey = Microsoft.VisualBasic.Left(oKey, 32)
            Else
                mIntLength = Len(oKey)
                mIntRemaining = 32 - mIntLength
                oKey = oKey & Microsoft.VisualBasic.StrDup(mIntRemaining, pFlagChar)
            End If
     
            'Get the value
            mDecryptionKey = Encoding.ASCII.GetBytes(oKey.ToCharArray)
     
            'Re dimension the array to put the value
            ReDim mTemp(mDataToBeDecrypted.Length)
     
            'Initialize the object
            mMemoryStream = New MemoryStream(mDataToBeDecrypted)
     
            'Create the decryption object and write value to it after it is converted into a byte array
            Try
                'Initialize the object
                mCryptoStream = New CryptoStream(mMemoryStream, mRijndaelManaged.CreateDecryptor(mDecryptionKey, mIV), CryptoStreamMode.Read)
     
                'Read the value
                mCryptoStream.Read(mTemp, 0, mTemp.Length)
     
                'Close the stream
                mCryptoStream.FlushFinalBlock()
                mMemoryStream.Close()
                mCryptoStream.Close()
            Catch
     
            End Try
     
            'Get result
            mResult = zRemoveNullCharacters(Encoding.Unicode.GetString(mTemp))
            mResult = mResult.Remove(mResult.Length - 1)
            'Return decrypted value
            Return mResult
     
        End Function
        ''' <summary>This function removes null characters</summary>
        Private Function zRemoveNullCharacters(ByVal pStringWithNulls As String) As String
     
            Dim mResult As String
     
            Try
                'Remove the nullChar
                mResult = Replace(pStringWithNulls, vbNullChar, String.Empty)
     
                'Return the result
                Return mResult
            Catch mException As Exception
                'As error occurred, return the default value
                Return String.Empty
            End Try
     
        End Function
        ''' <summary></summary>
        Private Sub zSaveValue(ByVal pKey As String, ByVal pValue As Object)
     
            Try
                'Check if entry already exists
                If Application.Item(pKey) Is Nothing Then
                    'Save the key
                    Application.Add(pKey, pValue)
                Else
                    'Save the key
                    Application.Item(pKey) = pValue
                End If
            Catch mException As Exception
                Log("Exception in save values: " & mException.Message)
            End Try
     
        End Sub
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function OptionsValueBool(ByVal pSectionMain As String, ByVal pVariableName As String) As Boolean
     
            Try
                'Return the object
                Return oFADB.FOptions.GetValueBool(pSectionMain, pVariableName)
            Catch mException As Exception
                'Return the object
                Return Nothing
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Function GetArticle(ByVal pTimeReportTypeId As Integer) As Boolean
     
            Dim mFADB As clsFADB
     
            Try
                'Get the FADB Object
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Return if timereportType uses article
                Return Not mFADB.FTimeReportType.GetArticle(pTimeReportTypeId) = mFADB.ADB.IdNone
            Catch mException As Exception
                'Return the object
                Return Nothing
            End Try
     
        End Function
        ''' <summary></summary>
        <WebMethod(True)>
        Public Sub GetExpenses(ByVal pJobId As Integer, ByVal pTimeReportTypeId As Integer, ByVal pArticleNumber As Double, ByVal pDate As Date, ByRef ExpensesAmount As Double, ByRef ACExpensesAmount As Double)
     
            Dim mFADB As clsFADB
            Dim mClientId As Integer
     
            Try
                'Get the FADB Object
                mFADB = CType(Application.Item("FADB"), clsFADB)
     
                'Get the client id
                mClientId = mFADB.FJob.GetClientId(pJobId)
     
                'Calculate the expenses
                mFADB.FTimeReportType.GetExpenses(mClientId, pTimeReportTypeId, pArticleNumber, pDate, ExpensesAmount, ACExpensesAmount)
            Catch mException As Exception
     
            End Try
     
        End Sub
    End Class

    Quand je vis dans IE, je vois bien les fonctions et procédures.

    Par contre, des que je veux ajouter une référence a ce web service dans visual studio, voici ce que j obtiens.

    Nom : Capture.JPG
Affichages : 227
Taille : 32,4 Ko

    Merci pour vos réponses.

  6. #6
    Modérateur
    Avatar de DotNetMatt
    Homme Profil pro
    CTO
    Inscrit en
    Février 2010
    Messages
    3 611
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : CTO
    Secteur : Finance

    Informations forums :
    Inscription : Février 2010
    Messages : 3 611
    Points : 9 743
    Points
    9 743
    Billets dans le blog
    3
    Par défaut
    Alors il me semble que "Add Service Reference" est a utiliser pour WCF, or la tu as cree un "vieux" Web Service qui requiert une certaine compatibilite (extension du fichier .ASMX).

    Il y a un tuto ici pour ajouter un reference vers un Web Service : How to add reference of Web Service (ASMX) in ASP.Net using Visual Studio.

    Et au cas ou tu souhaites savoir comment proceder manuellement, il y a aussi des infos interessantes en cliquant ici (voir la reponse marquee comme solution).
    Less Is More
    Pensez à utiliser les boutons , et les balises code
    Desole pour l'absence d'accents, clavier US oblige
    Celui qui pense qu'un professionnel coute cher n'a aucune idee de ce que peut lui couter un incompetent.

  7. #7
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2019
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Janvier 2019
    Messages : 11
    Points : 11
    Points
    11
    Par défaut
    Merci beaucoup.
    C'est effectivement ce que je recherchais.
    Merci de votre aide et je ne manquerais pas de revenir sur ce forum.

    A bientôt

    Billy21211

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Débutant] Installation de bibliothèque via Pip sur Visual Studio 2017
    Par Exentius dans le forum Visual Studio
    Réponses: 0
    Dernier message: 11/05/2017, 14h05
  2. Réponses: 7
    Dernier message: 14/06/2012, 21h44
  3. Importer un Web Service Java dans Visual Studio 2010
    Par gjeanne dans le forum Développement Sharepoint
    Réponses: 2
    Dernier message: 12/03/2012, 16h32
  4. utiliser un web service php avec Visual Studio
    Par <% Bastien %> dans le forum Services Web
    Réponses: 6
    Dernier message: 15/03/2008, 16h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo