使用CXF在WSDL中使用soapaction

Ale*_*lak 5 soap action web-services cxf operation

我正在使用CXF开发webservice.我使用HTTP绑定,因此根据http://www.w3.org/TR/wsdl#_soap:operation soapaction对于这种类型的传输是强制性的.

问题是我想为测试和生产服务器部署相同的应用程序.我想这样做而无需重建应用程序或保留外部WSDL文件,这将在维护列表上添加一个东西.

我在位置上遇到了同样的问题,但是这个问题很难解决.我在端点配置中使用了publishedEndpointUrl来设置正确的值.在从外部属性文件初始化应用程序期间检索该值,我将其放在classpath 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>
Run Code Online (Sandbox Code Playgroud)

我想为soapaction实现相同的功能.此属性的值不应该是相对URI.因此,测试应该是:

<soap:operation soapAction="https://test.example.org/dsSOAP/operation1" />
Run Code Online (Sandbox Code Playgroud)

并用于生产

<soap:operation soapAction="https://example.org/dsSOAP/operation1" />
Run Code Online (Sandbox Code Playgroud)

任何想法如何实现这一目标?

jmh*_*let 1

您不需要指定绝对 URL,也不需要指定 URL。“操作1”就足够了。请参阅http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528上的一些官方示例

将肥皂操作与实例运行的环境链接起来并不是“最佳实践”。