djangojazz
djangojazz

Reputation: 13252

QUERY method of Soap request for SSRS and WCF testing

I am looking for a good testing tool for making Xml query requests and knowledge of how to use them with soap requests that return xml for SSRS.

I see some threads on testing SOAP requests for WCF services that recommended some products and someone mentioned 'WebServiceStudio' on codeplex: http://webservicestudio.codeplex.com/. The problem being that this tool seems to not work with making the 'xml request' portion directly. I am not certain if this syntax is just relegated to SSRS or is a part of the SOAP family so I am really looking for suggestions on where to start as well as it seems kind of crazy to think I can only test in Business Intelligence Development Studio, BIDS, by itself.

A little background of what has been done thus far:

  1. I created an entity model in .NET 4.5 using Entity Framework 5 in C# in a library project to keep it isolated for the model portion of the data.
  2. I then created an interface and implementation in a website WCF project to host using an basicHttpBinding as its' own project to keep it isolated from the model.
  3. I referenced the Entity Project in the Web Site project and return classes generated from the t4 template(*.tt = like a POCO class generator from my understanding)
  4. My implementation of the returns are as follows for testing, two table returns with one with a parameter in the signature, and a table function with two parameters that are 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();
        }
    }
    
  5. I Publish this to my local host on IIS 7.5 on Windows 7 Enterprise under an application to my default site called 'Reporting', the endpoint is:

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

  6. I created another project to my C# solution for the client. I add two service references. One for the discovery of the service project to test it on the fly. And another one for the service once published. I check the endpoint bindings and they work fine.

  7. I test the endpoints on the client and they all work as expected for all three methods on the project and publish references. Great.

  8. I go to BIDS and set up the a datasource with endpoint in step 5 for connection of type XML and call it WCF Datasource

  9. I want to test three methods. When you add a parameter I notice you need to do that first before you put in your dataset query so I do that with the last two. The first two work the third does not:

    < 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>
    

Third gives error about data type that it cannot implement '4/1/2013' to data type System.DataTime. I need to troubleshoot but am not sure where to start on testing. Any help is much appreciated.

Upvotes: 3

Views: 1747

Answers (1)

djangojazz
djangojazz

Reputation: 13252

Okay so my answer is a little lame and not what I wanted but it works. I changed the signature of my GetMonthly to accept inputs of strings instead. Then I convert them to DateTime in the method's body. It appears that I can validate a legitimate DateTime in SSRS as a parameter that as far as the WCF service recognizes in XML is text. Thus the fault checking for a legitimate date is on SSRS but the string will converted to the .NET System.DateTime. I really don't like this answer but it works.

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();
    }
}

Nowthis will work, provided I put in the parameters first and map them to existing Parameters defined in the Report Project:

< 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>

Upvotes: 1

Related Questions