2

I have consumed the web service in windows application, when pass the request to get response getting an error.

I have used WSE 2.0 to pass the credentials.

public string GetResponse(string sPersonnelAreaCode, string sCompanyCode)
{
    try
    {
        WebReference.RIL_STAR_HCM_QueryEmployeeDetails_serviceagent objService1 = new WebReference.RIL_STAR_HCM_QueryEmployeeDetails_serviceagent();
        WebReference.fetchEmployeeListRequestEmployeeList[] objReqs = new WebReference.fetchEmployeeListRequestEmployeeList[1];
        WebReference.fetchEmployeeListRequestEmployeeList objReq1 = new WebReference.fetchEmployeeListRequestEmployeeList();

        WebReference.fetchEmployeeListResponseEmployeeList[] objResponse = new WebReference.fetchEmployeeListResponseEmployeeList[0];
        DataSet dsresult = new DataSet();
        objReq1.PersonnelAreaCode = sPersonnelAreaCode;
        objReq1.CompanyCode = sCompanyCode.ToString();

        UsernameToken token = new UsernameToken("***", "***", PasswordOption.SendPlainText);
        objService1.RequestSoapContext.Security.Tokens.Add(token);
        objReqs[0] = objReq1;
        //In the below line getting that error
        objResponse = objService1.fetchEmployeeList(objReqs);
    }
}

Can anyone please help me?

Dmitry
  • 13,797
  • 6
  • 32
  • 48
user3852537
  • 21
  • 1
  • 1
  • 2

2 Answers2

3

This kind of error usually comes when the report server path is not proper. Double check your ReportServerUrl

Also refer Report viewer Error message "client found response content type of '' but expected 'text xml' The request failed with an empty response."

Community
  • 1
  • 1
LCJ
  • 22,196
  • 67
  • 260
  • 418
2

Try setting the ContentType:

objReq.ContentType = "text/xml";

Assuming you're using HttpWebRequest..

DGibbs
  • 14,316
  • 7
  • 44
  • 83