Spring WS强制SOAP端点操作名称

时间:2015-11-11 11:39:51

标签: java spring soap

我正在使用spring实现SOAP WS,我有我的XSD,然后我使用注释添加我的端点,如:

@Endpoint
public class StuffRequestEndpoint {

    @PayloadRoot(namespace = "urn:mycomp-com/xyz/ws/msg", localPart = "StuffRequest")
    public
    @ResponsePayload
    StuffResponse requestStuff(@RequestPayload StuffRequest request) {

我遇到的问题是生成的WSDL有一个有趣的操作名称:

    <wsdl:operation name="Stuff">
        <soap:operation soapAction=""/>
        <wsdl:input name="StuffRequest">
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="StuffResponse">
            <soap:body use="literal"/>
        </wsdl:output>

如何覆盖生成的操作名称?

感谢。

1 个答案:

答案 0 :(得分:0)

我没有看到你在这件事上做了什么。因此,让我们尝试使用DefaultWsdl11Definition的JavaDocs:

/**
 * Sets the SOAP Actions for this binding. Keys are {@link javax.wsdl.BindingOperation#getName() binding operation
 * names}; values are {@link javax.wsdl.extensions.soap.SOAPOperation#getSoapActionURI() SOAP Action URIs}.
 *
 * @param soapActions the soap
 */
public void setSoapActions(Properties soapActions) {
    soapProvider.setSoapActions(soapActions);
}

用法类似于(Soap12Provider):

protected void populateSoapOperation(SOAP12Operation soapOperation, BindingOperation bindingOperation)
        throws WSDLException {
    String bindingOperationName = bindingOperation.getName();
    String soapAction = getSoapActions().getProperty(bindingOperationName, "");
    soapOperation.setSoapActionURI(soapAction);
}

你看到那里有一个空字符串。