使用Mule发布Web Service服务
来源:互联网 发布:肖像权网络侵权管辖 编辑:程序博客网 时间:2024/05/20 01:10
一、编写接口代码
1
package
cn.com.songjy.mule;
2
3
public
interface
IHelloWord {
4
5
String hello(String name);
6
7
}
二、编写接口实现类代码
1
package
cn.com.songjy.mule;
2
3
public
class
HelloWord
implements
IHelloWord {
4
5
public
String hello(String name) {
6
return
"你好:"
+ name +
",现在的时间是:"
+
new
java.util.Date();
7
}
8
9
}
三、编写mule配置文件【mule-config.xml】,路径是在classpath根目录下,即平常的src目录中
01
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
02
03
<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
04
"http://mule.mulesource.org/dtds/mule-configuration.dtd">
05
<
mule-configuration
id
=
"Ws-adapter"
version
=
"1.0"
>
06
<
model
name
=
"helloTest"
>
07
<
mule-descriptor
name
=
"helloService"
implementation
=
"cn.com.songjy.mule.HelloWord"
>
08
<
inbound-router
>
09
<
endpoint
address
=
"axis:http://localhost:8281/services"
></
endpoint
>
10
</
inbound-router
>
11
<
properties
>
12
<
list
name
=
"serviceInterfaces"
>
13
<
entry
value
=
"cn.com.songjy.mule.IHelloWord"
/>
14
</
list
>
15
</
properties
>
16
</
mule-descriptor
>
17
</
model
>
18
</
mule-configuration
>
四、编写发布Web Service接口代码
01
package
cn.com.songjy.mule;
02
03
import
org.mule.config.ConfigurationException;
04
import
org.mule.config.builders.MuleXmlConfigurationBuilder;
05
06
public
class
PublicServer {
07
08
/**
09
* create on 2013-5-27 下午2:01:15 by songjy
10
* @param args
11
*/
12
public
static
void
main(String[] args) {
13
try
{
14
MuleXmlConfigurationBuilder xmlConfiguration =
new
MuleXmlConfigurationBuilder();
15
xmlConfiguration.configure(
"mule-config.xml"
);
16
}
catch
(ConfigurationException e) {
17
e.printStackTrace();
18
}
19
20
}
21
22
}
五、运行测试
在浏览器中输入http://localhost:8281/services/helloService?wsdl 即可看到效果。
示例代码:http://yunpan.cn/QeKkjgcum4dKp
Java使用XFire调用WebService接口:
http://www.cnblogs.com/simle/archive/2011/10/31/2230091.html
0 0
- 使用Mule发布Web Service服务
- web service 初识 axis (二) 使用wsdd发布服务
- 用tomcat 发布mule 服务
- MULE ESB发布CXF服务
- 使用cxf发布Web Service
- 使用Axis发布Web Service
- 使用JAXR发布Web服务
- 用tomcat 发布mule 服务 (转)
- 用tomcat 发布mule 服务 (转)
- Mule ESB 3.8版本,发布webservice 服务
- 架构Web Service:描述与注册,发布Web服务
- mule 基于wsdl调用cxf web service
- Web service的使用与发布
- 使用JAX-WS发布RESTful Web Service
- 使用.net如何发布web service
- 发布使用SSL的Web Service
- 发布使用SSL的Web Service
- 9.Web Service Spring整合CXF之发布服务
- 【问题解决】用户登录问题
- 水仙花数
- presentModalViewController deprecated in ios6
- 各个开放平台的灵异事件
- 使用eagle导出国内PCB制板商可用的gerber文件
- 使用Mule发布Web Service服务
- 多项式求和
- JavaScript中0, "", null, false, undefined的区别
- Spring AOP支持的AspectJ切入点指示符
- oracle执行计划说明
- 英文RouterOS秒变中文版
- iOS开发运用之A星(A*)寻路算法
- 关于c++的多继承(有关接口)
- 关于我和我的网站