WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); wsdlWriter.writeWSDL(wsdlReader.readWSDL(null, argv[0]), System.out);
public static void writeSchema(Definition def, Writer outputWriter) throws WSDLException, IOException { SchemaFactory sfactory = new SchemaFactoryImpl(); WSDLWriter swriter = sfactory.newWSDLWriter(); swriter.writeWSDL(def, outputWriter); outputWriter.flush(); outputWriter.close(); } }
public String serializeWsdl(Definition wsdl) throws EndpointResolutionException { try { WSDLWriter writer = wsdlFactory.newWriter(); StringWriter stringWriter = new StringWriter(); writer.writeWSDL(wsdl, stringWriter); return stringWriter.toString(); } catch (WSDLException e) { throw new EndpointResolutionException(e); } }
public static void writeWSDL(Definition def, Writer outputWriter) throws WSDLException, IOException { WSDLCorbaFactory wsdlfactory = new WSDLCorbaFactoryImpl(); WSDLWriter writer = wsdlfactory.newWSDLWriter(); writer.writeWSDL(def, outputWriter); outputWriter.flush(); outputWriter.close(); }
public static void serialize(Definition definition, OutputStream stream) throws WSDLException { WSDLFactory factory = WSDLFactory.newInstance(); WSDLWriter writer = factory.newWSDLWriter(); writer.writeWSDL(definition, stream); }
public static void serialize(Definition definition, Writer writer) throws WSDLException { WSDLFactory factory = WSDLFactory.newInstance(); WSDLWriter wsdlWriter = factory.newWSDLWriter(); wsdlWriter.writeWSDL(definition, writer); }
/** * Serializes the contents of a parsed WSDL as a string. * * @param wsdl the WSDL * @return the serialized WSDL * @throws GenerationException if an error occurs reading the URL */ private String serializeToString(Definition wsdl) throws GenerationException { try { WSDLWriter writer = wsdlFactory.newWriter(); StringWriter stringWriter = new StringWriter(); writer.writeWSDL(wsdl, stringWriter); return stringWriter.toString(); } catch (WSDLException e) { throw new GenerationException(e); } }
/** * @return Returns a String representation of this WSDLFile. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("\n" + getClass().getName()); //$NON-NLS-1$ sb.append("\ngetName()=" + getName()); //$NON-NLS-1$ StringWriter sw = new StringWriter(); // Write Definition try { WSDLFactory factory = WSDLFactory.newInstance(); WSDLWriter writer = factory.newWSDLWriter(); writer.writeWSDL(def, sw); } catch (WSDLException e) { sb.append(getI18n().getMessage("WSDLFile.writeDefError")); //$NON-NLS-1$ } sb.append(sw.getBuffer().toString()); return sb.toString(); }
/** * @return Returns a String representation of this WSDLFile. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("\n" + getClass().getName()); //$NON-NLS-1$ sb.append("\ngetName()=" + getName()); //$NON-NLS-1$ StringWriter sw = new StringWriter(); // Write Definition try { WSDLFactory factory = WSDLFactory.newInstance(); WSDLWriter writer = factory.newWSDLWriter(); writer.writeWSDL(def, sw); } catch (WSDLException e) { sb.append(getI18n().getMessage("WSDLFile.writeDefError")); //$NON-NLS-1$ } sb.append(sw.getBuffer().toString()); return sb.toString(); }
private boolean writeDefinition() { WSDLWriter writer = wsdlFactory.newWSDLWriter(); java.io.File file = new java.io.File(wsdlFile); java.io.OutputStream outstream = null; try { outstream = new java.io.FileOutputStream(file); } catch (java.io.FileNotFoundException e) { throw new ToolException(e.getMessage(), e); } try { writer.writeWSDL(this.definition, outstream); } catch (javax.wsdl.WSDLException e) { throw new ToolException(e.getMessage(), e); } return true; }
/** * Retrieves a {@link ByteArrayOutputStream} for provided {@link Definition}. * * @param definition WSDL Definition * @return A {@link ByteArrayOutputStream} for provided {@link Definition} * @throws APIMgtWSDLException If an error occurs while creating {@link ByteArrayOutputStream} */ private ByteArrayOutputStream getWSDLByteArrayOutputStream(Definition definition) throws APIMgtWSDLException { WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { writer.writeWSDL(definition, byteArrayOutputStream); } catch (WSDLException e) { throw new APIMgtWSDLException("Error while stringifying WSDL definition", e, ExceptionCodes.INTERNAL_WSDL_EXCEPTION); } return byteArrayOutputStream; }
public static void writeWsdl(final Definition wsdlDefinition, final OutputStream sink) { try { final WSDLWriter wsdlReader = WSDLFactory.newInstance().newWSDLWriter(); wsdlReader.writeWSDL(wsdlDefinition, sink); } catch (final Exception e) { throw new WsdlException("Problem while writing wsdl:", e); } }
/** * Retrieves a {@link ByteArrayOutputStream} for provided {@link Definition}. * * @param definition WSDL Definition * @return A {@link ByteArrayOutputStream} for provided {@link Definition} * @throws APIMgtWSDLException If an error occurs while creating {@link ByteArrayOutputStream} */ private ByteArrayOutputStream getWSDLByteArrayOutputStream(Definition definition) throws APIMgtWSDLException { WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { writer.writeWSDL(definition, byteArrayOutputStream); } catch (WSDLException e) { throw new APIMgtWSDLException("Error while stringifying WSDL definition", e, ExceptionCodes.INTERNAL_WSDL_EXCEPTION); } return byteArrayOutputStream; }
public void write(OutputStream out) throws IOException { try { javax.wsdl.xml.WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); writer.writeWSDL(def, out); } catch (WSDLException e) { throw new XFireRuntimeException("Could not write wsdl definition!", e); } } }
private void writeWSDLFile( IWorkspaceRoot workspace, Definition wsdlDef, IPath wsdlPath, IEnvironment env, IProgressMonitor monitor) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); //WSDLFactory wsdlFactory = WSDLFactory.newInstance(); //WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); WSDLWriter wsdlWriter = (new org.eclipse.wst.wsdl.internal.impl.wsdl4j.WSDLFactoryImpl()).newWSDLWriter(); wsdlWriter.writeWSDL(wsdlDef, baos); byte[] b = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ResourceContext context = ((BaseEclipseEnvironment)env).getResourceContext(); FileResourceUtils.createFile( context, wsdlPath.makeAbsolute(), bais, monitor, env.getStatusHandler()); baos.close(); bais.close(); }
private void writeToWSDL() throws ToolException { WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER); try { wsdlWriter.writeWSDL(wsdlDefinition, outputWriter); } catch (WSDLException wse) { Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG); throw new ToolException(msg); } try { outputWriter.close(); } catch (IOException ioe) { Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG); throw new ToolException(msg); } }
private void writeToWSDL() throws ToolException { WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER); try { wsdlWriter.writeWSDL(wsdlDefinition, outputWriter); } catch (WSDLException wse) { Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG); throw new ToolException(msg); } try { outputWriter.close(); } catch (IOException ioe) { Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG); throw new ToolException(msg); } }
private void writeToWSDL() throws ToolException { WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER); try { wsdlWriter.writeWSDL(wsdlDefinition, outputWriter); } catch (WSDLException wse) { Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG); throw new ToolException(msg); } try { outputWriter.close(); } catch (IOException ioe) { Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG); throw new ToolException(msg); } }
/** * Prints the given definition object. * @param definition The definition. * @param out The output stream the data to be written to. NOTE: the stream is not closed after the operation, * it is the responsibility of the caller to close the stream after usage. * @param requestIP The host IP address. * @throws AxisFault * @throws WSDLException */ private synchronized void printDefinitionObject(Definition definition, OutputStream out, String requestIP) throws AxisFault, WSDLException { // Synchronized this method to fix the NullPointer exception occurred when load is high. // This error happens because wsdl4j is not thread safe and we are using same WSDL Definition for printing the // WSDL. // Please refer AXIS2-4511,AXIS2-4517,AXIS2-3276. if (isModifyUserWSDLPortAddress()) { setPortAddress(definition, requestIP); } if (!wsdlImportLocationAdjusted) { changeImportAndIncludeLocations(definition); wsdlImportLocationAdjusted = true; } WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); writer.writeWSDL(definition, out); }
private void doAppendBinding() throws ToolException { if (binding == null) { binding = wsdlDefinition.createBinding(); binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), (String)env.get(ToolConstants.CFG_BINDING))); binding.setUndefined(false); binding.setPortType(portType); } setSoapBindingExtElement(); addBindingOperation(); wsdlDefinition.addBinding(binding); WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER); try { wsdlWriter.writeWSDL(wsdlDefinition, outputWriter); } catch (WSDLException wse) { Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG, wse.getMessage()); throw new ToolException(msg); } try { outputWriter.close(); } catch (IOException ioe) { Message msg = new Message("PORTTYPE_NOT_EXIST", LOG); throw new ToolException(msg); } }