博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ABAP和Java的destination和JNDI
阅读量:6909 次
发布时间:2019-06-27

本文共 2073 字,大约阅读时间需要 6 分钟。

Netweaver里使用事务码SM59创建Destination:

Java

新建一个destination:

测试代码:

try {            Context ctx = new InitialContext();            ConnectivityConfiguration configuration = (ConnectivityConfiguration) ctx.lookup("java:comp/env/connectivityConfiguration");            DestinationConfiguration destConfiguration = configuration.getConfiguration(destinationName);            if (destConfiguration == null) {                response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,                        String.format("Destination %s is not found. Hint:"                                + " Make sure to have the destination configured.", destinationName));                return;            }            // Get the destination URL            String value = destConfiguration.getProperty("URL");            URL url = new URL(value + "xml?origins=Walldorf&destinations=Paris");            String proxyType = destConfiguration.getProperty("ProxyType");            Proxy proxy = getProxy(proxyType);            urlConnection = (HttpURLConnection) url.openConnection(proxy);            injectHeader(urlConnection, proxyType);            // Copy content from the incoming response to the outgoing response            InputStream instream = urlConnection.getInputStream();            OutputStream outstream = response.getOutputStream();            copyStream(instream, outstream);        } catch (Exception e) {            // Connectivity operation failed            String errorMessage = "Connectivity operation failed with reason: "                    + e.getMessage()                    + ". See "                    + "logs for details. Hint: Make sure to have an HTTP proxy configured in your "                    + "local environment in case your environment uses "                    + "an HTTP proxy for the outbound Internet "                    + "communication.";            LOGGER.error("Connectivity operation failed", e);            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,                    errorMessage);        }

通过JNDI获得destination配置的url:

转载地址:http://ywwcl.baihongyu.com/

你可能感兴趣的文章
斐波那契数列
查看>>
Codeforces 534B - Covered Path
查看>>
AJAX 一些常用方法
查看>>
使用ifstream和getline读取文件内容[c++]
查看>>
洛谷 P2391 白雪皑皑(并查集)
查看>>
修改dedecms中某个页面ueditor的宽度
查看>>
String为什么要设置成Final类型
查看>>
paper
查看>>
生成XML文件,并保存到本地文件
查看>>
[TUTORIAL]How to setup SP_Flash_Tool_Linux (MTK/MediaTek Soc)
查看>>
[C++]const、typedef联合使用注意
查看>>
JavaScript引用类型之Array数组的栈方法与队列方法
查看>>
银行转账亲测
查看>>
上海租房攻略
查看>>
【Python爬虫学习笔记3】requests库
查看>>
Spring boot(四)Spring Boot 集成 MyBatis
查看>>
win7重装系统
查看>>
转:【高并发简单解决方案】redis缓存队列+mysql 批量入库+php离线整合
查看>>
列表和屏幕的相互调用之从列表调用屏幕
查看>>
loadrunner-2-13错误处理函数
查看>>