com.sun.xml.internal.ws.api.server.SDDocumentSource Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.server.SDDocumentSource. 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: EndpointFactory.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException {
    if (systemId != null) {
        SDDocumentSource doc = metadata.get(systemId);
        if (doc != null)
            return new Parser(doc);
    }
    if (resolver != null) {
        try {
            InputSource source = resolver.resolveEntity(publicId, systemId);
            if (source != null) {
                Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true));
                return p;
            }
        } catch (SAXException e) {
            throw new XMLStreamException(e);
        }
    }
    return null;
}
 
Example #2
Source File: MexEntityResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #3
Source File: WSDLGenResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #4
Source File: MexEntityResolver.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #5
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get all the WSDL & schema documents recursively.
 */
private void collectDocs(String dirPath) throws MalformedURLException {
    Set<String> paths = loader.getResourcePaths(dirPath);
    if (paths != null) {
        for (String path : paths) {
            if (path.endsWith("/")) {
                if (path.endsWith("/CVS/") || path.endsWith("/.svn/")) {
                    continue;
                }
                collectDocs(path);
            } else {
                URL res = loader.getResource(path);
                docs.put(res.toString(), SDDocumentSource.create(res));
            }
        }
    }
}
 
Example #6
Source File: MexEntityResolver.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #7
Source File: EndpointFactory.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
 
Example #8
Source File: EndpointFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort,
                                                   Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding,
                                                   SDDocumentSource primaryWsdl) {
            DatabindingFactory fac = DatabindingFactory.newInstance();
            DatabindingConfig config = new DatabindingConfig();
            config.setEndpointClass(implType);
            config.getMappingInfo().setServiceName(serviceName);
            config.setWsdlPort(wsdlPort);
            config.setWSBinding(binding);
            config.setClassLoader(implType.getClassLoader());
            config.getMappingInfo().setPortName(portName);
            if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId());
    config.setMetadataReader(getExternalMetadatReader(implType, binding));

            com.sun.xml.internal.ws.db.DatabindingImpl rt = (com.sun.xml.internal.ws.db.DatabindingImpl)fac.createRuntime(config);
            return (AbstractSEIModelImpl) rt.getModel();
}
 
Example #9
Source File: EndpointFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
 
Example #10
Source File: EndpointFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
 
Example #11
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get all the WSDL & schema documents recursively.
 */
private void collectDocs(String dirPath) throws MalformedURLException {
    Set<String> paths = loader.getResourcePaths(dirPath);
    if (paths != null) {
        for (String path : paths) {
            if (path.endsWith("/")) {
                if (path.endsWith("/CVS/") || path.endsWith("/.svn/")) {
                    continue;
                }
                collectDocs(path);
            } else {
                URL res = loader.getResource(path);
                docs.put(res.toString(), SDDocumentSource.create(res));
            }
        }
    }
}
 
Example #12
Source File: MexEntityResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #13
Source File: EndpointFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort,
                                                   Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding,
                                                   SDDocumentSource primaryWsdl) {
            DatabindingFactory fac = DatabindingFactory.newInstance();
            DatabindingConfig config = new DatabindingConfig();
            config.setEndpointClass(implType);
            config.getMappingInfo().setServiceName(serviceName);
            config.setWsdlPort(wsdlPort);
            config.setWSBinding(binding);
            config.setClassLoader(implType.getClassLoader());
            config.getMappingInfo().setPortName(portName);
            if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId());
    config.setMetadataReader(getExternalMetadatReader(implType, binding));

            com.sun.xml.internal.ws.db.DatabindingImpl rt = (com.sun.xml.internal.ws.db.DatabindingImpl)fac.createRuntime(config);
            return (AbstractSEIModelImpl) rt.getModel();
}
 
Example #14
Source File: WSDLGenResolver.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #15
Source File: WSDLGenResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #16
Source File: MexEntityResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #17
Source File: EndpointFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort,
                                                   Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding,
                                                   SDDocumentSource primaryWsdl) {
            DatabindingFactory fac = DatabindingFactory.newInstance();
            DatabindingConfig config = new DatabindingConfig();
            config.setEndpointClass(implType);
            config.getMappingInfo().setServiceName(serviceName);
            config.setWsdlPort(wsdlPort);
            config.setWSBinding(binding);
            config.setClassLoader(implType.getClassLoader());
            config.getMappingInfo().setPortName(portName);
            if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId());
    config.setMetadataReader(getExternalMetadatReader(implType, binding));

            com.sun.xml.internal.ws.db.DatabindingImpl rt = (com.sun.xml.internal.ws.db.DatabindingImpl)fac.createRuntime(config);
            return (AbstractSEIModelImpl) rt.getModel();
}
 
Example #18
Source File: EndpointFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException {
    if (systemId != null) {
        SDDocumentSource doc = metadata.get(systemId);
        if (doc != null)
            return new Parser(doc);
    }
    if (resolver != null) {
        try {
            InputSource source = resolver.resolveEntity(publicId, systemId);
            if (source != null) {
                Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true));
                return p;
            }
        } catch (SAXException e) {
            throw new XMLStreamException(e);
        }
    }
    return null;
}
 
Example #19
Source File: MexEntityResolver.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
    Transformer transformer = XmlUtil.newTransformer();
    for (Source source : wsdls) {
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        try {
            transformer.transform(source, xsbr);
        } catch (TransformerException e) {
            throw new WebServiceException(e);
        }
        String systemId = source.getSystemId();

        //TODO: can we do anything if the given mex Source has no systemId?
        if(systemId != null){
            SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
            this.wsdls.put(systemId, doc);
        }
    }
}
 
Example #20
Source File: EndpointFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
 
