从字符串或字节数组生成 javax.wsdl.Definition

Generate javax.wsdl.Definition from a String or byte array

我有一个 wsdl 存储在 string/byte 数组中。有没有办法从字符串或字节数组生成 javax.wsdl.Definition ?我查看了文档 here 但找不到执行此操作的方法。

有任何示例或指示吗?

找到答案:

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) {}
    }