Empty soapAction in generated WSDL

百般思念 提交于 2019-12-22 08:14:41

问题


I'm trying to generate a WSDL from my Java code using JAX-WS.

Everything seems to work OK, except that for my operations in the WSDL the soapAction remains empty.

Here is my code:

@WebService
public class MyClass {
    public MyStuff queryStuff(String myParam) {
        return null;
    }
}

The generated WSDL contains this:

<wsdl:operation name="queryStuff">
    <wsdlsoap:operation soapAction=""/>
    <wsdl:input name="queryStuffRequest">
        <wsdlsoap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="queryStuffResponse">
        <wsdlsoap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>

I can't tell what I'm doing wrong. Any ideas?


回答1:


You need to annotate your method with @WebMehtod.

Example

@WebService(name = "dataService", targetNamespace = "http://example.com/vap/webservice/dataservice/definition")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
public interface DataSEI {

    @WebMethod(action = "createAction", operationName = "create")
    DataTransferObjectStatusContainer create(
            @WebParam(name = "objects", targetNamespace = "http://example.com/vap/webservice/dataservice/definition")
            DataTranferObjectContainer pObjectsContainer,
            @WebParam(name = "atomic", targetNamespace = "http://example.com/vap/webservice/dataservice/definition")
            boolean pAsAtomicOperation) throws Fault;
}

NOTE: A lot of the annotations from the example are not required, but I put it there to show you all the things you can do with JAX-WS



来源:https://stackoverflow.com/questions/11466234/empty-soapaction-in-generated-wsdl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!