use of javax.wsdl.WSDLException in project cxf by apache.
the class WSDLToSoapProcessor method setSoapOperationExtElement.
private void setSoapOperationExtElement(BindingOperation bo) throws ToolException {
if (extReg == null) {
extReg = wsdlFactory.newPopulatedExtensionRegistry();
}
final SoapOperation soapOperation;
try {
soapOperation = SOAPBindingUtil.createSoapOperation(extReg, isSOAP12());
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
throw new ToolException(msg, wse);
}
soapOperation.setStyle((String) env.get(ToolConstants.CFG_STYLE));
soapOperation.setSoapActionURI("");
bo.addExtensibilityElement(soapOperation);
}
use of javax.wsdl.WSDLException 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.WSDLException in project cxf by apache.
the class WSDLToSoapProcessor method setSoapFaultExtElement.
private void setSoapFaultExtElement(BindingFault bf) throws ToolException {
if (extReg == null) {
extReg = wsdlFactory.newPopulatedExtensionRegistry();
}
final SoapFault soapFault;
try {
soapFault = SOAPBindingUtil.createSoapFault(extReg, isSOAP12());
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
throw new ToolException(msg, wse);
}
soapFault.setName(bf.getName());
soapFault.setUse((String) env.get(ToolConstants.CFG_USE));
if (WSDLConstants.RPC.equalsIgnoreCase((String) env.get(ToolConstants.CFG_STYLE)) && env.optionSet(ToolConstants.CFG_NAMESPACE)) {
soapFault.setNamespaceURI((String) env.get(ToolConstants.CFG_NAMESPACE));
}
bf.addExtensibilityElement(soapFault);
}
use of javax.wsdl.WSDLException 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.WSDLException in project cxf by apache.
the class WSDLToServiceProcessor method setAddrElement.
private void setAddrElement() throws ToolException {
String transport = (String) env.get(ToolConstants.CFG_TRANSPORT);
Address address = AddressFactory.getInstance().getAddresser(transport);
Map<String, String> ns = address.getNamespaces(env);
for (Map.Entry<String, String> entry : ns.entrySet()) {
wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
}
WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
try {
ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
port.addExtensibilityElement(extElement);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
throw new ToolException(msg, wse);
}
}
Aggregations