use of javax.wsdl.WSDLException in project cxf by apache.
the class AttributeVisitor method generateCorbaOperation.
/**
* Generates a corba:operation in the corba:binding container within a wsdl:binding.
*
* Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
*
* @param op is the wsdl operation to bind.
* @param param is the corba parameter, none if null.
* @param arg is the corba return parameter, none if null.
* @return the generated corba:operation.
*/
private OperationType generateCorbaOperation(Operation op, ParamType param, ArgType arg) {
final OperationType operation;
try {
operation = (OperationType) extReg.createExtension(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION);
} catch (WSDLException ex) {
throw new RuntimeException(ex);
}
operation.setName(op.getName());
if (param != null) {
operation.getParam().add(param);
}
if (arg != null) {
operation.setReturn(arg);
}
return operation;
}
use of javax.wsdl.WSDLException in project cxf by apache.
the class WSDLCorbaWriterImpl method getDocument.
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;
}
use of javax.wsdl.WSDLException 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.WSDLException in project cxf by apache.
the class WSDLToSoapProcessor method getSoapBody.
private SoapBody getSoapBody(Class<?> parent) throws ToolException {
if (extReg == null) {
extReg = wsdlFactory.newPopulatedExtensionRegistry();
}
final SoapBody soapBody;
try {
soapBody = SOAPBindingUtil.createSoapBody(extReg, parent, isSOAP12());
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
throw new ToolException(msg, wse);
}
soapBody.setUse((String) env.get(ToolConstants.CFG_USE));
if (WSDLConstants.RPC.equalsIgnoreCase((String) env.get(ToolConstants.CFG_STYLE)) && env.optionSet(ToolConstants.CFG_NAMESPACE)) {
soapBody.setNamespaceURI((String) env.get(ToolConstants.CFG_NAMESPACE));
}
return soapBody;
}
use of javax.wsdl.WSDLException in project cxf by apache.
the class WSDLToSoapProcessor method setSoapBindingExtElement.
private void setSoapBindingExtElement() throws ToolException {
if (extReg == null) {
extReg = wsdlFactory.newPopulatedExtensionRegistry();
}
SOAPBindingUtil.addSOAPNamespace(wsdlDefinition, isSOAP12());
final SoapBinding soapBinding;
try {
soapBinding = SOAPBindingUtil.createSoapBinding(extReg, isSOAP12());
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
throw new ToolException(msg, wse);
}
soapBinding.setStyle((String) env.get(ToolConstants.CFG_STYLE));
binding.addExtensibilityElement(soapBinding);
}
Aggregations