2016-02-27 130 views
0

我正在学习JAVA WEB SERVICE,尤其是SOAP。根据tutorial,我们可以自定义WSDL,就像我们可以使用WebService注释来覆盖default帖子名称和服务名称一样。所以我尝试如下:Java WebService中的端口名称和服务名称未更改

包装实践;

import java.util.List;

import javax.jws.WebMethod; import javax.jws.WebService;

import practice.business.WebTestImpl; @WebService(名称= “getBooksName”,PORTNAME = “getBooksPortName”,服务名= “getBooksService”)

公共类WebCaller

{WebTestImpl wimpl =新WebTestImpl();

@WebMethod
公开名单getBooks(字符串类)
{返回 wimpl.getBooks(类);
}}

但还是默认的服务名称和端口名称没有改变。这可能是什么原因?这得到了生成的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服务器。

回答