jax-ws spring client 詳解

來源:互聯網
上載者:User
jax-ws spring client 詳解 2010-07-06 17:42

1 將 wevservice 用戶端 通過<jaxws:client>元素,注入到spring的設定檔中,類似<jaxws:endpoint>元素被使用者服務端

2 具體的例子

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <jaxws:client id="helloClient"
                  serviceClass="demo.spring.HelloWorld"
                  address="http://localhost:9002/HelloWorld" />
</beans>

<jaxws:client>元素說明:

id: String類型,唯一標識,可以被spring的bean進行調用

serviceClass:Class 類型,內容為完整的類名稱,SEI 介面名

address:QName 類型,對應wsdl:service@name.

endpointName :QName,對應wsdl:port@name

wsdlLocation:URL類型,A URL to connect to in order to retrieve the WSDL for the service. This is not required

3 更詳細的例子

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"       xmlns:jaxws="http://cxf.apache.org/jaxws"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">  <!-- Interceptors extend e.g. org.apache.cxf.phase.AbstractPhaseInterceptor -->  <bean id="anotherInterceptor" class="..." />  <!-- Handlers implement e.g. javax.xml.ws.handler.soap.SOAPHandler -->  <bean id="jaxwsHandler" class="..." />  <!-- The SOAP client bean -->  <jaxws:client id="helloClient"                serviceClass="demo.spring.HelloWorld"                address="http://localhost:9002/HelloWorld">    <jaxws:inInterceptors>      <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>      <ref bean="anotherInterceptor"/>    </jaxws:inInterceptor>    <jaxws:handlers>      <ref bean="jaxwsHandler" />    </jaxws:handlers>    <jaxws:properties>      <entry key="mtom-enabled" value="true"/>    </jaxws:properties>  </jaxws:client></beans>
<jaxws:client>子項目:
jaxws:inInterceptors:攔截器,必須實現Each should implement org.apache.cxf.interceptor.Interceptor or org.apache.cxf.phase.PhaseInterceptor
jaxws:handlers:處理類,必須實現javax.xml.ws.handler.Handler or javax.xml.ws.handler.soap.SOAPHandler. 
jaxws:properties :屬性, MAP 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.