简体   繁体   中英

Empty soapAction in generated WSDL

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM