Java Code Examples for javax.jws.WebService#targetNamespace()
The following examples show how to use
javax.jws.WebService#targetNamespace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JaxWsProviderWrapper.java From tomee with Apache License 2.0 | 6 votes |
@Override public <T> T getPort(final Class<T> serviceEndpointInterface) { final T t = serviceDelegate.getPort(serviceEndpointInterface); QName qname = null; if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) { final WebService webService = serviceEndpointInterface.getAnnotation(WebService.class); final String targetNamespace = webService.targetNamespace(); final String name = webService.name(); if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) { qname = new QName(targetNamespace, name); } } setProperties((BindingProvider) t, qname); return t; }
Example 2
Source File: ProviderWrapper.java From tomee with Apache License 2.0 | 6 votes |
public <T> T getPort(final Class<T> serviceEndpointInterface) { final T t = serviceDelegate.getPort(serviceEndpointInterface); QName qname = null; if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) { final WebService webService = serviceEndpointInterface.getAnnotation(WebService.class); final String targetNamespace = webService.targetNamespace(); final String name = webService.name(); if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) { qname = new QName(targetNamespace, name); } } setProperties((BindingProvider) t, qname); return customizePort(t); }
Example 3
Source File: JaxWsPortClientInterceptor.java From spring-analysis-note with MIT License | 5 votes |
/** * Initialize this client interceptor's properties from the given WebService annotation, * if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" * and "portName" haven't been set but corresponding values are declared at the * annotation level of the specified service interface). * @param ann the WebService annotation found on the specified service interface */ protected void applyDefaultsFromAnnotation(WebService ann) { if (getWsdlDocumentUrl() == null) { String wsdl = ann.wsdlLocation(); if (StringUtils.hasText(wsdl)) { try { setWsdlDocumentUrl(new URL(wsdl)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Encountered invalid @Service wsdlLocation value [" + wsdl + "]", ex); } } } if (getNamespaceUri() == null) { String ns = ann.targetNamespace(); if (StringUtils.hasText(ns)) { setNamespaceUri(ns); } } if (getServiceName() == null) { String sn = ann.serviceName(); if (StringUtils.hasText(sn)) { setServiceName(sn); } } if (getPortName() == null) { String pn = ann.portName(); if (StringUtils.hasText(pn)) { setPortName(pn); } } }
Example 4
Source File: WebServiceVisitor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 5
Source File: JaxWsPortClientInterceptor.java From java-technology-stack with MIT License | 5 votes |
/** * Initialize this client interceptor's properties from the given WebService annotation, * if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" * and "portName" haven't been set but corresponding values are declared at the * annotation level of the specified service interface). * @param ann the WebService annotation found on the specified service interface */ protected void applyDefaultsFromAnnotation(WebService ann) { if (getWsdlDocumentUrl() == null) { String wsdl = ann.wsdlLocation(); if (StringUtils.hasText(wsdl)) { try { setWsdlDocumentUrl(new URL(wsdl)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Encountered invalid @Service wsdlLocation value [" + wsdl + "]", ex); } } } if (getNamespaceUri() == null) { String ns = ann.targetNamespace(); if (StringUtils.hasText(ns)) { setNamespaceUri(ns); } } if (getServiceName() == null) { String sn = ann.serviceName(); if (StringUtils.hasText(sn)) { setServiceName(sn); } } if (getPortName() == null) { String pn = ann.portName(); if (StringUtils.hasText(pn)) { setPortName(pn); } } }
Example 6
Source File: WebServiceVisitor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 7
Source File: WebServiceVisitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 8
Source File: JaxWsPortClientInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Initialize this client interceptor's properties from the given WebService annotation, * if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" * and "portName" haven't been set but corresponding values are declared at the * annotation level of the specified service interface). * @param ann the WebService annotation found on the specified service interface */ protected void applyDefaultsFromAnnotation(WebService ann) { if (getWsdlDocumentUrl() == null) { String wsdl = ann.wsdlLocation(); if (StringUtils.hasText(wsdl)) { try { setWsdlDocumentUrl(new URL(wsdl)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Encountered invalid @Service wsdlLocation value [" + wsdl + "]", ex); } } } if (getNamespaceUri() == null) { String ns = ann.targetNamespace(); if (StringUtils.hasText(ns)) { setNamespaceUri(ns); } } if (getServiceName() == null) { String sn = ann.serviceName(); if (StringUtils.hasText(sn)) { setServiceName(sn); } } if (getPortName() == null) { String pn = ann.portName(); if (StringUtils.hasText(pn)) { setPortName(pn); } } }
Example 9
Source File: WebServiceVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 10
Source File: WebServiceVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 11
Source File: WebServiceVisitor.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 12
Source File: WebServiceVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 13
Source File: JaxWsPortClientInterceptor.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Initialize this client interceptor's properties from the given WebService annotation, * if necessary and possible (i.e. if "wsdlDocumentUrl", "namespaceUri", "serviceName" * and "portName" haven't been set but corresponding values are declared at the * annotation level of the specified service interface). * @param ann the WebService annotation found on the specified service interface */ protected void applyDefaultsFromAnnotation(WebService ann) { if (getWsdlDocumentUrl() == null) { String wsdl = ann.wsdlLocation(); if (StringUtils.hasText(wsdl)) { try { setWsdlDocumentUrl(new URL(wsdl)); } catch (MalformedURLException ex) { throw new IllegalStateException( "Encountered invalid @Service wsdlLocation value [" + wsdl + "]", ex); } } } if (getNamespaceUri() == null) { String ns = ann.targetNamespace(); if (StringUtils.hasText(ns)) { setNamespaceUri(ns); } } if (getServiceName() == null) { String sn = ann.serviceName(); if (StringUtils.hasText(sn)) { setServiceName(sn); } } if (getPortName() == null) { String pn = ann.portName(); if (StringUtils.hasText(pn)) { setPortName(pn); } } }
Example 14
Source File: WebServiceVisitor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
Example 15
Source File: JaxWsUtils.java From tomee with Apache License 2.0 | 5 votes |
public static QName getPortType(final Class<?> seiClass) { final WebService webService = seiClass.getAnnotation(WebService.class); if (webService != null) { String localName = webService.name(); if (localName == null || localName.length() == 0) { localName = seiClass.getSimpleName(); } final String namespace = webService.targetNamespace(); return new QName(getNamespace(seiClass, namespace), localName); } return null; }