Topic
  • 4 replies
  • Latest Post - ‏2013-05-15T16:31:56Z by sbmsbm
mgibson
mgibson
5 Posts

Pinned topic Cognos Mashup Service Authentication Issues / Advice

‏2012-04-03T03:51:23Z |
Hi, we are attempting to utilise the Cognos Mashup Service SOAP API within a PHP page to return objects from a Report Studio report (eg. a Table or Chart object), but are experiencing difficulty and are looking for advice.

We are attempting to do this with Cognos version 10.1.1 installed on Linux.

In our implementation, the SOAP client seems to fail to authenticate as it always return “missingValue” on username and password.

It also generates unknown errors when trying to retrieve the report information – typing the REST URL in browser works fine on the other hand, eg.

http://www.mydomain.com/cognos/cgi-bin/cognos.cgi/rds/pagedReportData/report/i74604A90FF184231894B509C2D9AC9EA

We’re wondering if we did something wrong in the code here and looking for advice on how to progress with this issue?

The code is as follow:



// Get Authenticated $authUrl   = 
"http://www.mydomain.com/cognos/cgi-bin/cognos.cgi/rds/auth/wsdl"; $auth            = array( 
'credentials' => array( 
'credentialElements' => array( 
'name'      => 
'CAMNamespace', 
'value'     => array(
'actualValue' => $nspace), ), 
'credentialElements' => array( 
'name'      => 
'CAMUsername', 
'value'     => array(
'actualValue' => $user), ), 
'credentialElements' => array( 
'name'      => 
'CAMPassword', 
'value'     => array(
'actualValue' => $pass), ), ) ); $authclient      = 

new SoapClient($authUrl); $access          = $authclient->logon($auth); echo 
'<pre>'; var_dump($access); echo 
'</pre>';     
// Get Report $soapUrl   = 
"http://www.mydomain.com/cognos/cgi-bin/cognos.cgi/rds/wsdl"; $param           = array( 
'sourceID'        => 
'i74604A90FF184231894B509C2D9AC9EA', 
'sourceType'      => 
'report', );   $client          = 

new SoapClient($soapUrl); $result          = $client->GetReportData($param); echo 
'<pre>'; var_dump($result); echo 
'</pre>';


Results:

object(stdClass)#2 (2) 
{ [
"responseCode"]=> string(8) 
"NO_ERROR" [
"result"]=> object(stdClass)#3 (1) 
{ [
"credentialPrompt"]=> object(stdClass)#4 (1) 
{ [
"credentialElements"]=> array(4) 
{ [0]=> object(stdClass)#5 (2) 
{ [
"name"]=> string(12) 
"CAMNamespace" [
"value"]=> object(stdClass)#6 (1) 
{ [
"actualValue"]=> string(2) 
"DU" 
} 
} [1]=> object(stdClass)#7 (3) 
{ [
"name"]=> string(23) 
"CAMNamespaceDisplayName" [
"label"]=> string(10) 
"Namespace:" [
"value"]=> object(stdClass)#8 (1) 
{ [
"actualValue"]=> string(21) 
"Active Directory - DU" 
} 
} [2]=> object(stdClass)#9 (3) 
{ [
"name"]=> string(11) 
"CAMUsername" [
"label"]=> string(8) 
"User ID:" [
"value"]=> object(stdClass)#10 (1) 
{ [
"missingValue"]=> object(stdClass)#11 (1) 
{ [
"valueType"]=> string(4) 
"text" 
} 
} 
} [3]=> object(stdClass)#12 (3) 
{ [
"name"]=> string(11) 
"CAMPassword" [
"label"]=> string(9) 
"Password:" [
"value"]=> object(stdClass)#13 (1) 
{ [
"missingValue"]=> object(stdClass)#14 (1) 
{ [
"valueType"]=> string(10) 
"textnoecho" 
} 
} 
} 
} 
} 
} 
}   Fatal error: Uncaught SoapFault exception: [Server] The server did something wrong in /var/www/html/cognos/soap.php:45 Stack trace: #0 /var/www/html/cognos/soap.php(45): SoapClient->__call(
'GetReportData', Array) #1 /var/www/html/cognos/soap.php(45): SoapClient->GetReportData(Array) #2 
{main
} thrown in /var/www/html/cognos/soap.php on line 45


