如何在java中的webservice中添加SOAP动作?

时间:2012-01-01 19:31:53

标签: java soap action

我正在研究SOAP Web服务。我使用了注释:@webService(endPointInterface =),@ WebMethod,@ WebResult。

Code :

<wsdl:operation name="thumbNailImageService">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="thumbNailImageService">
<soap:body use="literal"/>
</wsdl:input>

我正在获取上述请求的WSDL,但我的SOAP操作为空(空字符串)。

我想从我的java代码中添加SOAP操作,就像任何一个注释一样。

需要解决方案:

<soap:operation soapAction="Any Action URl points to service" style="document"/>

帮助我使用java代码使用注释添加SOAP操作。

我正在使用import或library,如下所示:

**import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlRootElement;**

由于

1 个答案:

答案 0 :(得分:5)

使用JAX-WS,您可以指定action注释的@WebMethod属性。它绑定到action标记的soap:operation属性。请参阅javadocs