Bonjour,
Je reviens encore avec des petits soucis!
Voila j'ai un bout de code sous VB (utiliser dans un tableau Excel) et j'aimerais pouvoir le translater en Windev. Concretement ce code permet de se connecter à un automate via un SOAP (Web service) et obtenir des valeurs comme Marche ou Arret... Seulement le hic c'est qu'il y a une authentification à faire pour que je puisse interroger le serveur SOAP et je ne sais pas trop comment procéder. J'ai utiliser l'utilitaire de Windev, Atelier > Services Web XML (SOAP, .Net, J2EE) > Importer et utiliser un service dans ce projet, tout s'est bien passé sauf qu'il me manque a mettre l'utilisateur et le mot de passe! Mais je sais pas où!
Voici le code VB :
Merci beaucoup!
Code : 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 'Definition of SOAP/WSDL 'For more informations please look after e.g. "www.w3schools.com/default.asp 'SOAP: "Simple Object Access Protocol" ' SOAP is a simple XML based protocol to let aplications exhange information about HTTP 'WSDL: "Web service Definition language" ' WSDL is a document written in XML. The document describes a Web service. ' It specifies the location of the service and the operations (or methods) the service exposes. 'Definition of the constant "WSDL_URL" Const WSDL_URL = "http://localhost/soap/RuntimeAccess?wsdl" 'Button "Execute GetValue" Private Sub CommandButton1_Click() Dim Rt Set Rt = CreateObject("MSSOAP.SoapClient") 'definition of the adress of the specific Operator Panel which act as HTTP-Server URL = "http://192.168.1.10/soap/RuntimeAccess?wsdl" Rt.mssoapinit URL 'Handover of the Password Rt.ConnectorProperty("AuthUser") = "User" Rt.ConnectorProperty("AuthPassword") = "Motdepasse" 'Pick out the tag name of an existing tag from the HTTP-Server Dim Answer Variable_MARCHE = Worksheets("Sheet1").Range("D7").Value Variable_VITESS = Worksheets("Sheet1").Range("D8").Value 'Read the value of the Tag_1 from the HTTP-Server Answer = Rt.GetValue(Variable_MARCHE) Worksheets("Sheet1").Range("G7").Value = Answer 'Read the value of the Tag_2 from the HTTP-Server Answer = Rt.GetValue(Variable_VITESS) Worksheets("Sheet1").Range("G8").Value = Answer End Sub
Partager