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 !