Bonjour,
J'explore les Webservices de CISCO pour la TOIP via leur CallManager.
L'importation des WSDL ne fonctionne pas tous, beaucoup de fichier inutilisable... Bref j'envoie directement des flux XML sur des telephones IP (79xx) pour afficher des infos ou effectuer des actions. Cela marche tres bien en php, javascript ou asp. Maintenant je veux faire la même chose avec Delphi via Indy et idhttp. Petits exemples:
en javascripten DelphiCode:
1
2
3
4
5
6
7
8
9
10
11
12
13 var authstring = text2base64(userID + ":" + password); var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); pushxml = "<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\" URL=\"Dial:7878\"/></CiscoIPPhoneExecute>"; pushxml = "XML=" + Server.URLEncode(pushxml); xmlhttp.Open("POST", "http://" + phoneIP + "/CGI/Execute", false); xmlhttp.setRequestHeader("Authorization", "Basic " + authstring); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.Send(pushxml);
Ce code fonctionne, le telephone repond bien, mais voici ce qui passe sur le reseaux:Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 laQuestion := TStringList.Create; Question := 'XML=<CiscoIPPhoneExecute><ExecuteItem Priority="0" URL="Play:chime.raw"/></CiscoIPPhoneExecute>'; Question := 'XML=<CiscoIPPhoneExecute><ExecuteItem Priority="0" URL="Dial:8512"/></CiscoIPPhoneExecute>'; laQuestion.Append(Question ); Memo1.Lines.Append(Question ); IdHTTP1.Request.URL := 'http://@ip-tel/CGI/Execute'; IdHTTP1.Request.Username := 'monuser'; IdHTTP1.Request.Password := 'monpwd'; IdHTTP1.Request.BasicAuthentication := true; IdHTTP1.Request.Method := 'POST'; IdHTTP1.Request.Connection := 'close'; IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; laReponse := IdHTTP1.Post('http://@ip-tel/CGI/Execute', laQuestion );
J'envoie :Code:
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 PC --> TEL POST /CGI/Execute HTTP/1.0 Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: 106 Host: 10.x.x.x Accept: text/html, */* Accept-Encoding: identity User-Agent: Mozilla/3.0 (compatible; Indy Library) Authorization: Basic XXXXusr+pwd en base64xxxxx XML=%3CCiscoIPPhoneExecute%3E%3CExecuteItem%20Priority="0"%20URL="Dial:8512"/%3E%3C/CiscoIPPhoneExecute%3E TEL --> PC HTTP/1.1 200 OK Content-Type: text/xml Date: Tue, 07 Feb 2006 15:14:15 GMT Expires: Thu, 26 Oct 1995 00:00:00 GMT Last-Modified: Tue, 07 Feb 2006 15:14:15 GMT Pragma: no-cache Content-Length: 154 Server: Allegro-Software-RomPager/4.20 <?xml version="1.0" encoding="iso-8859-1"?> <CiscoIPPhoneResponse> <ResponseItem URL="Dial:7878" Data="Success" Status="0" /> </CiscoIPPhoneResponse>
et pasCode:XML=%3CCiscoIPPhoneExecute%3E%3CExecuteItem%20Priority="0"%20URL="Dial:8512"/%3E%3C/CiscoIPPhoneExecute%3E
Bref, je recherche sur ce forum et mon ami google comment refaire la fonction Server.URLEncode en Delphi, mais je seche grave.Code:<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\" URL=\"Dial:7878\"/></CiscoIPPhoneExecute>
Si vous avez un idee, elle est la bien venue.
@++ 8)