Topic
4 replies Latest Post - ‏2013-04-05T11:28:55Z by SystemAdmin
SystemAdmin
SystemAdmin
217 Posts
ACCEPTED ANSWER

Pinned topic Cognos Migration (java SDK) from 8.3 to 10.2 - API details needed

‏2013-04-02T13:38:43Z |
Hi All,

I'm working on cognos report migration from 8.3 to 10.2 (java SDK platform).

Code Snippet for your reference: (existing 8.3 code)
ReportServiceResponse res = null;
try {
res = cognosReportNetPort.execute( reportSearchPath, parameterValues, runOptions );
if (!res.getStatus().equals(AsynchStatusEnum.complete)){
while (!res.getStatus().equals(AsynchStatusEnum.complete) && !res.getStatus().equals(AsynchStatusEnum.responseReady)){
res = cognosReportNetPort.wait(res.getPrimaryRequest());
}
if (res != null){
res = cognosReportNetPort.getOutput(res.getPrimaryRequest());
}
}
} catch (RemoteException e) {
m_objLog.error(bwContext, EVENTS.ADHOC, "Error in execute report in method executeReportByReportNet: " + getMessage());
return false;
}
String reportOutPath = res.getOutputObjects()[0].getSearchPath().getValue();

Need to know the exact API that replace the 'cognosReportNetPort' in cognos 10.3 which has the above methods execute, wait , getOutput.
Please respond if you know any details regarding this. If anyone done this before, please share me the code.

Breaking my head for more than a week to resolve this :( Appreciate your help on this.
Updated on 2013-04-05T11:28:55Z at 2013-04-05T11:28:55Z by SystemAdmin
  • BirajSaha
    BirajSaha
    11 Posts
    ACCEPTED ANSWER

    Re: Cognos Migration (java SDK) from 8.3 to 10.2 - API details needed

    ‏2013-04-03T12:21:54Z  in response to SystemAdmin
    Have you tried "com.cognos.developer.schemas.bibus._3.ReportService_PortType.run(SearchPathSingleObject, ParameterValue], Option[)"?
    • SystemAdmin
      SystemAdmin
      217 Posts
      ACCEPTED ANSWER

      Re: Cognos Migration (java SDK) from 8.3 to 10.2 - API details needed

      ‏2013-04-03T13:36:30Z  in response to BirajSaha
      Yes. We have tried with this only and getting the attached error message when we hit the webservice for the second time. Could you please check and help us.
      • arturr
        arturr
        12 Posts
        ACCEPTED ANSWER

        Re: Cognos Migration (java SDK) from 8.3 to 10.2 - API details needed

        ‏2013-04-03T16:26:03Z  in response to SystemAdmin
        Did you follow the general rules for migration to 10.1.0 ?
        They can be found in the SDK Developers Guide, installed in <c10>\webcontent\documentation\en\dg_sdk.pdf, chapter 10, pg. 140.

        You will find a list of changes needed to be done during the migration, but the most importan one is:
        Response biBusHeader SOAP Header copying/clearing
        In an application using the Axis 1.1 toolkit, the code to retrieve the biBusHeader from a response used to look like this:
        
        BiBusHeader bibus = (BiBusHeader) ((Stub)cmService).getHeaderObject(
        "", 
        "biBusHeader");
        


        or by:
        
        SOAPHeaderElement bibus = getServiceContext().getImplicitHeader(
        "http://developer.cognos.com/schemas/bibus/3/", 
        "biBusHeader"));
        


        Clearing the header was done with a method like this:
        
        ((Stub)cmService).getServiceContext().clearHeaders();
        


        The approach for retrieving the bibusheader now changes to code like this:
        
        
        
        import org.apache.axis.client.Stub;   
        
        private 
        
        static 
        
        final String BIBUS_NS = 
        "http://developer.cognos.com/schemas/bibus/3/"; 
        
        private 
        
        static 
        
        final String BIBUS_HDR = 
        "biBusHeader"; 
        
        private 
        
        static 
        
        final QName BUS_QNAME = 
        
        new QName(BIBUS_NS, BIBUS_HDR);   
        //NOTE the namespace string must be filled in correctly when getting/setting the biBusHeader object.   BiBusHeader bibus = (BiBusHeader)((Stub)repService).getResponseHeader(
        "http://developer.cognos.com/schemas/bibus/3/", 
        "biBusHeader").getValueAsType(BUS_QNAME);   ((Stub)repService).clearHeaders(); ((Stub)repService).setHeader(
        "http://developer.cognos.com/schemas/bibus/3/", 
        "biBusHeader", bibus);
        


        Clearing the header changes to:
        
        ((Stub)cmService).clearHeaders();
        

        More you can find in the SDK samples located in <c10>\sdk\java

        The method proposed in the post from BirajSaha substitutes the cognosReportNet method used to execute the report.
  • SystemAdmin
    SystemAdmin
    217 Posts
    ACCEPTED ANSWER

    Re: Cognos Migration (java SDK) from 8.3 to 10.2 - API details needed

    ‏2013-04-05T11:28:55Z  in response to SystemAdmin
    Hi, Thanks for replying.
    The same method only we used and got that exception.

    Please check the below snippet code and let me know if i miss any

    if (asyncReply.getStatus() != AsynchReplyStatusEnum.complete || asyncReply.getStatus() != AsynchReplyStatusEnum.conversationComplete) {
    while (asyncReply.getStatus() != AsynchReplyStatusEnum.complete && asyncReply.getStatus() != AsynchReplyStatusEnum.conversationComplete) {
    if (hasSecondaryRequest(asyncReply, "wait")) {
    asyncReply = reportService.wait(asyncReply.getPrimaryRequest(),new ParameterValue] {}, new Option[ {});
    }

    private static boolean hasSecondaryRequest(AsynchReply response, String secondaryRequest) {

    // TODO Auto-generated method stub

    AsynchSecondaryRequest[] secondaryRequests = response.getSecondaryRequests();
    if (secondaryRequests != null) {
    for (int i = 0; i < secondaryRequests.length; i++) {
    if (secondaryRequests[i].getName().compareTo(secondaryRequest) == 0) {
    return true;
    }
    }
    }
    return false;

    }

    Getting the attached error message (in the last post) while it is waiting in the wait method.

    Thanks for your help in advance!!!

    Regards,
    M.Shylaja