WebService - JScript - InfoPath Dev
in

InfoPath Dev

WebService - JScript

Last post 12-01-2006 02:12 AM by diaboloche. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 12-01-2006 02:12 AM

    WebService - JScript

    Salut,

    J'ai déjà posté dans la partie anglais... mais c'est assez pressant, donc autant demandé ici aussi...

    Je veux envoyer un argument (en JSCRIPT) à un webservice (C#) :


    var Client=XDocument.DOM.selectSingleNode("//my:comboClient");
    var objXH= new ActiveXObject("MSXML2.XMLHTTP.3.0");
    objXH.open("PUT","http://10.20.20.103:90/WS/Service.asmx/InsertAnnonce", true);
    objXH.setRequestHeader("Content","application/x-www-form-urlencoded");
    strPostXMLText=Client.text; //XDocument.UI.Alert(strPostXMLText);

    /*
    strPostXMLText = strPostXMLText.replace(/\+/g, "%2B");
    strPostXMLText = strPostXMLText.replace(/\&/g, "%26");
    */

    objXH.send(strPostXMLText);

    XDocument.UI.Alert("OK");


    Il compile, m'affiche bien OK, mais ne fait strictement rien :-s
    Voici le WebService :


    public void InsertAnnonce(string IDClient)
    {

    //---Création connexion---//
    SqlConnection Connexion = new SqlConnection(Con);

    //---Création procédure---//
    SqlCommand Req = new SqlCommand("TEST", Connexion);
    Req.CommandType = CommandType.StoredProcedure;

    //---Définition des paramètres---//
    Req.Parameters.Add("@IDClient", SqlDbType.Int);

    //---Attribution des valeurs---//
    Req.Parameters["@IDClient"].Value = Convert.ToInt32(IDClient);

    //---Execution---//
    Connexion.Open();
    Req.ExecuteNonQuery();
    Connexion.Close();

    }


    Il fonctionne je l'ai testé à part.

    Quelqu'un peut me dire ce qui ne va pas ?

    Merci !
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.