use of javax.wsdl.xml.WSDLWriter in project cxf by apache.
the class WSDLToServiceProcessor method doAppendService.
private void doAppendService() throws ToolException {
if (service == null) {
service = wsdlDefinition.createService();
service.setQName(new QName(WSDLConstants.WSDL_PREFIX, (String) env.get(ToolConstants.CFG_SERVICE)));
}
if (port == null) {
port = wsdlDefinition.createPort();
port.setName((String) env.get(ToolConstants.CFG_PORT));
port.setBinding(binding);
}
setAddrElement();
service.addPort(port);
wsdlDefinition.addService(service);
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, wse);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
throw new ToolException(msg, ioe);
}
}
use of javax.wsdl.xml.WSDLWriter in project cxf by apache.
the class WSDLToSoapProcessor method doAppendBinding.
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);
}
}
use of javax.wsdl.xml.WSDLWriter in project cxf by apache.
the class XSDToWSDLProcessor method addWSDLTypes.
private void addWSDLTypes() throws ToolException {
Element sourceElement = this.xsdDoc.getDocumentElement();
Element targetElement = (Element) sourceElement.cloneNode(true);
this.wsdlDefinition.setTargetNamespace((String) env.get(ToolConstants.CFG_NAMESPACE));
this.wsdlDefinition.setQName(new QName(WSDLConstants.NS_WSDL11, (String) env.get(ToolConstants.CFG_NAME)));
Types types = this.wsdlDefinition.createTypes();
ExtensibilityElement extElement;
try {
registry = wsdlFactory.newPopulatedExtensionRegistry();
registerJAXWSBinding(Definition.class);
registerJAXWSBinding(Types.class);
registerJAXWSBinding(Schema.class);
extElement = registry.createExtension(Types.class, WSDLConstants.QNAME_SCHEMA);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SCHEMA_EXTENSION", LOG);
throw new ToolException(msg, wse);
}
((Schema) extElement).setElement(targetElement);
types.addExtensibilityElement(extElement);
this.wsdlDefinition.setTypes(types);
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
Writer outputWriter = getOutputWriter();
try {
wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
throw new ToolException(msg, wse);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
throw new ToolException(msg, ioe);
}
}
use of javax.wsdl.xml.WSDLWriter in project jbossws-cxf by jbossws.
the class WSDLFilePublisher method getWsdlDocument.
private static Document getWsdlDocument(Bus bus, Definition def) throws WSDLException {
WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
return wsdlWriter.getDocument(def);
}
use of javax.wsdl.xml.WSDLWriter in project cxf by apache.
the class AbstractAegisTest method getWSDLDocument.
protected Document getWSDLDocument(String string) throws WSDLException {
Definition definition = getWSDLDefinition(string);
if (definition == null) {
return null;
}
WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
return writer.getDocument(definition);
}
Aggregations