cancel
Showing results for 
Search instead for 
Did you mean: 

The constructor HttpRequestSender(URL, String, String) is deprecated

Former Member
0 Kudos

Dear All,

I have just written a small program using NWDS (Netweaver developer Studio). The code includes the following line:-

HttpRequestSender requestSender = new HttpRequestSender(url,"user1","abc");

The program has the following imports:-

import com.sap.lcr.api.cimclient.CIMClient;

import com.sap.lcr.api.cimclient.CIMOMClient;

import com.sap.lcr.api.cimclient.ClientFactory;

import com.sap.lcr.api.cimclient.HttpRequestSender;

import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;

import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;

import com.sap.mw.jco.JCO;

import com.tssap.dtr.client.lib.protocol.URL;

I get the following error when I build the project:-

The constructor HttpRequestSender(URL, String, String) is deprecated

Can anyone kindly tell me why I am getting this message and how to resolve it?

Kind Regards

Chris Jackson

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jackson,

I think deprecated error means the method signature what you have given is valid with a older version of JDK and not compatible with the JDK that is configured in your NWDS to compile all programs.

Try to compile your program with the JDK where this method signature the class HttpRequestSender with the format you have specified is valid.

I think you can set the JDK for compiling in windows--> Preferences in your IDE.

Try this, might help.

Akshatha

Former Member
0 Kudos

Hi Akshatha,

Thanks for that. By the way, I am now trying to compile the following .java program.....

/*

  • Created on 01-Oct-2007

*

  • To change the template for this generated file go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

/**

  • @author chris.jackson

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

import com.sap.lcr.api.cimclient.CIMClient;

import com.sap.lcr.api.cimclient.CIMClientHandle;

import com.sap.lcr.api.cimclient.CIMOMClient;

import com.sap.lcr.api.cimclient.ClientFactory;

import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestination;

import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;

import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;

import com.sap.mw.jco.JCO;

import com.tssap.dtr.client.lib.protocol.URL;

public class sldpoke {

public void main() {

ClientFactory factory = ClientFactory.newInstance();

try {

final URL url = new URL("http://ex1d002a.eu.unilever.com:58300/sld/cimom");

String sldUsername = "cjacks01";

String sldPassword = "password";

CIMOMClient cimomClient = factory.createClient (url, sldUsername, sldPassword);

CIMClient cc = new CIMClient(cimomClient);

CIMClientHandle cch = (CIMClientHandle) cc;

SAP_JCODestinationAccessor jcoAccessor = new SAP_JCODestinationAccessor(cc);

SAP_JCODestination[] jcoDestinations = jcoAccessor.enumerateSAP_JCODestinationInstances();

JCO.Client jcoClient = null;

String user = null;

String pwd = null;

// iterate over all destinations

for (int i = 0; i < jcoDestinations.length; i++)

{

SAP_JCODestination jcoDestination = jcoDestinations;

user = jcoDestination.getLogonUser();

pwd = jcoDestination.getLogonPwd();

if (jcoDestination instanceof SAP_AppServJCODestination)

{

SAP_AppServJCODestination jcoDest = (SAP_AppServJCODestination) jcoDestination;

jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),

user,

pwd,

jcoDest.getLogonLanguage(),

jcoDest.getAppServHost(),

jcoDest.getAppServNumber());

}

else if (jcoDestination instanceof SAP_MsgServJCODestination)

{

SAP_MsgServJCODestination jcoDest = (SAP_MsgServJCODestination) jcoDestination;

jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),

user,

pwd,

jcoDest.getLogonLanguage(),

jcoDest.getMsgServHost(),

jcoDest.getSAPSystemName(),

jcoDest.getLogonGroup());

}

}

} catch (Exception e) {

}

}

}

and I am getting the message "The selection does not contain a main type". Any ideas how I progress?

Kind Regards

Chris Jackson.

Answers (0)