use of org.apache.cxf.common.i18n.Message 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 org.apache.cxf.common.i18n.Message 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 org.apache.cxf.common.i18n.Message 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 org.apache.cxf.common.i18n.Message in project cxf by apache.
the class UniqueBodyValidator method isValidEndpoint.
private boolean isValidEndpoint(EndpointInfo endpoint) {
BindingInfo binding = endpoint.getBinding();
Map<QName, QName> uniqueNames = new HashMap<>();
Map<QName, Set<String>> actions = new HashMap<>();
Collection<BindingOperationInfo> bos = binding.getOperations();
for (BindingOperationInfo bo : bos) {
OperationInfo op = binding.getInterface().getOperation(bo.getName());
if (op.getInput() != null && op.getInput().getMessagePartsNumber() == 1) {
MessagePartInfo part = op.getInput().getFirstMessagePart();
if (part.getElementQName() == null) {
continue;
}
QName mName = part.getElementQName();
String action = getWSAAction(op.getInput());
QName opName = uniqueNames.get(mName);
Set<String> opActions = actions.get(mName);
if (opName != null && opActions != null && !opActions.contains(action)) {
opName = null;
}
if (opName != null) {
Message msg = new Message("NON_UNIQUE_BODY", LOG, endpoint.getName(), op.getName(), opName, mName);
addErrorMessage(msg.toString());
return false;
}
uniqueNames.put(mName, op.getName());
if (action != null) {
if (opActions == null) {
opActions = new HashSet<>();
actions.put(mName, opActions);
}
opActions.add(action);
}
}
for (BindingFaultInfo fault : bo.getFaults()) {
if (fault.getFaultInfo().getMessagePartsNumber() > 1) {
Message msg = new Message("FAULT_WITH_MULTIPLE_PARTS", LOG, fault.getFaultInfo().getName().getLocalPart());
addErrorMessage(msg.toString());
return false;
}
}
}
return true;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WrapperStyleNameCollisionValidator method handleErrors.
private void handleErrors(QName e1, WrapperElement e2) {
Message msg = new Message("WRAPPER_STYLE_NAME_COLLISION", LOG, e2.getElementName(), e1, e2.getSchemaTypeName());
addErrorMessage(msg.toString());
}
Aggregations