locked
Reporting Services: XML Data Source and Parameters RRS feed

  • Question

  • I’ve created an XML service (asmx) in ASP.Net that I want to use as a data source for an SQL Reporting Services report. The report and service work just fine if I use a Method from the service that does not have parameters. However, if I use a Method that needs a parameter, the query/report fails. My investigation makes it seem that the parameter is not getting passed to the Method at all. (The parameter is a DateTime and it always ends up uninitialized and the WebMethod throws an exception.)

    I’ve exhausted all my TechNet resources and Googled this excessively. It would seem that I am doing this correctly, based on all the examples I’ve seen, but I still can’t get it to work.

    I've done a lot of different permutations, but this is where I’m at right now. (Note: I've changed the Web Method's parameter to be a String instead of a DateTime. I did this as part of my trial-and-error process. Once I get this figured I'll return it to a DateTime.)

    I'm trying to include everything here that will help you help me (see attached image). I had to obfuscate a few things (not sure if that is necessary).

    See attached image:

    1. Created Shared Data Source in SQL Report Services
    2. Create Report Parameter (matching Web Method parameter)
    3. Created a data set in Report Builder (with Query, and parameter - matching Web Method parameter)

    Query in Data Source

    <Query>
    	<Method Name="GetDueDateAging" Namespace="http://zzz.com/vvv">
    		<Parameters>
    			<Parameter Name="cutoffDate">
    				<DefaultValue></DefaultValue>
    			</Parameter>
    		</Parameters>
    	</Method>
    	<SoapAction>http://zzz.com/vvv/GetDueDateAging</SoapAction>
    	<ElementPath IgnoreNamespaces="true">*</ElementPath>
    </Query>

    This is where I needed the most help, and I don't totally understand it. But again, the parameter-less Method worked. I've tried adding different things in the <DefaultValue> tag (like @cuttoffDate and constant values), with no success.

    WebMethod Code

            [WebMethod]
            public List<AgingInvoice> GetDueDateAging(string cutoffDate)
            {
                DateTime cd = DateTime.MinValue;
    
                if (!DateTime.TryParse(cutoffDate, out cd))
                {
                    cd = DateTime.Now;
                }
    
                Shared.DueDateAging aging = new Shared.DueDateAging();
                return aging.GetDueDateAging(cd, Settings.Default.ConnectionString);
    
            }

    I've looked at every online resource that I could find, but I'm striking out right now. Any help or hints would be greatly appreciated.

    Thanks.

    Derrick


    Thursday, March 6, 2014 7:39 PM

Answers

  • Hi Derrick,

    In your case, please refer to the following method to troubleshooting this problem:

    We can use Fiddler2 to monitor the HTTP post, and check whether the parameter is being sent. The Fiddler tool can helps us debug web applications by capturing network traffic between the Internet and test computers. If the parameter is being sent, please debug the web service to ensure the method has values return.

    Regards,
    Alisa Tang


    Alisa Tang
    TechNet Community Support

    • Proposed as answer by Alisa Tang Tuesday, March 18, 2014 9:37 AM
    • Marked as answer by Alisa Tang Tuesday, March 18, 2014 9:37 AM
    Monday, March 10, 2014 12:36 PM