簡體   English   中英

客戶端發現響應內容類型為“”,但預期為'text / xml'。請求失敗,響應為空

[英]Client found response content type of " but expected 'text/xml' The request failed with an empty response

當傳遞請求以獲取響應並得到錯誤時,我已經在Windows應用程序中消耗了Web服務。

我已經使用WSE 2.0來傳遞憑據。

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

誰能幫幫我嗎?

嘗試設置ContentType

objReq.ContentType = "text/xml";

假設您正在使用HttpWebRequest ..

當報表服務器路徑不正確時,通常會發生這種錯誤。 仔細檢查您的ReportServerUrl

另請參閱報告查看器錯誤消息“客戶端找到的響應內容類型為”,但預期為'text xml'。請求失敗,響應為空。”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM