Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF REST服务无法识别URI参数_C#_Android_Wcf_Rest - Fatal编程技术网

C# WCF REST服务无法识别URI参数

C# WCF REST服务无法识别URI参数,c#,android,wcf,rest,C#,Android,Wcf,Rest,我正在尝试开发一个与WCF服务交互的android应用程序。我查看了可能发送的格式,但服务似乎无法识别参数并调用指定的函数 WCF代码: public interface IEmployeeService { [OperationContract] [WebGet(UriTemplate = "/GetEmployees/{LocationId}/{SessionId}/{CompanyId}", BodyStyle = WebMessageBodyStyl

我正在尝试开发一个与WCF服务交互的android应用程序。我查看了可能发送的格式,但服务似乎无法识别参数并调用指定的函数

WCF代码:

public interface IEmployeeService
     {

    [OperationContract]
    [WebGet(UriTemplate = "/GetEmployees/{LocationId}/{SessionId}/{CompanyId}", 
    BodyStyle = WebMessageBodyStyle.WrappedRequest,
    ResponseFormat = WebMessageFormat.Json,
    RequestFormat = WebMessageFormat.Json)]
    List<Employee> GetEmployees(string LocationId,string SessionId,string CompanyId);}
          DefaultHttpClient client = new DefaultHttpClient();
            HttpGet httpGet = new HttpGet(url);

            httpGet.setHeader("Accept", "application/json");
            httpGet.setHeader("Content-type", "application/json");

            try {
                HttpResponse execute = client.execute(httpGet);

                HttpEntity responseEntity = execute.getEntity();


                Reader employeeReader = new InputStreamReader(execute.getEntity().getContent());
                char[] buffer = new char[(int) execute.getEntity().getContentLength()];
                //fill the buffer by the help of reader
                employeeReader.read(buffer);
                //close the reader streams
                employeeReader.close();
它生成的URI如下:
EmployeeService.svc/GetEmployees/1311000032/2014/1312

我还尝试了其他格式(例如
/GetEmployees/?LocationId={LocationId}&SessionId={SessionId}


我已经使用控制台应用程序检查了该服务,并将参数传递给该服务的引用,从而得到正确的结果。但是使用URI不会返回任何结果。

发现了问题。它与web.config文件一起使用。服务名称不正确。我真蠢。

你有没有尝试过使用截击来使用web服务?没有,你能把我链接到某个我可以知道如何使用的地方吗?