1.1 發佈webservice 服務

在官網看的例子,自己實現了一下,大概流程寫了出來,僅供參考。

開發工具:AnypointStudio


1、創建服務接口

[java]
  1. package com.zhongguo.service; import javax.jws.WebService; @WebService public interface HelloWorldInf {     public String sayHello(String name); }

2、創建其實現類

[java]
  1. package com.zhongguo.service; import javax.jws.WebService; @WebService(endpointInterface = "org.example.HelloWorld",               serviceName = "HelloWorld") public class HelloWorldImp implements HelloWorldInf {     @Override     public String sayHello(String name) {                  return "你好"+name;     }
     }

3、配置flow

[html]
  1. <?xmlversionxmlversion="1.0"encoding="UTF-8"?>  
  2.    
  3.       <mulexmlnsmulexmlns="http://www.mulesoft.org/schema/mule/core"  
  4.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5.    xmlns:http="http://www.mulesoft.org/schema/mule/http"  
  6.    xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"  
  7.    xsi:schemaLocation="  
  8.    http://www.mulesoft.org/schema/mule/corehttp://www.mulesoft.org/schema/mule/core/current/mule.xsd  
  9.    http://www.mulesoft.org/schema/mule/httphttp://www.mulesoft.org/schema/mule/http/current/mule-http.xsd  
  10.    http://www.mulesoft.org/schema/mule/cxfhttp://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd">  
  11.    <http:listener-confignamehttp:listener-configname="listener-config"host="localhost"port="63081"/>  
  12.    <http:listener-config name="listener-config" host="localhost" port="63081" doc:name="HTTP Listener Configuration"/>  
       <flow name="helloService2">  
       <http:listener config-ref="listener-config" path="/hello" doc:name="HTTP"/>  
       <cxf:jaxws-service serviceClass="com.atdoulian.service.HelloWorldInf" doc:name="CXF"/>  
       <component class="com.atdoulian.service.HelloWorldImp" doc:name="Java"/>  
       </flow>

  13.    </mule>  


4、測試

在瀏覽器上輸入

http://localhost:63081/hello?wsdl




發佈了25 篇原創文章 · 獲贊 5 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章