Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find symbol method getResponseHeader(java.lang.String,java.lang.String)

 
Davidson Rajapal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I have the following code. When I execute it is throwing this Error "cannot find symbol method getResponseHeader".. Can you Please help me to solve this Error. I have pointed all the below jar files but still Error exists.

commons-httpclient-3.0.1.jar
commons-httpclient.jar
commons-httpclient-3.1-rc1.jar
httpclient-4.1.1.jar
org.apche.commons.httpclient.jar


Code:-

public class try2
{

private static String nameSpaceID = "cogndvldap";
private static String userName = "worknjn";
private static String password = "layuin";
public ContentManagerService_Port cmService;
private static String reportSearchPath1 = "/content/package[@name='Z_USHH ROME Inventory Reporting']/folder[@name='USHH']/folder[@name='USHH - ROME']/report[@name='ROME Literature Spreadsheet']";
private static String saveLocation1 = "C:/Report";
public ReportService_Port reportService = null;

public static void main(String args[])
{
try
{

try2 mainClass = new try2(); // instantiate the class

// Step 1: Connect to the Cognos services
mainClass.connectToCognos(dispatcherURL);

// Step 2: Logon to Cognos
mainClass.logonToCognos(nameSpaceID, userName, password);


}
catch(Exception e)
{
}
}


public void connectToCognos(String dispatcherURL)
{
ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();


try
{

cmService = cmServiceLocator.getcontentManagerService(new java.net.URL("http://cog8dv01.merck.com:26423/p2pd/servlet/dispatch/"));
}

catch (Exception e)
{
e.printStackTrace();
}
}

// Step 2: Logon to Cognos

public void logonToCognos(String nsID, String user, String pswd)
{
StringBuffer credentialXML = new StringBuffer();
credentialXML.append("<credential>");
credentialXML.append("<namespace>").append(nsID).append("</namespace>");
credentialXML.append("<username>").append(user).append("</username>");
credentialXML.append("<password>").append(pswd).append("</password>");
credentialXML.append("</credential>");

String encodedCredentials = credentialXML.toString();
XmlEncodedXML xmlCredentials = new XmlEncodedXML();
xmlCredentials.setValue(encodedCredentials);

try
{
cmService.logon(xmlCredentials, null);
SOAPHeaderElement temp = ((Stub)cmService).getResponseHeader("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader");
BiBusHeader CMbibus = (BiBusHeader)temp.getValueAsType(new QName ("http://developer.cognos.com/schemas/bibus/3/","biBusHeader"));
((Stub)cmService).setHeader("http://developer.cognos.com/schemas/bibus/3/","biBusHeader", CMbibus);
}

catch (Exception ex)
{
ex.printStackTrace();
}
}


}

Error:-

C:\Program Files\Java\jdk1.6.0_27\bin>javac try2.java
try2.java:240: cannot find symbol
symbol : method getResponseHeader(java.lang.String,java.lang.String)
location: class com.cognos.org.apache.axis.client.Stub
SOAPHeaderElement temp = ((Stub)cmService).getResponseHeader("ht
tp://developer.cognos.com/schemas/bibus/3/", "biBusHeader");
^
1 error
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the error message says that this class: com.cognos.org.apache.axis.client.Stub is the one which doesn't have that method. It's pretty clear that the class came from cognos.com, not from Apache. You should look in one of Cognos's jars if you want to find that class. Or better still, read their documentation.
 
Davidson Rajapal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried by changing the Header file from "com.cognos.org.apache.axis.client.Stub" to "org.apache.axis.client.Stub"
but I am receiving this below New Error

Error:-

C:\Program Files\Java\jdk1.6.0_27\bin>java try2
java.lang.ClassCastException: com.cognos.developer.schemas.bibus._3.ContentManag
erServiceStub cannot be cast to org.apache.axis.client.Stub
at try2.logonToCognos(try2.java:242)
at try2.main(try2.java:189)

Can you please help me to solve this Error.
 
Michael Mann
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Imho is this still the same "core" problem you already had in that track:
http://www.coderanch.com/t/557573/java/Java-Code-throwing-NoSuchField-Error.

By the way, because of that this is not a java in general problem, it's still a cognos
problem and you should have posted it in the forum you posted your first problem.
Ask an admin to move it to that forum.

For me the problem is still the same, that you're using a code sample designed for cognos 10
with your cognos 8 api and jars. The only possibilty to guess which methods
in cognos 10 correspond to api methods in cognos 8 is using a javadoc of both versions.
Do you have that? And even with that it's not a trivial task.
So my suggestion is also still the same: Send a mail to the author of your code sample (the ibm guy) and ask him
if he can help you.
He should have the api documentation and the skill to help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic