从String或byte数组生成javax.wsdl.Definition

时间:2016-11-24 10:03:33

标签: java wsdl javax

我有一个存储在字符串/字节数组中的wsdl。有没有办法从String或字节数组生成javax.wsdl.Definition?我检查了文档here,但找不到办法。

任何样品或指针?

1 个答案:

答案 0 :(得分:1)

找到答案:

public void getWSDLDefinition(byte[] wsdl) {
        try {
            WSDLReader wsdlReader = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader();
            // switch off the verbose mode
            wsdlReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
            wsdlReader.setFeature("javax.wsdl.importDocuments", false);
            Definition wsdlDefinition = wsdlReader.readWSDL(null, new InputSource(new ByteArrayInputStream(wsdl)));
        } catch (Exception e) {}
    }