在C#中调用Web服务引用请求

时间:2013-09-09 21:42:12

标签: c# web-services testing

我目前正试图弄清楚如何在C#中为Web服务设置一些测试。

我已经在我的项目中引用了Web服务并填充了请求,我只是想知道如何调用请求方法?

以下是现有代码,我正在尝试使用AddNewResponder Web服务进行模拟。下面列出了Web服务要求的所有项目,我似乎无法弄清楚如何执行Web服务代码。

        static void Main(string[] args)
    {
        int testID = 0;

        //populate the test user with user data
        TestUser tUser = GetUserData(testID);           

        //Create Request Body
        RCWS.AddNewResponderRequestBody respRequestBody = new RCWS.AddNewResponderRequestBody();

        respRequestBody.PriorityCode = tUser.PriCode;
        respRequestBody.ClientCode = "TestData";
        respRequestBody.Domain = "TestDomain";
        respRequestBody.IPAddress = "192.168.2.1";
        respRequestBody.Source = "web";
        respRequestBody.OS = "WinNT";
        respRequestBody.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36";
        respRequestBody.Browser = "Chrome";

        //Create Request
        RCWS.AddNewResponderRequest addNewResp = new RCWS.AddNewResponderRequest(respRequestBody);

    }

0 个答案:

没有答案