java 生成的 WSDL 中的空 soapAction
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11466234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Empty soapAction in generated WSDL
提问by icke
I'm trying to generate a WSDL from my Java code using JAX-WS.
我正在尝试使用 JAX-WS 从我的 Java 代码生成 WSDL。
Everything seems to work OK, except that for my operations in the WSDL the soapAction remains empty.
一切似乎都正常,除了我在 WSDL 中的操作之外,soapAction 保持为空。
Here is my code:
这是我的代码:
@WebService
public class MyClass {
public MyStuff queryStuff(String myParam) {
return null;
}
}
The generated WSDL contains this:
生成的 WSDL 包含以下内容:
<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?
我说不出我做错了什么。有任何想法吗?
回答by ggarciao
You need to annotate your method with @WebMehtod
.
您需要使用@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
注意:示例中的许多注释不是必需的,但我把它放在那里是为了向您展示您可以使用 JAX-WS 做的所有事情