JAX-WS JWS

 

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);

 

 

你可能感兴趣的:(jax-ws)