Topic
  • 1 reply
  • Latest Post - ‏2014-06-13T13:27:58Z by arturr
EH30_Maheswaran_Thangavel
1 Post

Pinned topic Mashup Service (CMS) - Problem in passing parameter to Report

‏2014-04-01T09:39:07Z | (cms) - in mashup parameter passing problem report service to

Hi,

Our requirement is that, need to pull the data from Cognos report server (Middle layer) as Data Set format and bind them into C# grid.

I got the CMS samples from SDK folder. I could get the data from Cognos Report without parameter, but when I use with parameter I am getting below error

I've pasted code below. Please suggest.

Error:

{System.Web.Services.Protocols.SoapException: RDS-ERR-1021 The IBM Cognos report "storeID("i56BCF8774D7B4C0899B911117B2340BC")" could not be run because it contains unanswered prompts. Please provide the prompt answers, and run the report again.
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at CMSCommon.CCS_Generic.ReportDataService.getOutput(GetOutputRequest GetOutputRequest) in C:\working\Cognos samples\samples\sdk\cms_samples\csharp\CMSCommon\Web References\CCS_Generic\Reference.cs:line 193
   at DBTRACE.MISReports.Client.Cognos.genericAuthentication.getReportOutput() in C:\Projects\MIS Reports\dbTRACE.MISReports\Cognos\genericAuthentication.cs:line 135}

 

C# Code:

 

private void btnGenerate_Click(object sender, RoutedEventArgs e)
        {
            MISReports.Client.Cognos.genericAuthentication cgauth = new DBTRACE.MISReports.Client.Cognos.genericAuthentication();
            cgauth.nameSpace = "namespace";
            cgauth.userName = "user";
            cgauth.passWord = "pwd";
           
            cgauth.reportID = "iD97B1A484C1045A79B27AC34C85DBBF4";

            cgauth.url = "http://localhost/ibmcognos/cgi-bin/cognos.cgi";
            string s = cgauth.getReportOutput();
            DataSet ds = new DataSet();
            ds.ReadXml("reportOutput.xml");

            Tradegrid.DataSource = ds.Tables[1].AsEnumerable().Select(n => n).ToList();
            Tradegrid.Visibility = System.Windows.Visibility.Visible;
        }

 

publicStringgetReportOutput()

{

 

if(nameSpace.Equals("")||userName.Equals("")||reportID.Equals(""))

{

result = "Please make sure you have input all the text field ...";

returnresult;

}

 

try

{

//User credentials are passed to the IBM Cognos server

AuthServiceauthService = newAuthService();

authService.Url = url;

LogonRequestTypeauthRequest = newLogonRequestType();

authRequest.credentials = newCredentialType();

authRequest.credentials.credentialElements = newCredentialElementType[3];

authRequest.credentials.credentialElements[0] = newCredentialElementType();

authRequest.credentials.credentialElements[0].name = "CAMNamespace";

authRequest.credentials.credentialElements[0].value = newValueElementType();

authRequest.credentials.credentialElements[0].value.Item = nameSpace;

authRequest.credentials.credentialElements[1] = newCredentialElementType();

authRequest.credentials.credentialElements[1].name = "CAMUsername";

authRequest.credentials.credentialElements[1].value = newValueElementType();

authRequest.credentials.credentialElements[1].value.Item = userName;

authRequest.credentials.credentialElements[2] = newCredentialElementType();

authRequest.credentials.credentialElements[2].name = "CAMPassword";

authRequest.credentials.credentialElements[2].value = newValueElementType();

authRequest.credentials.credentialElements[2].value.Item = passWord;

LogonResponseTypeauthResp = authService.logon(authRequest);

//A report instance is created. The authentication credentials are passed to the service

ReportDataServicesvc = newReportDataService();

svc.biBusHeaderValue = newCMSCommon.CCS_Generic.biBusHeader();

svc.biBusHeaderValue.Any = authService.biBusHeaderValue.Any;

svc.Url = url;

 

GetReportDataRequestrequest = newGetReportDataRequest();

request.sourceID = reportID;

//equest.promptValues[]

request.sourceType = SourceTypeEnum.report;

 

PromptValue[] pvalue = newPromptValue[1];

PValueArrayItem[] pvalItm = newPValueArrayItem[1];

SimplePValuespval = newSimplePValue();

spval.displayValue = "ABS Secondary";

spval.useValue = "ABS Secondary";

pvalItm[0] = newPValueArrayItem();

pvalItm[0].Item = spval;

spval.inclusive = true;

//spval.useValue = "ABS Secondary";

PValueArraypvalArr = newPValueArray();

pvalArr.item = pvalItm;

pvalue[0] = newPromptValue();

pvalue[0].name = "Desk";

pvalue[0].values = pvalArr;

request.promptValues = pvalue;

 

request.format = "DataSet";

 

GetOutputResponseresponse = svc.getReportData(request);

//This is an asynchronous request, the application loops until the report output is returned

while(response.session.status == SessionTypeStatus.working)

{

GetOutputRequestwaitRequest = newGetOutputRequest();

waitRequest.session = response.session;

response = svc.getOutput(waitRequest);

}

//Retrieve the LDX output of a given report and save it to a XML file called "reportOutput.xml"

 

result = response.output.Item asString;

result = result.Trim();

System.IO.StreamWriterwriter = newSystem.IO.StreamWriter("reportOutput.xml");

writer.Write(result);

writer.Flush();

writer.Close();

System.Console.WriteLine("Output written to reportOutput.xml");

 

 

//The user is logged off

LogoffRequestTypelogoffRequest = newLogoffRequestType();

logoffResponseTypelogoffResp = authService.logoff(logoffRequest);

}

catch(System.Web.Services.Protocols.SoapExceptionex)

{

if(ex.Detail != null)

{

if(ex.Detail.FirstChild.LocalName == "CCSPromptFault")

{

System.Console.WriteLine(ex.ToString());

return"Please make sure the report ID is correct ...";

}

elseif(ex.Detail.FirstChild.LocalName == "CCSAuthenticationFault")

{

System.Console.WriteLine(ex.ToString());

return"Login Failed. Please try again.";

}

elseif(ex.Detail.FirstChild.LocalName == "CCSGeneralFault")

{

System.Console.WriteLine(ex.ToString());

return"Please make sure the report ID is correct ...";

}

else

{

return(ex.Message);

}

}

else

{

System.Console.WriteLine("ERROR: "+ ex.Message);

return(ex.Message);

}

 

}

returnresult;

 

}

 

 

  • arturr
    arturr
    12 Posts

    Re: Mashup Service (CMS) - Problem in passing parameter to Report

    ‏2014-06-13T13:27:58Z  

    does your report (defined by that storeID) require prompts?