1.概述
Web服务是ESB中间件的常见解决方案,它使得运行在不同机器上的不同应用无须借助附加的、专门的第三方软件或硬件,就可相互交换数据或集成。依据Web Service规范实施的应用之间,无论它们所使用的语言、平台或内部协议是什么,都可以相互交换数据。
AEAIESB提供了非常便捷的服务创建方式,本文档主要为读者介绍如何使用ESB来创建一个简单的Web服务接口。
2.样例
packagecom.aeai.demo.messageflows.helloworldsayhello;
importcom.agileai.esb.component.invoker.InvokerService;
importcom.agileai.esb.core.AdapteException;
import com.agileai.esb.core.AttributeMap;
importcom.aeai.demo.services.helloworld.SayHello;
importcom.aeai.demo.services.helloworld.SayHelloResponse;
public classJavaInvoker3 extends InvokerService{
publicSayHello getRequest(){
AttributeMap sourceReq =(AttributeMap)this.getMessageFlow().getRequest();
return(SayHello)sourceReq.get("soapReqObject");
}
publicSayHelloResponse getResponse(){
AttributeMap sourceRsp =(AttributeMap)this.getMessageFlow().getResponse();
return(SayHelloResponse)sourceRsp.get("soapRspObject");
}
publicvoid invoke() throws AdapteException{
String words =getRequest().getWords();
getResponse().setReturn("Say: " + words);
}
}
AEAI ESB-基于ESB的web服务开发文档 下载