static String getPortType(Class impl, Class api) throws WebServiceException { WebService webService = (WebService) impl.getAnnotation(WebService.class); if (webService != null) { if ("".equals(webService.name()) && "".equals(webService.endpointInterface())) return impl.getSimpleName(); if (!"".equals(webService.name()) && "".equals(webService.endpointInterface())) return webService.name(); if ("".equals(webService.name()) && !"".equals(webService.endpointInterface())) { webService = (WebService) api.getAnnotation(WebService.class); if (webService != null && !"".equals(webService.name())) return webService.name(); else return api.getSimpleName(); } if (!"".equals(webService.name()) && !"".equals(webService.endpointInterface())) throw new WebServiceException( L.l( "Cannot specify both name and endpointInterface properties in a WebService annotation: {0}", impl)); } return impl.getSimpleName(); }
/** Invokes the request on a remote object using an outbound XML stream. */ public Object invoke(Method method, String url, Object[] args, HandlerChainInvoker handlerChain) throws IOException, XMLStreamException, MalformedURLException, JAXBException, Throwable { AbstractAction action = _actionMethods.get(method); if (action != null) return action.invoke(url, args, handlerChain); else if ("toString".equals(method.getName())) return "SoapStub[" + (_api != null ? _api.getName() : "") + "]"; else throw new RuntimeException(L.l("not a web method: {0}", method.getName())); }
public DirectSkeleton( Class impl, Class api, JAXBContextImpl context, String wsdlLocation, String targetNamespace, WSDLDefinitions wsdl) throws WebServiceException { WebService webService = (WebService) impl.getAnnotation(WebService.class); _api = api; _namespace = targetNamespace; _portType = getPortType(impl, api); if (webService != null && !"".equals(webService.portName())) _portName = webService.portName(); else if (webService != null && !"".equals(webService.name())) _portName = webService.name() + "Port"; else _portName = impl.getSimpleName() + "Port"; if (webService != null && !"".equals(webService.serviceName())) _serviceName = webService.serviceName(); else _serviceName = impl.getSimpleName() + "Service"; if (webService != null && !"".equals(webService.wsdlLocation())) _wsdlLocation = webService.wsdlLocation(); else _wsdlLocation = wsdlLocation; _wsdl = wsdl; _bindingId = SOAPBinding.SOAP11HTTP_BINDING; BindingType bindingType = (BindingType) _api.getAnnotation(BindingType.class); if (bindingType != null) _bindingId = bindingType.value(); javax.jws.soap.SOAPBinding soapBinding = (javax.jws.soap.SOAPBinding) _api.getAnnotation(javax.jws.soap.SOAPBinding.class); if (soapBinding != null && soapBinding.style() == javax.jws.soap.SOAPBinding.Style.RPC) _soapStyle = "rpc"; _context = context; QName portName = new QName(_namespace, _portName); QName serviceName = new QName(_namespace, _serviceName); _portInfo = new PortInfoImpl(_bindingId, portName, serviceName); HandlerChain handlerChain = (HandlerChain) _api.getAnnotation(HandlerChain.class); if (handlerChain != null) { HandlerResolver handlerResolver = JAXWSUtil.createHandlerResolver(_api, handlerChain); List<Handler> chain = handlerResolver.getHandlerChain(_portInfo); if (chain != null) _handlerChain = new HandlerChainInvoker(chain); } }