-1
我是Web服務的新手。我試圖給出的例子在這裏如何使用HTTPBinding自動生成WSDL文件
https://examples.javacodegeeks.com/enterprise-java/jws/jax-ws-hello-world-example-rpc-style/
這裏當我部署在Tomcat Web應用程序,它會打開一個網頁,點擊它指向WSDL
。在這裏,我創建了Java存根類,WSDL
即時創建。類似的事情,我試圖做另一個Web服務但在這裏使用HTTPBinding
。但我看到WSDL
未發佈。
我嘗試了很多方法,但沒有成功。
下面是我創建
@WebServiceProvider()
@ServiceMode(value=Service.Mode.MESSAGE)
@BindingType(value = HTTPBinding.HTTP_BINDING)
public class WebServiceImpl implements Provider<Source> {
public Source invoke(Source source) {
try {
return new StreamSource(new ByteArrayInputStream(printMessage().getBytes()));
} catch(Exception e) {
e.printStackTrace();
throw new RuntimeException("Error in provider endpoint", e);
}
}
public String printMessage() {
String body= "Hello , Congratulations to learn HTTP Binding .happy learning!";
return body;
}
的實現類,但我既不在URL localhost:8080/HttpWS/sayhello
也不WSDL
鏈接得到Webservice的結果,就像是在SOAP示例所示。
有人可以幫助我理解如何使用HTTPBinding
?
非常感謝。
修改標籤@WebServiceProvider( \t \t PORTNAME = 「WebServiceImplPort」, \t服務名= 「WebServiceImplService」, \t的targetNamespace =之後的 「http://jaxws.webservices.examples/」, \t wsdlLocation =「http:// localhost:8080/HttpWS/sayhello?wsdl」)我正在獲取XML Hello,恭喜你學習HTTP在訪問URL http:// localhost:8080/HttpWS/sayhello時綁定.happy學習 ns:printMessageResponse>。但是由此產生的WSDL還沒有得到答案。請幫忙 。 –
summary