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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ABAP和Java的tag(marker) interfaceJava
- Java和ABAP裡的外部類和內部類Java
- ABAP和Java單例模式的攻防Java單例模式
- SAP ABAP和Java的動態代理實現Java
- ABAP SICF服務和Java Servlet的比較JavaServlet
- ABAP和Java的單元測試Unit TestJava
- ABAP和Java SpringBoot的單元測試JavaSpring Boot
- SAP ABAP ADBC和Java JDBC的使用比較JavaJDBC
- ABAP, Java和JavaScript三種語言的比較JavaScript
- Java的位元組碼和ABAP load的比較Java
- 淺談Java和SAP ABAP的靜態代理和動態代理,以及ABAP面向切面程式設計的嘗試Java程式設計
- Java之JNDI注入Java
- 你真的會用ABAP, Java和JavaScript裡的constructor麼?JavaScriptStruct
- Java安全之JNDI注入Java
- java JNDI 注入學習Java
- JavaScript和ABAP的尾遞迴JavaScript遞迴
- Java的Covariance設計原理和SAP ABAP的模擬實現Java
- ABAP Netweaver 和 ABAP Platform 這兩個名詞的辨析Platform
- ABAP, Maven, CF App和Webpack的buildMavenAPPWebUI
- SAP ABAP SQL的execution plan和cacheSQL
- ABAP和Hybris的原始碼生成工具原始碼
- ABAP mesh表示式, JavaScript和Scala的 expressionJavaScriptExpress
- ABAP Netweaver和git的快捷方式Git
- ABAP的HTTP_GET和Linux的curlHTTPLinux
- 使用ABAP(ADBC)和Java(JDBC)連線SAP HANA資料庫JavaJDBC資料庫
- Standard ABAP Debugger 和 Classic ABAP Debugger 的實現差異
- ABAP, UI5和webpack的處理入口UIWeb
- SAP Business Application Studio和SAP雲平臺DestinationAPP
- 如何在java類中呼叫websphere中的jndi物件JavaWeb物件
- ABAP和Java裡關於DEFAULT(預設)機制的一些語言特性Java
- SAP UI5應用訪問OData metadata的url和DestinationUI
- SAP ABAP和Hybris Commerce的Sample資料
- JavaScript, ABAP和Scala裡的尾遞迴(Tail Recursion)JavaScript遞迴AI
- ABAP webdynpro的view navigation和WebUI的view navigationWebViewNavigationUI
- null in ABAP and nullpointer in JavaNullJava
- SAP ABAP MIME Repository 和 API 介紹API
- ABAP CHECKBOX 和LISTBOX使用指南
- ABAP的include關鍵字,Java的import, C的include和C4C ABSL 的import比較JavaImport