ABAP和Java的destination和JNDI

发布时间:2019-11-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了ABAP和Java的destination和JNDI脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

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

ABAP和Java的destination和JNDI

Java

新建一个destination:

ABAP和Java的destination和JNDI

ABAP和Java的destination和JNDI

测试代码:

 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:

ABAP和Java的destination和JNDI

脚本宝典总结

以上是脚本宝典为你收集整理的ABAP和Java的destination和JNDI全部内容,希望文章能够帮你解决ABAP和Java的destination和JNDI所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。