Any advice?
Updated on 2012-04-10T21:35:01Z at 2012-04-10T21:35:01Z by SystemAdmin
  • BirajSaha
    BirajSaha
    11 Posts

    Re: Cognos Mashup Service Authentication Issues / Advice

    ‏2012-04-10T18:02:39Z  
    Hi there,

    Yes it definitely seemed as if the logon failed. I don't know php at all (and will try to find an "expert" and forward this question to them) but the code seems fine, I'm presuming that the value for $nspace specified in the logon is "OU" (ie the ID and not the display name).

    One more thing: If you haven't done so already please consult the Cognos Mashup Service Developer's guide (particularly Chapter 5), which is available via the Cognos SDK installation.

    I would personally (given that I don't know much about php) start with checking the cogserver.log on the server (in the "logs" folder), and perhaps need to increment the logging level on "Report Data Service" from "Minimal" to "Request", and re-run the case.

    Can you please re-run the case and attach the cogserver log (or at least relevant excerpts)? We may need to procure further logs (CAM-AAA perhaps) but it's a good way to check.

    Thanks.
  • SystemAdmin
    SystemAdmin
    217 Posts

    Re: Cognos Mashup Service Authentication Issues / Advice

    ‏2012-04-10T19:21:16Z  
    • BirajSaha
    • ‏2012-04-10T18:02:39Z
    Hi there,

    Yes it definitely seemed as if the logon failed. I don't know php at all (and will try to find an "expert" and forward this question to them) but the code seems fine, I'm presuming that the value for $nspace specified in the logon is "OU" (ie the ID and not the display name).

    One more thing: If you haven't done so already please consult the Cognos Mashup Service Developer's guide (particularly Chapter 5), which is available via the Cognos SDK installation.

    I would personally (given that I don't know much about php) start with checking the cogserver.log on the server (in the "logs" folder), and perhaps need to increment the logging level on "Report Data Service" from "Minimal" to "Request", and re-run the case.

    Can you please re-run the case and attach the cogserver log (or at least relevant excerpts)? We may need to procure further logs (CAM-AAA perhaps) but it's a good way to check.

    Thanks.
    Cognos URL/REST requests will not work without setting the cookies it needs in the HTTP request. This can come through the browser (client side) or the socket (server side).

    To get the cookies, you can copy them out from the BiBus header using the java/.net api (server) or read them from the browser (client).

    From PHP, you should auth on the client using form posts or a REST call which follows the CMS javascript samples ( C:\Program Files\IBM\cognos\c10XXX\webcontent\samples\sdk\cms\authentication) shown below. If you want to follow-up with a server-side REST call, copy the cookies from the browser into the socket connection.

    The standard auth providers do not read usernam/password cookies directly, although a custom security provider could read such cookies as well as any other cookie token/nonce. However, CMS provides a method to shove credential cookies into a client side AJAX call, which will set Cognos session cookies upon completion.

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <!--
    Licensed Materials - Property of IBM

    IBM Cognos Products: DOCS

    (C) Copyright IBM Corp. 2008, 2010

    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
    Schedule Contract with IBM Corp.
    -->
    <!--
    * reportOutput.html
    *
    * Description: This file allows the user to pass the user credentials to IBM Cognos server,
    * retrieve the given report HTMLFragment output, and display report output.
    */
    -->
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Generic Authentication Sample</title>
    <script>

    var myNameSpace=null;
    var myUserName=null;
    var myPassword=null;

    /*
    * This creates the XMLHttpRequest object used to communicate with CMS.
    * The initialization of the object depends on what browser is being used. This
    * code is compatible with IE 5.5, 6, 7, 8 and all versions of Firefox and Chrome
    *
    * For more information on the XMLHttpRequest object, see http://www.w3.org/TR/XMLHttpRequest/
    */
    try {
    var objXHR = new XMLHttpRequest();
    } catch (e) {
    try {
    var objXHR = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e) {
    try {
    var objXHR = new ActiveXObject('Microsoft.XMLHTTP');
    } catch (e) {
    alert('XMLHttpRequest not supported'); }
    }
    }

    /*
    * Starts running a given report asynchronously, using the storeID in the reportID form field.
    * The DIV named fragment will be updated with the HTMLFragment recieved from CMS, and will be
    * also used to display a status message while the report is running.
    * The function callBack() will be called periodically by the XMLHttpRequest
    * object as it runs, and when the report is complete.
    *
    * The CMS URL syntax used is as follows:
    * http:<cognos gateway>/rds/pagedReportData/report/<storeID of the report>?fmt=HTMLFragment&version=LATEST
    *
    * The fmt=HTMLFragment option tells CMS to generate an HTML fragment
    * The version=LATEST option tells CMS to use the last saved version of a report, or run it if none is available
    *
    * For more information on the CMS URL syntax, see "Chapter 6: Developing Mashup Applications using
    * the REST Interface" in the IBM Cognos Mashup Service Developer Guide
    */
    function doReport()
    {

    myNameSpace=document.getElementById("nameSpace").value;
    myUserName=document.getElementById("userName").value;
    myPassword=document.getElementById("password").value;
    var myReportID=document.getElementById("storeID").value;

    var myFrag = document.getElementById("fragment");

    if(myNameSpace==""||myUserName==""||myPassword=="")
    {
    myFrag.innerHTML="";
    myFrag.innerHTML= "<HTML><BODY><b>Please enter Authentication information ....</b></BODY></HTML>";
    return;
    }

    if(myReportID=="")
    {
    myFrag.innerHTML="";
    myFrag.innerHTML= "<HTML><BODY><b>Please enter the Report ID ....</b></BODY></HTML>";
    return;
    }

    var url = parent.settings.document.getElementById("serverURL").value + "/rds/pagedReportData/report/" + document.getElementById("storeID").value + "?fmt=HTMLFragment&version=LATEST";

    window.status = "Loading Report. Please wait....";
    var frag = document.getElementById("fragment");
    frag.innerHTML= "<HTML><BODY>Loading Report. Please wait....</BODY></HTML>";
    try
    {
    objXHR.open("GET", url, true);
    objXHR.onreadystatechange = callBack;
    objXHR.send(null);
    }
    catch (e)
    {
    alert("Error occurs when doing report.\r\n"+e);
    }

    }
    /*
    * Logs into IBM Cognos Service using Mashup Service (CMS) Authentication Service
    * Sends the login request synchronously.
    *
    */
    function doLogon()
    {

    var xmlData =
    "xmlData=<auth:credentials xmlns:auth='http://developer.cognos.com/schemas/ccs/auth/types/1'>"
    +"<auth:credentialElements><auth:name>CAMNamespace</auth:name>"
    +"<auth:value><auth:actualValue>"myNameSpace"</auth:actualValue></auth:value></auth:credentialElements>"
    +"<auth:credentialElements><auth:name>CAMUsername</auth:name>"
    +"<auth:value><auth:actualValue>"myUserName"</auth:actualValue></auth:value></auth:credentialElements>"
    +"<auth:credentialElements><auth:name>CAMPassword</auth:name>"
    +"<auth:value><auth:actualValue>"myPassword"</auth:actualValue></auth:value></auth:credentialElements>"
    +"</auth:credentials>";

    try
    {
    objXHR.open("POST", parent.settings.document.getElementById("serverURL").value + "/rds/auth/logon", false);
    objXHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    objXHR.setRequestHeader("Content-length",xmlData.length);
    objXHR.setRequestHeader("Connection","close");
    objXHR.send(xmlData);

    if(objXHR.status == 200)
    {

    // Processes the response from the CMS Authentication service.
    // If we recieve an "accountInfo" element back, we have successfully logged in.
    var accountInfo = objXHR.responseXML.getElementsByTagName("auth:accountInfo");

    if (accountInfo.length > 0)
    {
    doReport();
    }
    else
    {
    //Otherwise, prompt error message
    alert("Error occurs when doing logon. Please check input credentials.");

    return;
    }
    }
    else
    {
    showError(objXJR.responseText);
    window.status = "Done";
    }
    }
    catch (e)
    {
    alert("Error occurs when doing logon.\r\n"+e);
    }

    }
    /*
    * Displays an error message in a DIV
    *
    */
    function showError(msg)
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML= "Complete";
    frag.style.visibility = "hidden";
    frag = document.getElementById("error")
    frag.innerHTML= msg;
    frag.style.visibility = "visible";
    }
    /*
    * Logs off IBM Cognos Service using Mashup Service (CMS) Authentication Service
    *
    */
    function doLogoff()
    {
    try
    {
    objXHR.open("POST", parent.settings.document.getElementById("serverURL").value + "/rds/auth/logoff", false);
    objXHR.send(null);
    checkLogoffStatus();
    }
    catch (e)
    {
    alert("Error occurs when doing logoff.\r\n"+e);
    }
    }
    /*
    * When readyState=4 and the HTTP status code of 200 are returned. CMS successfully logs off IBM Cognos Server.
    *
    */
    function checkLogoffStatus()
    {
    if(objXHR.readyState == 4 && objXHR.status == 200)
    {
    window.status = "Successfully log off IBM Cognos Service.";
    }
    else
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    alert("HTTP ERROR " + objXHR.status + ": " + objXHR.statusText);
    window.status = "Done";
    }
    }
    /*
    * This method is called when the states changes in the XMLHttpRequest object. When readyState=4,
    * the XMLHttpRequest object has finished sending and receiving the request.
    *
    * If the HTTP status code of 200 is returned, CMS successfully ran the report and the DIV is updated with
    * the HTML fragment.
    *
    * If the HTTP status code of 403 is returned, Authentication is required and the logon dialog will be displayed.
    *
    * For any other HTTP status code (generally an error), an alert box will display the status code and message
    */
    function callBack()
    {
    if (objXHR.readyState == 4)
    {

    if (objXHR.status == 200)
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    window.status = "Done";

    }
    else if (objXHR.status == 403)
    {
    doLogon();
    }
    else
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    alert("HTTP ERROR " + objXHR.status + ": " + objXHR.statusText);
    window.status = "Done";
    }
    }
    }
    </script>
    </head>
    <body style="font-family: Verdana, Arial, Sans-Serif; font-weight: normal">
    <table align="center" width="95%"
    style="border-bottom-style: solid; border-top-style: solid; border-left-color: #004080; border-top-color: #004080; border-right-color: #004080; border-left-style: solid; border-right-style: solid; border-bottom-color: #004080; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin">
    <thead>
    <tr>
    <td
    style="text-align: center; color: #FFFFFF; font-weight: bold; background-color: #0080C0">CMS
    Authentication Sample</td>
    </tr>
    </thead>
    <tr>
    <td>
    <table width="100%">
    <td align="left" width="60%">
    Name Space:  <input type="text" size="40", id="nameSpace">

      User Name:  <input type="text" size="40", id="userName">

        Password:  <input type="password" size="40", id="password">

        Report ID:  <input size="40" id="storeID">

    </td>
    <td align="left" width="40%">
    <input type="submit" value="Report Output" onClick="doReport()">

    <input type="submit" id="logoff" value="Logoff from IBM Cognos Server" onclick="doLogoff()">
    </td>
    </table>
    </td>
    </tr>
    <tr>
    <td
    style="border-top-style: dashed; border-top-color: #000000; border-top-width: medium; border-bottom-style: dashed; border-bottom-width: medium; border-bottom-color: #000000"
    height="100%">
    Your report will appear here
    </td>
    </tr>
    </table>
    </body>
    </html>
  • SystemAdmin
    SystemAdmin
    217 Posts

    Re: Cognos Mashup Service Authentication Issues / Advice

    ‏2012-04-10T21:35:01Z  
    Cognos URL/REST requests will not work without setting the cookies it needs in the HTTP request. This can come through the browser (client side) or the socket (server side).

    To get the cookies, you can copy them out from the BiBus header using the java/.net api (server) or read them from the browser (client).

    From PHP, you should auth on the client using form posts or a REST call which follows the CMS javascript samples ( C:\Program Files\IBM\cognos\c10XXX\webcontent\samples\sdk\cms\authentication) shown below. If you want to follow-up with a server-side REST call, copy the cookies from the browser into the socket connection.

    The standard auth providers do not read usernam/password cookies directly, although a custom security provider could read such cookies as well as any other cookie token/nonce. However, CMS provides a method to shove credential cookies into a client side AJAX call, which will set Cognos session cookies upon completion.

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <!--
    Licensed Materials - Property of IBM

    IBM Cognos Products: DOCS

    (C) Copyright IBM Corp. 2008, 2010

    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
    Schedule Contract with IBM Corp.
    -->
    <!--
    * reportOutput.html
    *
    * Description: This file allows the user to pass the user credentials to IBM Cognos server,
    * retrieve the given report HTMLFragment output, and display report output.
    */
    -->
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Generic Authentication Sample</title>
    <script>

    var myNameSpace=null;
    var myUserName=null;
    var myPassword=null;

    /*
    * This creates the XMLHttpRequest object used to communicate with CMS.
    * The initialization of the object depends on what browser is being used. This
    * code is compatible with IE 5.5, 6, 7, 8 and all versions of Firefox and Chrome
    *
    * For more information on the XMLHttpRequest object, see http://www.w3.org/TR/XMLHttpRequest/
    */
    try {
    var objXHR = new XMLHttpRequest();
    } catch (e) {
    try {
    var objXHR = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e) {
    try {
    var objXHR = new ActiveXObject('Microsoft.XMLHTTP');
    } catch (e) {
    alert('XMLHttpRequest not supported'); }
    }
    }

    /*
    * Starts running a given report asynchronously, using the storeID in the reportID form field.
    * The DIV named fragment will be updated with the HTMLFragment recieved from CMS, and will be
    * also used to display a status message while the report is running.
    * The function callBack() will be called periodically by the XMLHttpRequest
    * object as it runs, and when the report is complete.
    *
    * The CMS URL syntax used is as follows:
    * http:<cognos gateway>/rds/pagedReportData/report/<storeID of the report>?fmt=HTMLFragment&version=LATEST
    *
    * The fmt=HTMLFragment option tells CMS to generate an HTML fragment
    * The version=LATEST option tells CMS to use the last saved version of a report, or run it if none is available
    *
    * For more information on the CMS URL syntax, see "Chapter 6: Developing Mashup Applications using
    * the REST Interface" in the IBM Cognos Mashup Service Developer Guide
    */
    function doReport()
    {

    myNameSpace=document.getElementById("nameSpace").value;
    myUserName=document.getElementById("userName").value;
    myPassword=document.getElementById("password").value;
    var myReportID=document.getElementById("storeID").value;

    var myFrag = document.getElementById("fragment");

    if(myNameSpace==""||myUserName==""||myPassword=="")
    {
    myFrag.innerHTML="";
    myFrag.innerHTML= "<HTML><BODY><b>Please enter Authentication information ....</b></BODY></HTML>";
    return;
    }

    if(myReportID=="")
    {
    myFrag.innerHTML="";
    myFrag.innerHTML= "<HTML><BODY><b>Please enter the Report ID ....</b></BODY></HTML>";
    return;
    }

    var url = parent.settings.document.getElementById("serverURL").value + "/rds/pagedReportData/report/" + document.getElementById("storeID").value + "?fmt=HTMLFragment&version=LATEST";

    window.status = "Loading Report. Please wait....";
    var frag = document.getElementById("fragment");
    frag.innerHTML= "<HTML><BODY>Loading Report. Please wait....</BODY></HTML>";
    try
    {
    objXHR.open("GET", url, true);
    objXHR.onreadystatechange = callBack;
    objXHR.send(null);
    }
    catch (e)
    {
    alert("Error occurs when doing report.\r\n"+e);
    }

    }
    /*
    * Logs into IBM Cognos Service using Mashup Service (CMS) Authentication Service
    * Sends the login request synchronously.
    *
    */
    function doLogon()
    {

    var xmlData =
    "xmlData=<auth:credentials xmlns:auth='http://developer.cognos.com/schemas/ccs/auth/types/1'>"
    +"<auth:credentialElements><auth:name>CAMNamespace</auth:name>"
    +"<auth:value><auth:actualValue>"myNameSpace"</auth:actualValue></auth:value></auth:credentialElements>"
    +"<auth:credentialElements><auth:name>CAMUsername</auth:name>"
    +"<auth:value><auth:actualValue>"myUserName"</auth:actualValue></auth:value></auth:credentialElements>"
    +"<auth:credentialElements><auth:name>CAMPassword</auth:name>"
    +"<auth:value><auth:actualValue>"myPassword"</auth:actualValue></auth:value></auth:credentialElements>"
    +"</auth:credentials>";

    try
    {
    objXHR.open("POST", parent.settings.document.getElementById("serverURL").value + "/rds/auth/logon", false);
    objXHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    objXHR.setRequestHeader("Content-length",xmlData.length);
    objXHR.setRequestHeader("Connection","close");
    objXHR.send(xmlData);

    if(objXHR.status == 200)
    {

    // Processes the response from the CMS Authentication service.
    // If we recieve an "accountInfo" element back, we have successfully logged in.
    var accountInfo = objXHR.responseXML.getElementsByTagName("auth:accountInfo");

    if (accountInfo.length > 0)
    {
    doReport();
    }
    else
    {
    //Otherwise, prompt error message
    alert("Error occurs when doing logon. Please check input credentials.");

    return;
    }
    }
    else
    {
    showError(objXJR.responseText);
    window.status = "Done";
    }
    }
    catch (e)
    {
    alert("Error occurs when doing logon.\r\n"+e);
    }

    }
    /*
    * Displays an error message in a DIV
    *
    */
    function showError(msg)
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML= "Complete";
    frag.style.visibility = "hidden";
    frag = document.getElementById("error")
    frag.innerHTML= msg;
    frag.style.visibility = "visible";
    }
    /*
    * Logs off IBM Cognos Service using Mashup Service (CMS) Authentication Service
    *
    */
    function doLogoff()
    {
    try
    {
    objXHR.open("POST", parent.settings.document.getElementById("serverURL").value + "/rds/auth/logoff", false);
    objXHR.send(null);
    checkLogoffStatus();
    }
    catch (e)
    {
    alert("Error occurs when doing logoff.\r\n"+e);
    }
    }
    /*
    * When readyState=4 and the HTTP status code of 200 are returned. CMS successfully logs off IBM Cognos Server.
    *
    */
    function checkLogoffStatus()
    {
    if(objXHR.readyState == 4 && objXHR.status == 200)
    {
    window.status = "Successfully log off IBM Cognos Service.";
    }
    else
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    alert("HTTP ERROR " + objXHR.status + ": " + objXHR.statusText);
    window.status = "Done";
    }
    }
    /*
    * This method is called when the states changes in the XMLHttpRequest object. When readyState=4,
    * the XMLHttpRequest object has finished sending and receiving the request.
    *
    * If the HTTP status code of 200 is returned, CMS successfully ran the report and the DIV is updated with
    * the HTML fragment.
    *
    * If the HTTP status code of 403 is returned, Authentication is required and the logon dialog will be displayed.
    *
    * For any other HTTP status code (generally an error), an alert box will display the status code and message
    */
    function callBack()
    {
    if (objXHR.readyState == 4)
    {

    if (objXHR.status == 200)
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    window.status = "Done";

    }
    else if (objXHR.status == 403)
    {
    doLogon();
    }
    else
    {
    var frag = document.getElementById("fragment");
    frag.innerHTML = objXHR.responseText;
    alert("HTTP ERROR " + objXHR.status + ": " + objXHR.statusText);
    window.status = "Done";
    }
    }
    }
    </script>
    </head>
    <body style="font-family: Verdana, Arial, Sans-Serif; font-weight: normal">
    <table align="center" width="95%"
    style="border-bottom-style: solid; border-top-style: solid; border-left-color: #004080; border-top-color: #004080; border-right-color: #004080; border-left-style: solid; border-right-style: solid; border-bottom-color: #004080; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin">
    <thead>
    <tr>
    <td
    style="text-align: center; color: #FFFFFF; font-weight: bold; background-color: #0080C0">CMS
    Authentication Sample</td>
    </tr>
    </thead>
    <tr>
    <td>
    <table width="100%">
    <td align="left" width="60%">
    Name Space:  <input type="text" size="40", id="nameSpace">

      User Name:  <input type="text" size="40", id="userName">

        Password:  <input type="password" size="40", id="password">

        Report ID:  <input size="40" id="storeID">

    </td>
    <td align="left" width="40%">
    <input type="submit" value="Report Output" onClick="doReport()">

    <input type="submit" id="logoff" value="Logoff from IBM Cognos Server" onclick="doLogoff()">
    </td>
    </table>
    </td>
    </tr>
    <tr>
    <td
    style="border-top-style: dashed; border-top-color: #000000; border-top-width: medium; border-bottom-style: dashed; border-bottom-width: medium; border-bottom-color: #000000"
    height="100%">
    Your report will appear here
    </td>
    </tr>
    </table>
    </body>
    </html>
    FWIW, check out the CMS Developer Guide, page 31 (dg_cms.pdf)

    JavaScript sample file locations
    The sample files are installed in subdirectories under the installation_location/webcontent/samples/
    sdk/cms directory. The contents of each folder are described in the table below.

    Folder Contents
    This sample program explores the Mashup Service atom feed for a report.

    atom
    This sample program displays an HTML Fragment of a given report by passing the user credentials to the IBM
    Cognos server.

    authentication
    This sample program traverses the Content Store and provides the URL to link to specific report parts.

    cmsExplorer
    This folder contains files common to all of the JavaScript sample programs.

    common
    drillDown This sample program runs a report and drills down.
    This sample program performs a drill through using the Mashup Service.

    drillThrough
    This sample program displays an HTML Fragment of a
    saved report.

    getSavedReport
    This sample program retrieve an HTML fragment for a report part, and shows how to use the bring up the
    standard IBM Cognos logon/logoff pages in a separate window.

    htmlAuthenticationPrompt
    This sample program displays an HTML Fragment of a given report and prompts the user using HTML prompting
    if required.

    htmlPromptValue
    json This sample program runs a report in JSON format.
    This sample program displays an HTML Fragment of a report part.

    selectReportPart
    This sample program retrieves a piece of the report using an XPath expression.
  • sbmsbm
    sbmsbm
    1 Post

    Re: Cognos Mashup Service Authentication Issues / Advice

    ‏2013-05-15T16:31:56Z  

    Hi all,

    Good to see someone using CMS with PHP, but unfortunatly no enough answer. We need help on the same subject. Is there a document or example as a best practice to using CMS SOAP API within PHP.

    Thanks.