Example #21
Source File: EndpointFactory.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException {
    if (systemId != null) {
        SDDocumentSource doc = metadata.get(systemId);
        if (doc != null)
            return new Parser(doc);
    }
    if (resolver != null) {
        try {
            InputSource source = resolver.resolveEntity(publicId, systemId);
            if (source != null) {
                Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true));
                return p;
            }
        } catch (SAXException e) {
            throw new XMLStreamException(e);
        }
    }
    return null;
}
 
Example #22
Source File: EndpointFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> createEndpoint(
        Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker,
        @Nullable QName serviceName, @Nullable QName portName,
        @Nullable Container container, @Nullable WSBinding binding,
        @Nullable SDDocumentSource primaryWsdl,
        @Nullable Collection<? extends SDDocumentSource> metadata,
        EntityResolver resolver, boolean isTransportSynchronous, boolean isStandard) {
    EndpointFactory factory = container != null ? container.getSPI(EndpointFactory.class) : null;
    if (factory == null)
            factory = EndpointFactory.getInstance();

    return factory.create(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);
}
 
Example #23
Source File: EndpointFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Builds {@link SDDocumentImpl} from {@link SDDocumentSource}.
 */
private static List<SDDocumentImpl> categoriseMetadata(
    List<SDDocumentSource> src, QName serviceName, QName portTypeName) {

    List<SDDocumentImpl> r = new ArrayList<SDDocumentImpl>(src.size());
    for (SDDocumentSource doc : src) {
        r.add(SDDocumentImpl.create(doc,serviceName,portTypeName));
    }
    return r;
}
 
Example #24
Source File: EndpointFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> createEndpoint(
        Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker,
        @Nullable QName serviceName, @Nullable QName portName,
        @Nullable Container container, @Nullable WSBinding binding,
        @Nullable SDDocumentSource primaryWsdl,
        @Nullable Collection<? extends SDDocumentSource> metadata,
        EntityResolver resolver, boolean isTransportSynchronous, boolean isStandard) {
    EndpointFactory factory = container != null ? container.getSPI(EndpointFactory.class) : null;
    if (factory == null)
            factory = EndpointFactory.getInstance();

    return factory.create(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);
}
 
Example #25
Source File: EndpointFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static <T> WSEndpoint<T> createEndpoint(
        Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker,
        @Nullable QName serviceName, @Nullable QName portName,
        @Nullable Container container, @Nullable WSBinding binding,
        @Nullable SDDocumentSource primaryWsdl,
        @Nullable Collection<? extends SDDocumentSource> metadata,
        EntityResolver resolver, boolean isTransportSynchronous, boolean isStandard) {
    EndpointFactory factory = container != null ? container.getSPI(EndpointFactory.class) : null;
    if (factory == null)
            factory = EndpointFactory.getInstance();

    return factory.create(
            implType,processHandlerAnnotation, invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,isTransportSynchronous,isStandard);
}
 
Example #26
Source File: WSDLGenResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts SDDocumentSource to SDDocumentImpl and updates original docs. It
 * categories the generated documents into WSDL, Schema types.
 *
 * @return the primary WSDL
 *         null if it is not there in the generated documents
 *
 */
public SDDocumentImpl updateDocs() {
    for (SDDocumentSource doc : newDocs) {
        SDDocumentImpl docImpl = SDDocumentImpl.create(doc,serviceName,portTypeName);
        if (doc == concreteWsdlSource) {
            concreteWsdl = docImpl;
        }
        docs.add(docImpl);
    }
    return concreteWsdl;
}
 
Example #27
Source File: AbstractSchemaValidationTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SDDocument resolve(String systemId) {
    SDDocument sdi = docs.get(systemId);
    if (sdi == null) {
        SDDocumentSource sds;
        try {
            sds = SDDocumentSource.create(new URL(systemId));
        } catch(MalformedURLException e) {
            throw new WebServiceException(e);
        }
        sdi = SDDocumentImpl.create(sds, new QName(""), new QName(""));
        docs.put(systemId, sdi);
    }
    return sdi;
}
 
Example #28
Source File: WSDLGenResolver.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts SDDocumentSource to SDDocumentImpl and updates original docs. It
 * categories the generated documents into WSDL, Schema types.
 *
 * @return the primary WSDL
 *         null if it is not there in the generated documents
 *
 */
public SDDocumentImpl updateDocs() {
    for (SDDocumentSource doc : newDocs) {
        SDDocumentImpl docImpl = SDDocumentImpl.create(doc,serviceName,portTypeName);
        if (doc == concreteWsdlSource) {
            concreteWsdl = docImpl;
        }
        docs.add(docImpl);
    }
    return concreteWsdl;
}
 
Example #29
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #30
Source File: EndpointFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Implements {@link WSEndpoint#create}.
 *
 * No need to take WebServiceContext implementation. When InvokerPipe is
 * instantiated, it calls InstanceResolver to set up a WebServiceContext.
 * We shall only take delegate to getUserPrincipal and isUserInRole from adapter.
 *
 * <p>
 * Nobody else should be calling this method.
 */
public <T> WSEndpoint<T> create(
        Class<T> implType, boolean processHandlerAnnotation, @Nullable Invoker invoker,
        @Nullable QName serviceName, @Nullable QName portName,
        @Nullable Container container, @Nullable WSBinding binding,
        @Nullable SDDocumentSource primaryWsdl,
        @Nullable Collection<? extends SDDocumentSource> metadata,
        EntityResolver resolver, boolean isTransportSynchronous) {
    return create(implType, processHandlerAnnotation, invoker, serviceName,
                    portName, container, binding, primaryWsdl, metadata, resolver, isTransportSynchronous,
                    true);

}