ITeye博客

JAX-WS JWS

adapterofcoms · 2015-07-02 17:52 · Java Techs · WebService · Web前端 · Markdown

e.g:

@WebService
public interface DemoService 

@WebService(targetNamespace="com.kmerit.kdm.demoservice.service",
serviceName="demoService",
endpointInterface ="com.kmerit.kdm.demoservice.service.DemoService")
@Service("demoWSService")
public class DemoServiceImpl implements DemoService

 

服务的发布:
Endpoint.publish("http://localhost:8888/ws/demoService",new DemoServiceImpl());

服务的调用:
WebService webService=c.getAnnotation(WebService.class);
String namespaceUrl = webService.targetNamespace();              
QName qname = new QName(namespaceUrl,webService.serviceName());
URL wsdl_url = new URL(SERVICE_URL_PREFIX+webService.serviceName()+"?wsdl");           
Service srvc = Service.create(wsdl_url , qname);               
Object wsAgent=srvc.getPort(endpointInterface );  // IService client = service.getPort(IService.class);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。