如何将参数发送到wcf休息服务

时间:2013-07-19 08:05:00

标签: jquery wcf rest

我有以下服务

  <OperationContract()>
           <Web.WebGet(UriTemplate:="/GetBedTypeList1?strErrMsg={strErrMsg}&chrErrFlg={chrErrFlg}&pcocd={pcocd}&pdiv={pdiv}&ploc={ploc}", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped)> _
    Function GetBedTypeList1(ByRef strErrMsg As String, ByRef chrErrFlg As Char, _
                                                ByVal pcocd As String,
                                                ByVal pdiv As Integer, _
                                                ByVal ploc As Integer) As System.Collections.Generic.List(Of CWReadClasses.clsBedTypeMaster)

我试图将其称为

    function callService() 
{
    DataType = "json";
    Type = "GET";
    var par = 4;
    //parameters = null; 
    Url = "192.168.22.2/BedTypeMasterService.svc/GetBedTypeList1?strErrMsg=Y&chrErrFlg=c&pcocd=1&pdiv=1&ploc=1"
    ContentType = "application/json; charset=utf-8";
    ProcessData = true;
    CallWcfService();
}




    function CallWcfService() 
{
     jQuery.ajax
        (
         {

             type: Type,
             url: Url,   
             data: parameters, //'{"strErrMsg":"1"},{"chrErrFlg":"A"},{"pcocd":"1"},{"pdiv":"1"},{"ploc":"1"}', // '{'strErrMsg':'1'},{'chrErrFlg':'A'},{'pcocd':'1'},{'pdiv':'1'},{'ploc':'1'}',
             contentType: ContentType, // content type sent to server
             dataType: DataType, //Expected data format from server
             cache: "false",
             crossDomain: true,   //Same result if i remove this line
             processdata: ProcessData, //True or False
             success: function (msg) {
                 ServiceSucceeded(msg);
             },
             error: ServiceFailed// When Service call fails
         }
       );
}

每次我获得程序或功能都期望这个参数,但是在使用相同代码部署服务的本地主机上运行。这意味着Web服务没有收到带有上述代码的参数......

0 个答案:

没有答案