Java Code Examples for javax.wsdl.WSDLException#PARSER_ERROR
The following examples show how to use
javax.wsdl.WSDLException#PARSER_ERROR .
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: WSDLCorbaWriterImpl.java From cxf with Apache License 2.0 | 6 votes |
public Document getDocument(Definition wsdlDef) throws WSDLException { try { fixTypes(wsdlDef); } catch (Exception ex) { throw new WSDLException(WSDLException.PARSER_ERROR, ex.getMessage(), ex); } Document doc = wrapped.getDocument(wsdlDef); Element imp = null; Element child = DOMUtils.getFirstElement(doc.getDocumentElement()); //move extensability things to the top while (child != null) { if (child.getNamespaceURI().equals(doc.getDocumentElement().getNamespaceURI())) { //wsdl node if (imp == null) { imp = child; } } else if (imp != null) { doc.getDocumentElement().removeChild(child); doc.getDocumentElement().insertBefore(child, imp); } child = DOMUtils.getNextElement(child); } return doc; }
Example 2
Source File: WSDLManagerImpl.java From cxf with Apache License 2.0 | 5 votes |
public Definition getDefinition(final Element el) throws WSDLException { synchronized (definitionsMap) { if (definitionsMap.containsKey(el)) { return definitionsMap.get(el); } } final WSDLReader reader = factory.newWSDLReader(); reader.setFeature("javax.wsdl.verbose", false); reader.setExtensionRegistry(registry); final Definition def; // This is needed to avoid security exceptions when running with a security manager if (System.getSecurityManager() == null) { def = reader.readWSDL("", el); } else { try { def = AccessController.doPrivileged( (PrivilegedExceptionAction<Definition>) () -> reader.readWSDL("", el)); } catch (PrivilegedActionException paex) { throw new WSDLException(WSDLException.PARSER_ERROR, paex.getMessage(), paex); } } synchronized (definitionsMap) { definitionsMap.put(el, def); } return def; }
Example 3
Source File: JAXBExtensionHelper.java From cxf with Apache License 2.0 | 4 votes |
public void marshall(@SuppressWarnings("rawtypes") Class parent, QName qname, ExtensibilityElement obj, PrintWriter pw, final Definition wsdl, ExtensionRegistry registry) throws WSDLException { try { Marshaller u = createMarshaller(); u.setProperty("jaxb.encoding", StandardCharsets.UTF_8.name()); u.setProperty("jaxb.fragment", Boolean.TRUE); u.setProperty("jaxb.formatted.output", Boolean.TRUE); Object mObj = obj; Class<?> objectFactory = Class.forName(PackageUtils.getPackageName(typeClass) + ".ObjectFactory", true, obj.getClass().getClassLoader()); Method[] methods = objectFactory.getDeclaredMethods(); for (Method method : methods) { if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(typeClass)) { mObj = method.invoke(objectFactory.newInstance(), new Object[] {obj}); } } javax.xml.stream.XMLOutputFactory fact = javax.xml.stream.XMLOutputFactory.newInstance(); XMLStreamWriter writer = new PrettyPrintXMLStreamWriter(fact.createXMLStreamWriter(pw), 2, getIndentLevel(parent)); if (namespace != null && !namespace.equals(jaxbNamespace)) { Map<String, String> outMap = new HashMap<>(); outMap.put("{" + jaxbNamespace + "}*", "{" + namespace + "}*"); writer = new OutTransformWriter(writer, outMap, Collections.<String, String>emptyMap(), Collections.<String>emptyList(), false, ""); } Map<String, String> nspref = new HashMap<>(); for (Object ent : wsdl.getNamespaces().entrySet()) { Map.Entry<?, ?> entry = (Map.Entry<?, ?>)ent; nspref.put((String)entry.getValue(), (String)entry.getKey()); } JAXBUtils.setNamespaceMapper(nspref, u); u.marshal(mObj, writer); writer.flush(); } catch (Exception ex) { throw new WSDLException(WSDLException.PARSER_ERROR, "", ex); } }