首页 文章

Java WebService中的Portname和Servicename不会更改

提问于
浏览
0

我正在学习JAVA WEB SERVICE特别是SOAP . 根据tutorial,我们可以自定义WSDL,就像我们可以使用 WebService 注释覆盖聋人的帖子名称和服务名称 . 所以我尝试了以下内容:

包装实践; import java.util.List; import javax.jws.WebMethod; import javax.jws.WebService; import practice.business.WebTestImpl; @WebService(name =“getBooksName”,portName =“getBooksPortName”,serviceName =“getBooksService”)public class WebCaller {WebTestImpl wimpl = new WebTestImpl(); @WebMethod public List getBooks(String category){return wimpl.getBooks(category); }}

但是仍然没有更改默认服务名称和端口名称 . 这可能是什么原因?生成的WSDL如下:

<definitions targetNamespace="http://practice/" name="WebCallerService"><types><xsd:schema><xsd:import namespace="http://practice/" schemaLocation="http://adminib-v7gnsh2:8075/WebTest/WebCallerService?xsd=1"/></xsd:schema></types><message name="getBooks"><part name="parameters" element="tns:getBooks"/></message><message name="getBooksResponse"><part name="parameters" element="tns:getBooksResponse"/></message><portType name="WebCaller"><operation name="getBooks"><input wsam:Action="http://practice/WebCaller/getBooksRequest" message="tns:getBooks"/><output wsam:Action="http://practice/WebCaller/getBooksResponse" message="tns:getBooksResponse"/></operation></portType><binding name="WebCallerPortBinding" type="tns:WebCaller"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/><operation name="getBooks"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="WebCallerService"><port name="WebCallerPort" binding="tns:WebCallerPortBinding"><soap:address location="http://adminib-v7gnsh2:8075/WebTest/WebCallerService"/></port></service></definitions>

我正在使用Eclipse IDE和Glassfish服务器 .

1 回答

相关问题