现在想利用HttpWebRequest类来POST数据给一个WebService,  要调用的这个web服务方法需要接收客户端传过来的两个参数,一个是整型,一个是字符串  并获取返回的结果(返回结果是一个字符串),代码应该如何实现?  谢谢!

解决方案 »

  1.   

       $.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: "WebService1.asmx/Get",
                        data: "{value1:'',value2:''}",
                        dataType: 'json',
                        success: function(result) {
                            $('#dictionary').append(result.d);
                        }
                    });
      

  2.   

    byte[] bs = Encoding.UTF8.GetBytes(param);
    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("");
    myRequest.Method = "POST";
    myRequest.ContentType = "application/x-www-form-urlencoded"; 
    myRequest.Headers.Add("SOAPAction", "http://tempuri.org/HelloWorld");
    myRequest.ContentLength = bs.Length;
      

  3.   


    没看明白,参数体现得不够清楚,没看出来是怎么去将参数POST的