• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SDDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.ws.api.server.SDDocument的典型用法代码示例。如果您正苦于以下问题:Java SDDocument类的具体用法?Java SDDocument怎么用?Java SDDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SDDocument类属于com.sun.xml.internal.ws.api.server包,在下文中一共展示了SDDocument类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: publishWSDL

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
/**
 * Sends out the WSDL (and other referenced documents)
 * in response to the GET requests to URLs like "?wsdl" or "?xsd=2".
 *
 * @param con
 *      The connection to which the data will be sent.
 *
 * @throws java.io.IOException when I/O errors happen
 */
public void publishWSDL(@NotNull WSHTTPConnection con) throws IOException {
    con.getInput().close();

    SDDocument doc = wsdls.get(con.getQueryString());
    if (doc == null) {
        writeNotFoundErrorPage(con,"Invalid Request");
        return;
    }

    con.setStatus(HttpURLConnection.HTTP_OK);
    con.setContentTypeResponseHeader("text/xml;charset=utf-8");

    OutputStream os = con.getProtocol().contains("1.1") ? con.getOutput() : new Http10OutputStream(con);

    PortAddressResolver portAddressResolver = getPortAddressResolver(con.getBaseAddress());
    DocumentAddressResolver resolver = getDocumentAddressResolver(portAddressResolver);

    doc.writeTo(portAddressResolver, resolver, os);
    os.close();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:HttpAdapter.java


示例2: WSDLGenResolver

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
public WSDLGenResolver(@NotNull List<SDDocumentImpl> docs,QName serviceName,QName portTypeName) {
    this.docs = docs;
    this.serviceName = serviceName;
    this.portTypeName = portTypeName;

    for (SDDocumentImpl doc : docs) {
        if(doc.isWSDL()) {
            SDDocument.WSDL wsdl = (SDDocument.WSDL) doc;
            if(wsdl.hasPortType())
                abstractWsdl = doc;
        }
        if(doc.isSchema()) {
            SDDocument.Schema schema = (SDDocument.Schema) doc;
            List<SDDocumentImpl> sysIds = nsMapping.get(schema.getTargetNamespace());
            if (sysIds == null) {
                sysIds = new ArrayList<SDDocumentImpl>();
                nsMapping.put(schema.getTargetNamespace(), sysIds);
            }
            sysIds.add(doc);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:WSDLGenResolver.java


示例3: verifyPrimaryWSDL

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
/**
 * 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?");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:EndpointFactory.java


示例4: findPrimary

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
/**
 * Finds the primary WSDL document from the list of metadata documents. If
 * there are two metadata documents that qualify for primary, it throws an
 * exception. If there are two metadata documents that qualify for porttype,
 * it throws an exception.
 *
 * @return primay wsdl document, null if is not there in the docList
 *
 */
private static @Nullable SDDocumentImpl findPrimary(@NotNull List<SDDocumentImpl> docList) {
    SDDocumentImpl primaryDoc = null;
    boolean foundConcrete = false;
    boolean foundAbstract = false;
    for(SDDocumentImpl doc : docList) {
        if (doc instanceof SDDocument.WSDL) {
            SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)doc;
            if (wsdlDoc.hasService()) {
                primaryDoc = doc;
                if (foundConcrete) {
                    throw new ServerRtException("duplicate.primary.wsdl", doc.getSystemId() );
                }
                foundConcrete = true;
            }
            if (wsdlDoc.hasPortType()) {
                if (foundAbstract) {
                    throw new ServerRtException("duplicate.abstract.wsdl", doc.getSystemId());
                }
                foundAbstract = true;
            }
        }
    }
    return primaryDoc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:EndpointFactory.java


示例5: createDOM

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AbstractSchemaValidationTube.java


示例6: WSDLGenResolver

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
public WSDLGenResolver(@NotNull Collection<SDDocumentImpl> docs,QName serviceName,QName portTypeName) {
    this.docs = docs;
    this.serviceName = serviceName;
    this.portTypeName = portTypeName;

    for (SDDocumentImpl doc : docs) {
        if(doc.isWSDL()) {
            SDDocument.WSDL wsdl = (SDDocument.WSDL) doc;
            if(wsdl.hasPortType())
                abstractWsdl = doc;
        }
        if(doc.isSchema()) {
            SDDocument.Schema schema = (SDDocument.Schema) doc;
            List<SDDocumentImpl> sysIds = nsMapping.get(schema.getTargetNamespace());
            if (sysIds == null) {
                sysIds = new ArrayList<SDDocumentImpl>();
                nsMapping.put(schema.getTargetNamespace(), sysIds);
            }
            sysIds.add(doc);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:WSDLGenResolver.java


示例7: findPrimary

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
/**
 * Finds the primary WSDL document from the list of metadata documents. If
 * there are two metadata documents that qualify for primary, it throws an
 * exception. If there are two metadata documents that qualify for porttype,
 * it throws an exception.
 *
 * @return primay wsdl document, null if is not there in the docList
 *
 */
private static @Nullable SDDocumentImpl findPrimary(@NotNull Collection<SDDocumentImpl> docList) {
    SDDocumentImpl primaryDoc = null;
    boolean foundConcrete = false;
    boolean foundAbstract = false;
    for(SDDocumentImpl doc : docList) {
        if (doc instanceof SDDocument.WSDL) {
            SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)doc;
            if (wsdlDoc.hasService()) {
                primaryDoc = doc;
                if (foundConcrete) {
                    throw new ServerRtException("duplicate.primary.wsdl", doc.getSystemId() );
                }
                foundConcrete = true;
            }
            if (wsdlDoc.hasPortType()) {
                if (foundAbstract) {
                    throw new ServerRtException("duplicate.abstract.wsdl", doc.getSystemId());
                }
                foundAbstract = true;
            }
        }
    }
    return primaryDoc;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:EndpointFactory.java


示例8: ClientSchemaValidationTube

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
public ClientSchemaValidationTube(WSBinding binding, WSDLPort port, Tube next) {
    super(binding, next);
    this.port = port;
    if (port != null) {
        String primaryWsdl = port.getOwner().getParent().getLocation().getSystemId();
        MetadataResolverImpl mdresolver = new MetadataResolverImpl();
        Map<String, SDDocument> docs = MetadataUtil.getMetadataClosure(primaryWsdl, mdresolver, true);
        mdresolver = new MetadataResolverImpl(docs.values());
        Source[] sources = getSchemaSources(docs.values(), mdresolver);
        for(Source source : sources) {
            LOGGER.fine("Constructing client validation schema from = "+source.getSystemId());
            //printDOM((DOMSource)source);
        }
        if (sources.length != 0) {
            noValidation = false;
            sf.setResourceResolver(mdresolver);
            try {
                schema = sf.newSchema(sources);
            } catch(SAXException e) {
                throw new WebServiceException(e);
            }
            validator = schema.newValidator();
            return;
        }
    }
    noValidation = true;
    schema = null;
    validator = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ClientSchemaValidationTube.java


示例9: MetadataResolverImpl

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
public MetadataResolverImpl(Iterable<SDDocument> it) {
    for(SDDocument doc : it) {
        if (doc.isSchema()) {
            docs.put(doc.getURL().toExternalForm(), doc);
            nsMapping.put(((SDDocument.Schema)doc).getTargetNamespace(), doc);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:AbstractSchemaValidationTube.java


示例10: resolve

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
@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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:AbstractSchemaValidationTube.java


示例11: getMetadataClosure

import com.sun.xml.internal.ws.api.server.SDDocument; //导入依赖的package包/类
/**
 * Gets closure of all the referenced documents from the primary document(typically
 * the service WSDL). It traverses the WSDL and schema imports and builds a closure
 * set of documents.
 *
 * @param systemId primary wsdl or the any root document
 * @param resolver used to get SDDocumentImpl for a document
 * @param onlyTopLevelSchemas if true, the imported schemas from a schema would be ignored
 * @return all the documents
 */
public static Map<String, SDDocument> getMetadataClosure(@NotNull String systemId,
        @NotNull SDDocumentResolver resolver, boolean onlyTopLevelSchemas) {
    Map <String, SDDocument> closureDocs = new HashMap<String, SDDocument>();
    Set<String> remaining = new HashSet<String>();
    remaining.add(systemId);

    while(!remaining.isEmpty()) {
        Iterator<String> it = remaining.iterator();
        String current = it.next();
        remaining.remove(current);

        SDDocument currentDoc = resolver.resolve(current);
        SDDocument old = closureDocs.put(currentDoc.getURL().toExternalForm(), currentDoc);
        assert old == null;

        Set<String> imports =  currentDoc.getImports();
        if (!currentDoc.isSchema() || !onlyTopLevelSchemas) {
            for(String importedDoc : imports) {
                if (closureDocs.get(importedDoc) == null) {
                    remaining.add(importedDoc);
                }
            }
        }
    }

    return closureDocs;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:MetadataUtil.java



注:本文中的com.sun.xml.internal.ws.api.server.SDDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConstantsAPI类代码示例发布时间:2022-05-23
下一篇:
Java Response类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap