Page History
...
Section | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
WsLogin
Cette fonction WsLogin
renvoie trois paramètres (Path
, Key
, language
). Vous devez ensuite utiliser ces 3 paramètres pour faire appel aux autres fonctions du webservice.
Exemple en ASP
Code Block | ||
---|---|---|
| ||
private function ConnectEdb LsUSER = "WSUSER" // Utilisateur FlexLogistics LsPSWD = "987654" // Mot de passé de l'utilisateur FlexLogistics LsCOMPANY = "DEMO" // Dossier FlexNom du dossier Logistics LsVERSION = "109" // Version du Webservicewebservice LsPRGROOT = "\\server\winbooks\data\logistics\" // Chemin où se trouve le plugin (utilisé par le web service). Attention, comme le web service peut se trouver sur un autre serveur que celui des pages du site, il faut impérativement lui envoyer un chemin UNC. Le chemin dans le fichier Logistics.ini doit également être un chemin UNC. LsCTRL = "<?xml version = '1.0' encoding='Windows-1252' standalone='yes'?>" & _ "<VFPData><login>" & _ "<userid>" & LsUSER & "</userid>" & _ "<pswd>" & LsPSWD & "</pswd>" & _ "<compid>" & LsCOMPANY & "</compid>" & _ "<version>" & LsVERSION & "</version>" & _ "<PrgRoot>" & LsPRGROOT & "</PrgRoot></login></VFPData>" set soapclient = CreateObject("MSSOAP.SoapClient30") soapclient.ClientProperty("ServerHTTPRequest") = True soapclient.mssoapinit(WSPath) Lsresult = soapclient.login (LsCTRL) set oLogin = new clsLogin oLogin.XmlLoginResponse = LsResult session("edb_Path") = oLogin.DbPath session("edb_Key") = oLogin.DbKey session("edb_Lang") = oLogin.Language |
Exemple en
...
C#
Code Block | ||
---|---|---|
| ||
String lsValue = ""; String lsName = ""; String LsCTRL = "<?xml version = '1.0' encoding='Windows-1252' standalone='yes'?>" + "<VFPData><login>" + "<userid>" + psUSER + "</userid>" + "<pswd>" + psPSWD + "</pswd>" + "<compid>" + psCOMPANY + "</compid>" + "<version>" + psVERSION + "</version>" + "<PrgRoot>" + psPRGROOT + "</PrgRoot></login></VFPData>"; WsFlex ws = new WsFlex(""); psResultLogin = ws.LOGIN(LsCTRL); |
Cette fonction renvoie trois paramètres (Path
, Key
, language
). Vous devez ensuite utiliser ces paramètres pour faire appel aux fonctions. WsFlex est En C#, WsFlex doit être déclaré dans les WebRéférences de votre projet qui pointe vers le fichier WSDL de votre web servicewebservice.
Exemple en PHP
Code Block | ||
---|---|---|
| ||
<?php // 1. Initialisation $client = new SoapClient("http://217.112.181.34/wsflexDotNet/ServiceFlexDotNet.asmx?wsdl", array('soap_version' => SOAP_1_2)); $LsUSER = "WSUSER"; // Utilisateur Logistics $LsPSWD = "987654"; $LsCOMPANY = "DEMO"; $LsVERSION = "109";// Mot de passé de l'utilisateur Logistics $LsCOMPANY = "DEMO"; // Nom du dossier Logistics $LsVERSION = "109"; // Version du webservice $LsPRGROOT = "\\server\winbooks\data\logistics\\"; $LsCTRL = "<?xml version = '1.0' encoding='Windows-1252' standalone='yes'?><VFPData><login><userid> ?> <VFPData> <login> <userid>".$LsUSER."</userid><pswd>userid> <pswd>".$LsPSWD."</pswd><compid>pswd> <compid>".$LsCOMPANY."</compid><version>compid> <version>".$LsVERSION. "</version><PrgRoot>version> <PrgRoot>".$LsPRGROOT."</PrgRoot></login><PrgRoot> </login> </VFPData>"; try { $params = array("PcCtrl" =>$LsCTRL> $LsCTRL); $Res = $client->__call('Login', array("parameter" =>$params))> $params)); $language = "F"; $dbpath = $LsPRGROOT."".$LsCOMPANY."\\"; $dbkey = $Res->LOGINResult; //echo 'RESPONSE: ' .$client->__getLastResponse()."<br>"; //echo 'REQUEST : ' . $client->__getLastRequest()."<br>"; } catch (SoapFault $fault) { print_r($fault); throw new Exception($fault->getMessage()); } var_dump($Res); // 2. Request $xmlFile = '<?xml version="1.0" encoding="Windows-1252" standalone="yes" ?> <VFPData> <xmlreturn> <custid>WS00000003</custid> </xmlreturn> </VFPData>'; try { $param = array("PcFunc" => "WsGetCustInfo", "PcPath" => $dbpath, "PcKey" => $dbkey, "PcLang" => $language, "Pcxmlheader" => "a", "pcxmlfile" => $xmlFile, "pcxmlfooter" => "a"); $cust = $client->__call("WsRequest", array("parameter" => $param)); var_dump($cust); } catch (SoapFault $fault) { print_r($fault); throw new Exception($fault->getMessage()); } ?> |
...