views:

27

answers:

1

Hi,

I have a Web Service that i have created using C# and Visual Studio 2010. The definition is below.

[WebService(Namespace = "http://targetrocksoftware.org")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class GetAssessmentResults : System.Web.Services.WebService
{
    SchoolTestManagerDBContainer SchoolDB = new SchoolTestManagerDBContainer();

    [WebMethod]
    public XmlDocument GetAssessment(int assessmentid)
    {
        int intid = 88;
        Assessment a = SchoolDB.Assessments.SingleOrDefault(m=>m.Id == (int) intid);
        if (a != null)
        {
            MemoryStream ms = new MemoryStream();
            Test t = Test.GetTestStructure(a);
            t.SerializeTest(ms);
            ms.Seek(0, SeekOrigin.Begin);  //reset read pointer

            XmlDocument xd = new XmlDocument();
            xd.Load(ms);
            return xd;
        }
        else
            return null;
    }
}

it is very simple as you can see and it takes one parameter an integer which is the unique id of a table. No issues you would think. Everthing works except that when i call the web service from SSRS (either in local mode via ReportBuilder 2.0) or directly from the SSRS server, the parameter assessmentid is always 0.

The SSRS report calls the web service using the following query parameter in a dataset.

<Query xmlns="http://targetrocksoftware.org"&gt;
<ElementPath IgnoreNamespaces="True">
GetAssessmentResponse/GetAssessmentResult/Test
{
NumQuestions(integer),
nAnswered(integer),
Highest(float),
Lowest(float),
Median(float),
Mean(float),
Correct(integer),
Incorrect(integer),
KR20(float),
StandardDeviation(float),
Variance(float)
}
</ElementPath>
<SoapAction>
http://targetrocksoftware.org/GetAssessment&lt;/SoapAction&gt;
<Method Namespace="http://targetrocksoftware.org" Name="GetAssessmet">
<Parameters>
<Parameter Name="assessmentid">
<DefaultValue>88</DefaultValue>
</Parameter>
</Parameters>
</Method>
</Query>

Everyting seems to work except the assessmentid parameter is always 0. If I hard code an assessmentid that i know is in the db (in this case 88) the web service returns the correct Xml Document and the report renders perfectly.

But for the life of me i cannot get SSRS to pass the parameter correctly. I have used fiddler2 to look at the request which is copied below

POSThttp://192.168.2.10/WebServices/GetAssessmentResults.asmxHTTP/1.1
SOAPAction:
http://targetrocksoftware.org/GetAssessment`
Content-Type: text/xml
Host: 192.168.2.10
Content-Length: 280
Expect: 100-continue
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?>  
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;  
  <soap:Body>  
    <GetAssessmet xmlns="http://targetrocksoftware.org"&gt;  
      <assessmentid>88</assessmentid>  
    </GetAssessmet>  
  </soap:Body>  
</soap:Envelope>  

`

If i use a WebService Test Tool like soapUI to send a request to the service it works (e.g. assessmentid is sest to the value passed, 88). The only thing i can see that is different is that on the request that is sent from soapUI the parameter that is passed has a namespace qualifier. Cany anyone help me please. A netmon trace is included below, that shows the difference between the two requests. My basic question is how do you get ssrs to work (e.g. include the namepace in each part of the soap request (at least that is what i think is wrong:))

- Soap: xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tar="http://targetrocksoftware.org/"
- Envelope: <soapenv:Envelope>
+ STag: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tar="http://targetrocksoftware.org/"&gt;
+ Header: <soapenv:Header>
- Body: <soapenv:Body>
+ STag: <soapenv:Body>
- Node: XmlElement:<tar:GetAssessment>
+ STag: <tar:GetAssessment>
- Element: XmlElement:<tar:assessmentid> - 88
+ STag: <tar:assessmentid>
Content: 88
+ ETag: </tar:assessmentid>
+ ETag: </tar:GetAssessment>
+ ETag: </soapenv:Body>
+ ETag: </soapenv:Envelope>- Soap: xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tar="http://targetrocksoftware.org/"
- Envelope: <soapenv:Envelope>
+ STag: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tar="http://targetrocksoftware.org/"&gt;
+ Header: <soapenv:Header>
- Body: <soapenv:Body>
+ STag: <soapenv:Body>
- Node: XmlElement:<tar:GetAssessment>
+ STag: <tar:GetAssessment>
- Element: XmlElement:<tar:assessmentid> - 88
+ STag: <tar:assessmentid>
Content: 88
+ ETag: </tar:assessmentid>
+ ETag: </tar:GetAssessment>
+ ETag: </soapenv:Body>
+ ETag: </soapenv:Envelope>

Kevin

A: 

If anyone is interested i have solved this issue. Not in a good way, but it is solved. The solution was to start fresh and recreate a new webservice with the exact same functionality. The only difference is that now i have left the service namespace as the default http://tempuri.org. I am not sure why it fixed the issue but it did. If anyone can shed some light on it that would be great

Kevin

Kevin Koenig