在官网看的例子,自己实现了一下,大概流程写了出来,仅供参考。 开发工具:AnypointStudio 1、创建服务接口 package org.example; importjavax.jws.WebService; @WebServicepublicinterfaceHelloWorld { Stringsa
在官网看的例子,自己实现了一下,大概流程写了出来,仅供参考。
开发工具: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、如有差错,欢迎批评指正