【问题标题】:Exposing a Web service which can support both SOAP 1.1 & SOAP 1.2 Clients公开可以同时支持 SOAP 1.1 和 SOAP 1.2 客户端的 Web 服务
【发布时间】:2015-04-15 00:49:16
【问题描述】:

目前,我正在使用注解来指定绑定类型,特别指出我的 Web 服务应该使用 SOAP 1.2,但我想修改我的 Web 服务以同时接受 SOAP 1.1 和 SOAP 1.2 请求。

如果有办法,您能帮忙吗?

@WebService
    public interface ExternalService {
        @WebMethod
        public WebTx getTxByTxRefNum(@WebParam(name="txRefNumber") String txRefNumber,
                @WebParam(name="applicationName") String applicationName);
    }

@WebService(endpointInterface = "com.abc.cde.service.ExternalService", serviceName ="ExternalService")
@BindingType(value = SOAP12HTTP_BINDING)
@WSDLDocumentation(value="ABC SOAP 1.2 Services for External Applications", placement = WSDLDocumentation.Placement.TOP)
public class ExternalServiceImpl implements ExternalService {

    @Autowired
    private TxService txService = null;

    public WebTx getTxByTxRefNum(String txRefNumber, String applicationName) {
        try {
            ---
            ---
            Tx tx = this.txService.getTransactionByTxRefNum(txRefNumber, applicationName);
        } catch(RuntimeException runtimeException) {
            ---
            ----
            ---
        }
    }
}

<bean id="externalService" class="com.abc.cde.service.ExternalServiceImpl"/>

<jaxws:endpoint id="ExternalService" implementor="#externalService" address="/ExternalService">
         <jaxws:inInterceptors>
            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
                <constructor-arg>
                    <map>
                        <entry key="action" value="UsernameToken" />
                        <entry key="passwordType" value="PasswordText" />
                        <entry key="passwordCallbackRef">
                            <ref bean="serverPasswordCallback" />
                        </entry>
                    </map>
                </constructor-arg>
            </bean>
            <!-- <ref bean="logInbound" />
            <ref bean="logOutbound" /> -->
          </jaxws:inInterceptors>
    </jaxws:endpoint>

【问题讨论】:

    标签: web-services soap cxf jax-ws ws-security


    【解决方案1】:

    在 CXF 中,它是自动的。通过 SOAP 1.2 公开的端点也将处理 1.1 请求,并将自动以 1.1 响应进行响应。

    【讨论】:

    • 我也这么认为。但它不起作用。如果我删除 @BindingType(value = SOAP12HTTP_BINDING),服务可以处理 SOAP 1.1 请求,但不能处理 SOAP 1.2 请求。
    猜你喜欢
    • 2021-05-14
    • 2017-02-20
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    相关资源
    最近更新 更多