简体   繁体   English

如何在Netweaver上使用JCo3创建自定义目标(使用我自己的服务器名,客户端,用户名等)?

[英]How to create customize destination(with my own server name, client, username, ect) using JCo3 on Netweaver?

Since Netweaver ship with its own DestinationDataProvider, we can't register our own customized destination data provider. 由于Netweaver附带了自己的DestinationDataProvider,因此我们无法注册自己的自定义目标数据提供程序。 Does means we have to use the Netweaver's destination manager to define a destination and use it in our application? 是否意味着我们必须使用Netweaver的目标管理器来定义目标并将其在我们的应用程序中使用? Is there a way to connect to any SAP server and create our own destination without using the Netweaver's destination manager? 有没有一种方法可以连接到任何SAP服务器并创建我们自己的目标,而无需使用Netweaver的目标管理器?

The way this is done in JCO 3 is slightly different. 在JCO 3中完成此操作的方式略有不同。 The idea is create Properties & place from where it can be retrieved (flat file, ldap etc) and then retrieve the same when you want to connect to a sap server. 这个想法是创建可以从中检索属性和位置(平面文件,ldap等)的地方,然后在要连接到sap服务器时检索它们。

// So you First use the following code to create the connection parameters //因此,您首先使用以下代码创建连接参数

    static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
    static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
    static
    {
        Properties connectProperties = new Properties();
        connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "sap.dsc.com");
        connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,  "76");
        connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
        connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "dsc007");
        connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "passwd");
        connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
        createDestinationDataFile(DESTINATION_NAME1, connectProperties);
        connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
        connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,    "10");
        createDestinationDataFile(DESTINATION_NAME2, connectProperties);

    }

     static void createDestinationDataFile(String destinationName, Properties connectProperties)
    {
        File destCfg = new File(destinationName+".jcoDestination");
        try
        {
            FileOutputStream fos = new FileOutputStream(destCfg, false);
            connectProperties.store(fos, "for tests only !");
            fos.close();
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unable to create the destination files", e);
        }
    }

// The following code snippet can then be used elsewhere to connect to the sap server //然后,以下代码段可在其他地方使用以连接到sap服务器

    static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
    static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";

    public static void step1Connect() throws JCoException
   {
        JCoDestination destination =     JCoDestinationManager.getDestination(DESTINATION_NAME1);
        System.out.println("Attributes:");
        System.out.println(destination.getAttributes());
        System.out.println();
    }

You have to use NetWeaver's Destination Service. 您必须使用NetWeaver的目标服务。 Either create the RFC destinations via the NetWeaver Admin UI or programmatically via the offered APIs for managing the destination configurations. 通过NetWeaver Admin UI创建RFC目标,或者通过提供的用于管理目标配置的API以编程方式创建RFC目标。 Nevertheless, you can also create JCoCustomDestination instances based on the JCoDestination instances retrieved from the JCoDestinationManager . 不过,你也可以创建JCoCustomDestination基于实例JCoDestination从检索到的实例JCoDestinationManager

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM