C# SSRS和WCF测试中Soap请求的查询方法

C# SSRS和WCF测试中Soap请求的查询方法,c#,wcf,soap,reporting-services,C#,Wcf,Soap,Reporting Services,我正在寻找一个好的测试工具,用于生成Xml查询请求,并了解如何将它们与返回Xml for SSR的soap请求一起使用 我看到一些关于测试WCF服务的SOAP请求的线程,这些线程推荐了一些产品,还有人在codeplex上提到了“WebServiceStudio:”。问题在于,该工具似乎无法直接生成“xml请求”部分。我不确定这种语法是属于SSRS还是属于SOAP家族的一部分,所以我真的在寻找关于从哪里开始的建议,并且认为我只能在BusinessIntelligenceDevelopmentStu

我正在寻找一个好的测试工具,用于生成Xml查询请求,并了解如何将它们与返回Xml for SSR的soap请求一起使用

我看到一些关于测试WCF服务的SOAP请求的线程,这些线程推荐了一些产品,还有人在codeplex上提到了“WebServiceStudio:”。问题在于,该工具似乎无法直接生成“xml请求”部分。我不确定这种语法是属于SSRS还是属于SOAP家族的一部分,所以我真的在寻找关于从哪里开始的建议,并且认为我只能在BusinessIntelligenceDevelopmentStudio BIDS中单独测试似乎有点疯狂

到目前为止所做工作的一点背景:

  • 在一个库项目中,我在.NET4.5中使用C#中的EntityFramework 5创建了一个实体模型,以使其与数据的模型部分保持隔离
  • 然后,我在一个网站WCF项目中创建了一个接口和实现,使用basicHttpBinding作为其自己的项目来托管,以使其与模型隔离
  • 我在网站项目中引用了实体项目,并根据t4模板生成了返回类(*.tt=据我所知,类似于POCO类生成器)
  • 我的返回实现如下用于测试,两个表返回,其中一个在签名中带有参数,一个表函数带有两个datetime参数:

    public List<tblState> GetStatesTable()
    {
        using (SSRSReportsEntities re = new SSRSReportsEntities())
        {
            return re.tblStates.ToList();
        }
    }
    
    public List<tblState> GetStateLike(string state)
    {
        using (SSRSReportsEntities re = new SSRSReportsEntities())
        {
            return re.tblStates.Where(n => n.State.Contains(state)).ToList();
        }
    }
    
    public List<fMonthly_Result> GetMonthlyData(DateTime aStart, DateTime aEnd)
    {
        using (SSRSReportsEntities re = new SSRSReportsEntities())
        {
            return re.fMonthly(aStart, aEnd, null).ToList();
        }
    }
    
    public List GetStatesTable()
    {
    使用(ssrsreportsenties re=new ssrsreportsenties())
    {
    返回re.tblStates.ToList();
    }
    }
    公共列表GetStateLike(字符串状态)
    {
    使用(ssrsreportsenties re=new ssrsreportsenties())
    {
    返回re.tblStates.Where(n=>n.State.Contains(State)).ToList();
    }
    }
    公共列表GetMonthlyData(DateTime aStart、DateTime aEnd)
    {
    使用(ssrsreportsenties re=new ssrsreportsenties())
    {
    返回re.fMonthly(aStart,aEnd,null).ToList();
    }
    }
    
  • 我将其发布到Windows 7 Enterprise上IIS 7.5上的本地主机的默认站点“Reporting”下的应用程序中,端点是:

    http://(localhost)/Reporting/ReportingService.svc

  • 我为客户的C#解决方案创建了另一个项目。我添加了两个服务引用。一个用于发现服务项目以动态测试它。一经发布,另一个用于服务。我检查端点绑定,它们工作正常

  • 我在客户机上测试端点,它们在项目和发布引用的所有三种方法中都按预期工作。太好了

  • 我转到BIDS,在步骤5中为XML类型的连接设置一个端点为的数据源,并将其称为WCF数据源

  • 我想测试三种方法。当您添加一个参数时,我注意到您需要在放入数据集查询之前首先这样做,所以我使用最后两个参数来完成。前两个有效第三个无效:

    < Query>
    < Method Name="GetStatesTable" Namespace="http://tempuri.org/">
    < /Method>
    < SoapAction>
    http://tempuri.org/IReportingService/GetStatesTable
    </SoapAction>
    </Query>
    
    < Query>
    < Method Name="GetStateLike" Namespace="http://tempuri.org/">
    < Parameters>
    <Parameter Name="state">
    </Parameter>
    </Parameters>
    </Method>
    < SoapAction>
    http://tempuri.org/IReportingService/GetStateLike
    </SoapAction>
    </Query>
    
    < Query>
    < Method Name="GetMonthlyData" Namespace="http://tempuri.org/">
    < Parameters>
    < Parameter Name="aStart"></Parameter>
    < Parameter Name="aEnd"></Parameter>
    </Parameters>
    </Method>
    < SoapAction>
    http://tempuri.org/IReportingService/GetMonthlyData
    </SoapAction>
    </Query>
    
    
    
    
    
    http://tempuri.org/IReportingService/GetStatesTable
    
    
    <参数>
    
    http://tempuri.org/IReportingService/GetStateLike
    
    
    <参数>
    
    
    
    http://tempuri.org/IReportingService/GetMonthlyData
    

  • 第三个给出了关于数据类型的错误,它无法对数据类型System.DataTime实现“4/1/2013”。我需要进行故障排除,但不确定从何处开始测试。非常感谢您的帮助。

    好吧,我的答案有点站不住脚,不是我想要的,但它很有效。我将GetMonthly的签名改为接受字符串输入。然后我将它们转换为方法主体中的日期时间。似乎我可以在SSRS中验证一个合法的DateTime,作为WCF服务在XML中识别为文本的参数。因此,对合法日期的错误检查是在SSRS上进行的,但字符串将转换为.NET System.DateTime。我真的不喜欢这个答案,但它是有效的

    public List<fMonthly_Result> GetMonthlyData2(string aStart, string aEnd)
    {
        using (SSRSReportsEntities re = new SSRSReportsEntities())
        {
            DateTime dstart = DateTime.Parse(aStart);
            DateTime dend = DateTime.Parse(aEnd);
    
            return re.fMonthly(dstart, dend, null).ToList();
        }
    }
    
    public List getmonthlydata(字符串aStart,字符串aEnd)
    {
    使用(ssrsreportsenties re=new ssrsreportsenties())
    {
    DateTime dstart=DateTime.Parse(aStart);
    DateTime dend=DateTime.Parse(aEnd);
    返回re.fMonthly(dstart,dend,null).ToList();
    }
    }
    
    现在,只要我先输入参数并将其映射到报表项目中定义的现有参数,这将起作用:

    < Query>
    < Method Name="GetMonthlyData" Namespace="http://tempuri.org/">
    < Parameters>
    < Parameter Name="aStart"></Parameter>
    < Parameter Name="aEnd"></Parameter>
    </Parameters>
    </Method>
    < SoapAction>
    http://tempuri.org/IReportingService/GetMonthlyData
    </SoapAction>
    </Query>
    
    
    
    <参数>
    
    
    
    http://tempuri.org/IReportingService/GetMonthlyData