WebSphere Integration Developer 7下开发一个Hello World ESB Java Service
来源:互联网 发布:More 查看sql文件乱码 编辑:程序博客网 时间:2024/05/17 03:06
本文总结了在WebSphere Integration Developer 7下开发一个Hello World ESB Java Service的过程。
第1步 - 创建ESB Java service
1.1) 在WebSphere Integration Developer 7.0 workspace中, 切换到Business Integration Perspective.
1.2) 从文件菜单中, 选择File - New - Module, 输入HelloWorldServiceModule为Module名, 然后点击Finish.
1.3) 在HelloWorldServiceModule工程下, 右键点击Interfaces, 然后选择New - Integerface, 使用HelloWorldInterface为interface名称, 然后点击Finish.
1.4) 在interface编辑器中, 右键点击然后选择Add Request Response Operation, 使用hello为operation名称, 使用message为输入名称,response为输出名称, 两种同为string类型. 保存所有文件.
1.5) 切换到Assembly Editor, 从Palette中拖拉一个Java部件到Assembly Editor中, 命名为HelloWorldService.
1.6) 右键点击HelloWorldService, 然后选择Add - Interface, 选择HelloWorldInterface.
1.7) 右键HelloWorldService 然后选择Generate Implementation, 新建一个java packagedemo.
1.8) 切换到HelloWorldServiceImpl Java编辑器, 使用以下代码实现hello方法, 保存文件.
/** * Method generated to support implementation of operation "hello" defined for WSDL port type * named "HelloWorldInterface". * * Please refer to the WSDL Definition for more information * on the type of input, output and fault(s). */public String hello(String message) {return "Hello:" + message;}
1.9) 切换到Assembly Editor, 从Palette中拖拉一个References部件到Assembly Editor中.
1.10) 右键点击Stand-alone References, 然后选择Add Reference, 选择HelloWorldInterface
1.11) 连接Stand-alone References到HelloWorldService, 保存文件.
第2步 - 创建ESB客户端
2.1) 切换到Java EE perspective.
2.2) 右键点击HelloWorldServiceModuleWeb工程, 选择New - JSP, 命名为client.jsp, 点击Finish.
2.3) 在client.jsp中使用以下代码, 保存文件.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ page import="com.ibm.websphere.sca.*,commonj.sdo.DataObject" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><body><%String serviceOutput = "N/A";String message = request.getParameter("message");if(message != null){try{ServiceManager serviceManager = new ServiceManager();Service service = (Service) serviceManager.locateService("HelloWorldInterfacePartner");DataObject respObject = (DataObject) service.invoke("hello", message);serviceOutput = respObject.getString("response");}catch(Exception e){e.printStackTrace();}}%>Service Output : <%= serviceOutput %><form method="post"><input type="text" NAME="message"/><input TYPE="submit" /></form></body></html>
第3步 - 测试运行程序
3.1) 切换到Business Integration Perspective, 右键点击HelloWorldServiceModule, 选择Export和Integration modules and libraries -Files for server deployment
3.2) 将生成的EAR文件部署到Websphere Process Server上.
3.3) 使用浏览器访问client.jsp以测试该应用.
- WebSphere Integration Developer 7下开发一个Hello World ESB Java Service
- 使用WebSphere Integration Developer 7开发Business Integration Hello World应用程序
- WebSphere Integration Developer 的SCA模块开发
- websphere Integration Developer
- 使用Mule Studio开发ESB应用 - Hello World
- 应用Mule Studio开发ESB应用 - Hello World
- 使用Mule Studio开发ESB应用 - Hello World
- WebSphere Integration Developer 初步认识(转载)
- Web Service, Hello World
- Jbpm3.2 开发一个Hello World程序
- 开发一个应用程序的思路:"Hello World"
- 开发一个Windows版的hello world
- Struts2 开发一个简单的Hello World
- PHP 扩展开发 : 编写一个hello world !
- web service 对外发布一个hello world接口(入门)
- web service 对外发布一个hello world接口(入门)
- 使用java写一个hello world
- 使用 WebSphere Integration Developer 公开 DB2 Version 9 pureXML
- Oracle数据库中序列(SEQUENCE)的用法详解
- 有限产能与无限产能
- 怎样让新建的Answer必须对某个字段进行过滤?
- 2012-06-21
- ecshop缩略图模糊不清以及产品页图模糊不清的方法
- WebSphere Integration Developer 7下开发一个Hello World ESB Java Service
- 关于 matlab 标定工具箱的使用
- tinyMCE编辑器用法
- Android JNI知识简介
- 交换两个变量的值,不使用第三个变量
- 交通系统的学习
- 把当前目录和子目录下的java文件,从GBK转换成UTF-8字符集的shell脚本
- 哈希表
- php memcache访问数据库