Example usage for javax.xml.ws Endpoint setMetadata

List of usage examples for javax.xml.ws Endpoint setMetadata

Introduction

In this page you can find the example usage for javax.xml.ws Endpoint setMetadata.

Prototype

public abstract void setMetadata(List<javax.xml.transform.Source> metadata);

Source Link

Document

Sets the metadata for this endpoint.

Usage

From source file:org.nuxeo.ecm.platform.api.ws.WSEndpointDescriptor.java

public Endpoint toEndpoint() throws IOException, IllegalAccessException, InstantiationException {
    Endpoint ep = Endpoint.create(getImplementorInstance());
    List<Source> metadata = new ArrayList<>();
    Map<String, Object> properties = new HashMap<>();

    if (!isBlank(port)) {
        properties.put(WSDL_PORT, new QName(namespace, port));
    }/*w  w w .ja  v  a2 s  .c o  m*/
    if (!isBlank(port)) {
        properties.put(WSDL_SERVICE, new QName(namespace, service));
    }

    if (!isBlank(wsdl)) {
        URL wsdlURL = WSEndpointManagerImpl.class.getClassLoader().getResource(wsdl);
        if (wsdlURL == null) {
            throw new FileNotFoundException("WSDL: " + wsdl);
        }
        Source src = new StreamSource(wsdlURL.openStream());
        src.setSystemId(wsdlURL.toExternalForm());
        metadata.add(src);
    }

    if (isBlank(publishedEndpointUrl)) {
        publishedEndpointUrl = String.format("%s%s%s", Framework.getProperty(NUXEO_URL),
                WSEndpointManager.WS_SERVLET, address);
    }
    properties.put("publishedEndpointUrl", publishedEndpointUrl);

    ep.setMetadata(metadata);
    ep.setProperties(properties);
    return ep;
}