我正在用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>

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

谢谢。

最佳答案

我看不到您对此事做了任何事情。因此,让我们尝试遵循JavaDocs的DefaultWsdl11Definition:

/**
 * 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);
}

这样一来,您会看到一个空字符串。

10-05 22:20