加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Mule ESB 3.8版本,发布webservice 服务

发布时间:2020-12-16 22:09:43 所属栏目:安全 来源:网络整理
导读:在官网看的例子,自己实现了一下,大概流程写了出来,仅供参考。 开发工具:AnypointStudio 1、创建服务接口 package org.example; importjavax.jws.WebService; @WebServicepublicinterfaceHelloWorld { StringsayHi(String text);} 2、创建其实现类 packag

在官网看的例子,自己实现了一下,大概流程写了出来,仅供参考。

开发工具:AnypointStudio


1、创建服务接口

package org.example;
 
importjavax.jws.WebService;
 
@WebService
publicinterfaceHelloWorld {
    StringsayHi(String text);
}


2、创建其实现类

package org.example;
import javax.jws.WebService;
@WebService(endpointInterface = "org.example.HelloWorld",serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld {
	public String sayHi(String text) {
     return "Hello " + text;
   }
}

3、配置flow

<?xmlversion="1.0"encoding="UTF-8"?>
 
      <mulexmlns="http://www.mulesoft.org/schema/mule/core"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:http="http://www.mulesoft.org/schema/mule/http"
   xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
   xsi:schemaLocation="
   http://www.mulesoft.org/schema/mule/corehttp://www.mulesoft.org/schema/mule/core/current/mule.xsd
   http://www.mulesoft.org/schema/mule/httphttp://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
   http://www.mulesoft.org/schema/mule/cxfhttp://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd">
   <http:listener-configname="listener-config"host="localhost"port="63081"/>
   <flowname="helloService">
   <http:listenerconfig-ref="listener-config"path="hello"/>
   <cxf:jaxws-serviceserviceClass="org.example.HelloWorld"/>
   <componentclass="org.example.HelloWorldImpl"/>
   </flow>
   </mule>


4、测试

在浏览器上输入

http://localhost:63081/hello?wsdl




5、如有差错,欢迎批评指正?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读