ABAP和Java的destination和JNDI
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:
要獲取更多Jerry的原創技術文章,請關注公眾號"汪子熙"或者掃描下面二維碼:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2154398/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- JNDI注入和JNDI注入Bypass
- ABAP和Java的tag(marker) interfaceJava
- Java和ABAP裡的外部類和內部類Java
- ABAP和Java單例模式的攻防Java單例模式
- ABAP和Java SpringBoot的單元測試JavaSpring Boot
- ABAP SICF服務和Java Servlet的比較JavaServlet
- ABAP和Java的單元測試Unit TestJava
- SAP ABAP和Java的動態代理實現Java
- SAP ABAP ADBC和Java JDBC的使用比較JavaJDBC
- Java的位元組碼和ABAP load的比較Java
- JAVA JNDI學習Java
- Java之JNDI注入Java
- 淺談Java和SAP ABAP的靜態代理和動態代理,以及ABAP面向切面程式設計的嘗試Java程式設計
- Java安全之JNDI注入Java
- java JNDI 注入學習Java
- 你真的會用ABAP, Java和JavaScript裡的constructor麼?JavaScriptStruct
- SAP Business Application Studio和SAP雲平臺DestinationAPP
- Java的Covariance設計原理和SAP ABAP的模擬實現Java
- JavaScript和ABAP的尾遞迴JavaScript遞迴
- ABAP Netweaver 和 ABAP Platform 這兩個名詞的辨析Platform
- Standard ABAP Debugger 和 Classic ABAP Debugger 的實現差異
- SAP UI5應用訪問OData metadata的url和DestinationUI
- ABAP Netweaver和git的快捷方式Git
- SAP ABAP SQL的execution plan和cacheSQL
- ABAP, Maven, CF App和Webpack的buildMavenAPPWebUI
- ABAP和Hybris的原始碼生成工具原始碼
- ABAP的HTTP_GET和Linux的curlHTTPLinux
- 使用ABAP(ADBC)和Java(JDBC)連線SAP HANA資料庫JavaJDBC資料庫
- SAP ABAP和Hybris Commerce的Sample資料
- SAP ABAP Netweaver和Hybris Commerce的部署策略
- ABAP mesh表示式, JavaScript和Scala的 expressionJavaScriptExpress
- ABAP webdynpro的view navigation和WebUI的view navigationWebViewNavigationUI
- ABAP 真的會過時嗎?聊聊 ABAP 的過去,現在和未來
- ABAP, UI5和webpack的處理入口UIWeb
- 使用 ABAP 事物碼 SM59 建立 Destination 來讀取外網的資料試讀版
- 熟悉個jndi的概念
- ABAP和Java裡關於DEFAULT(預設)機制的一些語言特性Java
- SAP ABAP MIME Repository 和 API 介紹API