天天看點

bbossgroups cxf Webservice服務管理架構

Bboss aop 框 架中很好地內建了 apache cxf webservice 服務架構,原理如下圖:

bbossgroups cxf Webservice服務管理架構
下面具體來介紹如果通過 bboss aop 架構來管理和釋出基于 apache cxf webservice 服務架構的 webservice 服務。

1.1     Webservice 協定配置

對應的配置檔案為:

/bbossaop/resources/org/frameworkset/spi/manager-rpc-webservices.xml

檔案在 /bbossaop/resources/org/frameworkset/spi/manager-rpc-service.xml 中導入。

<!--

           導入 webservice 服務配置

         -->

       < managerimport file = "org/frameworkset/spi/manager-rpc-webservices.xml" />

Webservice 協 議配置包含 ws rpc 協定配置、釋出的 webservice 服務配置、 cxf webservice 客服端連接配接參數配置四部分。分别介紹如下。

1.2     釋出 webservice 服務 servlet 配置

rpc 伺服器端還 需要在 web.xml 檔案中配置釋出 webservice 服務的 servlet :

< servlet >

       < display-name > cxf </ display-name >

       < servlet-name > cxf </ servlet-name >

       < servlet-class > org.apache.cxf.transport.servlet.RPCCXFServlet </ servlet-class >

       < load-on-startup > 1 </ load-on-startup >

    </ servlet >

    < servlet-mapping >

       < url-pattern > /cxfservices/* </ url-pattern >

    </ servlet-mapping >

1.3     Cxf webservice 服務控制開 關  

    < property name = "rpc.webservice.enable" value = "true" />   

标記是否啟用 webservice 服務,為 false 時, 啟動 cxf 的 serverlet 将不會加載和釋出配置的 webservice 服務(這些 webservice 服務配置在 cxf.webservices.config 屬性中 )。如果采用 webservice 協定作為遠端服務調用的協定時,     rpc.webservice.enable 開關必須配置為 true 。

1.4     webservice 服務配置

        < property name = "cxf.webservices.config" >

       < list >

       <!--

           webservice RPC 服務 , 用來實作業務元件之間的遠端服務調用

           屬性說明:

           name 服務的唯一辨別名稱

           singleable 服務元件 的單列模式

           servicePort 釋出的服務端口

           class 服務的實作類

           mtom 服務是否 支援附件傳輸

              true :支援, false :不支援      

           < property name = "rpc.webservice.RPCCall"

                    singlable = "true"

                    servicePort = "RPCCallServicePort"              

                    class = "org.frameworkset.spi.remote.webservice.RPCCall" />  

       </ list >

    </ property >

1.5     Cxf 客服端連接配接參數配置

    < property name = "cxf.client.config" enable = "true" >

       < map >

           < property label = "connectionTimeout " name = "connectionTimeout"

              value = "30000" class = "long" >

              < description > <![CDATA[ Specifies the amount of time, in milliseconds, that the client will attempt to establish a connection before it times out. The default is 30000 (30 seconds).

0 specifies that the client will continue to attempt to open a connection indefinitely. ]]></ description >

           </ property >

           < property label = "receiveTimeout" name = "receiveTimeout"

              value = "60000" class = "long" >

              < description > <![CDATA[ Specifies the amount of time, in milliseconds, that the client will wait for a response before it times out. The default is 60000.

0 specifies that the client will wait indefinitely. ]]></ description >

           < property label = "autoRedirect" name = "autoRedirect"

              value = "false" class = "boolean" >

              < description > <![CDATA[ Specifies if the client will automatically follow a server issued redirection. The default is false. ]]></ description >

           < property label = "maxRetransmits" name = "maxRetransmits"

              value = "-1" class = "int" >

              < description > <![CDATA[ Specifies the maximum number of times a client will retransmit a request to satisfy a redirect. The default is -1 which specifies that unlimited retransmissions are allowed. ]]></ description >

           < property label = "allowChunking" name = "allowChunking"

              value = "true" class = "boolean" >

             < description > <![CDATA[ Specifies whether the client will send requests using chunking. The default is true which specifies that the client will use chunking when sending requests.

Chunking cannot be used used if either of the following are true:

http-conf:basicAuthSupplier is configured to provide credentials preemptively.

AutoRedirect is set to true.

In both cases the value of AllowChunking is ignored and chunking is disallowed.

See note about chunking below. ]]></ description >

1.6     客服端網絡代理服務參數配置

<!--          <property label="proxyServer" name="proxyServer"-->

<!--              value="172.16.17.1" class="String">-->

<!--              <description> <![CDATA[Specifies the URL of the proxy server through which requests are routed. ]]></description>-->

<!--          </property>-->

<!--          <property label="proxyServerPort" name="proxyServerPort"-->

<!--              value="808" class="int ">-->

<!--              <description> <![CDATA[Specifies the port number of the proxy server through which requests are routed. ]]></description>-->

<!--          <property label="proxyServerType" name="proxyServerType"-->

<!--              value="SOCKS" >-->

              <!--

                  指定屬性注入時的屬性編輯和轉換器

                -->

<!--              <editor class="org.frameworkset.spi.remote.webservice.ProxyServerTypeEditor"/>-->

<!--              <description> <![CDATA[Specifies the type of proxy server used to route requests. Valid values are: -->

<!--              HTTP(default) -->

<!--              SOCKS -->

<!--              ]]></description>-->

       </ map >

1.7     Ssl 參數配置 - 沒有經過測試

    < property   name = "ws.ssl.config" enable = "false" >

           < property name = "keyManagers" keyPassword = "password" >

              < list >

                  < property name = "keyStore1" type = "JKS" password = "password" file = "src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks" />

              </ list >

           < property name = "trustManagers" keyPassword = "password" >

                  < property name = "keyStore1" type = "JKS" password = "password" file = "src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks" />

           < property name = "cipherSuitesFilter" >

                  < property value = ".*_EXPORT1024_.*" />

                   < property value = ".*_WITH_DES_.*" />

                   < property value = ".*_WITH_NULL_.*" />

                   < property value = ".*_DH_anon_.*" />

           < property name = "userName" value = "Betty" />

           < property name = "password" value = "password" />

           <http:tlsClientParameters>

<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-