2012-09-25 44 views
5

我正在開發使用CXF的webservice。我使用HTTP綁定,所以根據http://www.w3.org/TR/wsdl#_soap:operationsoapaction是這種類型的運輸強制性的。使用CXF的WSDL中的soapaction

問題是我想爲測試和生產服務器部署相同的應用程序。我想在不重建應用程序或保留外部WSDL文件的情況下執行此操作,這將在維護列表中添加一件事。

我與的位置有同樣的問題,但這是一個微不足道的解決。我在端點配置中使用publishedEndpointUrl來設置適當的值。該值是在從外部屬性文件初始化應用程序期間檢索的,該文件位於類路徑tomcat/common/classes

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap" xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="locations"> 
     <list> 
     <value>classpath:ws.properties</value> 
     </list> 
    </property> 
    </bean> 
    <jaxws:endpoint xmlns:tns="http://example.org/ds" id="ds" implementor="org.example.Ds" wsdlLocation="wsdl/ds.wsdl" endpointName="tns:dsSOAP" serviceName="tns:Ds" address="/dsSOAP" publishedEndpointUrl="${publishedEndpointUrl}"> 
    <jaxws:features> 
     <bean class="org.apache.cxf.feature.LoggingFeature" /> 
    </jaxws:features> 
    </jaxws:endpoint> 
</beans> 

我想爲soapaction實現相同的功能。該屬性的值不應該是相對URI。因此,對於測試應該是:

<soap:operation soapAction="https://test.example.org/dsSOAP/operation1" /> 

和生產

<soap:operation soapAction="https://example.org/dsSOAP/operation1" /> 

任何想法如何實現這一目標?

+0

有人願意幫忙嗎? –

+0

你爲什麼需要爲您的測試和生產服務提供不同的soapActions?如果兩個服務使用相同的WSDL,則可以定義一次soapAction並使用相同的soap操作進行測試和生成。 –

+0

@YogeshChawla如果我沒有錯,由於文檔屬性'soapAcion'需要使用絕對URL。所以我不能放置一個'dsSOAP/operation1'。具有相同的測試和生產價值,我最終可能會開始調用生產服務器而不是測試服務器。 –

回答