use of javax.wsdl.Input in project carbon-apimgt by wso2.
the class WSDL11SOAPOperationExtractor method getSoapInputParameterModel.
/**
* Gets swagger input parameter model for a given soap operation
*
* @param bindingOperation soap operation
* @return list of swagger models for the parameters
* @throws APIMgtWSDLException
*/
private List<ModelImpl> getSoapInputParameterModel(BindingOperation bindingOperation) throws APIMgtWSDLException {
List<ModelImpl> inputParameterModelList = new ArrayList<>();
Operation operation = bindingOperation.getOperation();
if (operation != null) {
Input input = operation.getInput();
if (input != null) {
Message message = input.getMessage();
if (message != null) {
Map map = message.getParts();
for (Object obj : map.entrySet()) {
Map.Entry entry = (Map.Entry) obj;
Part part = (Part) entry.getValue();
if (part != null) {
if (part.getElementName() != null) {
inputParameterModelList.add(parameterModelMap.get(part.getElementName().getLocalPart()));
} else {
if (part.getTypeName() != null && parameterModelMap.containsKey(part.getTypeName().getLocalPart())) {
inputParameterModelList.add(parameterModelMap.get(part.getTypeName().getLocalPart()));
} else if (part.getTypeName() != null && parameterModelMap.containsKey(message.getQName().getLocalPart())) {
ModelImpl model = parameterModelMap.get(message.getQName().getLocalPart());
model.addProperty(part.getName(), getPropertyFromDataType(part.getTypeName().getLocalPart()));
parameterModelMap.put(model.getName(), model);
inputParameterModelList.add(model);
} else {
ModelImpl model;
if (parameterModelMap.get(message.getQName().getLocalPart()) != null) {
model = parameterModelMap.get(message.getQName().getLocalPart());
} else {
model = new ModelImpl();
model.setType(ObjectProperty.TYPE);
model.setName(message.getQName().getLocalPart());
}
if (getPropertyFromDataType(part.getTypeName().getLocalPart()) instanceof RefProperty) {
RefProperty property = (RefProperty) getPropertyFromDataType(part.getTypeName().getLocalPart());
property.set$ref(SOAPToRESTConstants.Swagger.DEFINITIONS_ROOT + part.getTypeName().getLocalPart());
model.addProperty(part.getName(), property);
} else {
model.addProperty(part.getName(), getPropertyFromDataType(part.getTypeName().getLocalPart()));
}
parameterModelMap.put(model.getName(), model);
inputParameterModelList.add(model);
}
}
}
}
}
}
}
return inputParameterModelList;
}
use of javax.wsdl.Input in project cxf by apache.
the class WSDLHelper method getInMessageParts.
public List<Part> getInMessageParts(Operation operation) {
Input input = operation.getInput();
List<Part> partsList = new ArrayList<>();
if (input != null && input.getMessage() != null) {
Collection<Part> parts = CastUtils.cast(input.getMessage().getParts().values());
for (Part p : parts) {
partsList.add(p);
}
}
return partsList;
}
use of javax.wsdl.Input in project cxf by apache.
the class WSDLServiceBuilder method buildInterfaceOperation.
private void buildInterfaceOperation(InterfaceInfo inf, Operation op) {
OperationInfo opInfo = inf.addOperation(new QName(inf.getName().getNamespaceURI(), op.getName()));
if (recordOriginal) {
opInfo.setProperty(WSDL_OPERATION, op);
}
copyDocumentation(opInfo, op);
List<String> porderList = CastUtils.cast((List<?>) op.getParameterOrdering());
opInfo.setParameterOrdering(porderList);
this.copyExtensors(opInfo, op.getExtensibilityElements());
this.copyExtensionAttributes(opInfo, op);
Input input = op.getInput();
if (input != null) {
if (input.getMessage() == null) {
throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "input", op.getName(), input.getName());
}
MessageInfo minfo = opInfo.createMessage(input.getMessage().getQName(), MessageInfo.Type.INPUT);
opInfo.setInput(input.getName(), minfo);
buildMessage(minfo, input.getMessage());
copyExtensors(minfo, input.getExtensibilityElements());
copyExtensionAttributes(minfo, input);
}
Output output = op.getOutput();
if (output != null) {
if (output.getMessage() == null) {
throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "output", op.getName(), output.getName());
}
MessageInfo minfo = opInfo.createMessage(output.getMessage().getQName(), MessageInfo.Type.OUTPUT);
opInfo.setOutput(output.getName(), minfo);
buildMessage(minfo, output.getMessage());
copyExtensors(minfo, output.getExtensibilityElements());
copyExtensionAttributes(minfo, output);
}
Map<?, ?> m = op.getFaults();
for (Map.Entry<?, ?> rawentry : m.entrySet()) {
Map.Entry<String, Fault> entry = cast(rawentry, String.class, Fault.class);
FaultInfo finfo = opInfo.addFault(new QName(inf.getName().getNamespaceURI(), entry.getKey()), entry.getValue().getMessage().getQName());
copyDocumentation(finfo, entry.getValue());
buildMessage(finfo, entry.getValue().getMessage());
copyExtensors(finfo, entry.getValue().getExtensibilityElements());
copyExtensionAttributes(finfo, entry.getValue());
}
checkForWrapped(opInfo, allowRefs, false, unwrapLogLevel);
}
use of javax.wsdl.Input in project cxf by apache.
the class OperationVisitor method generateInputMessage.
public Message generateInputMessage(Operation operation, BindingOperation bindingOperation) {
Message msg = definition.createMessage();
QName msgName;
if (!mapper.isDefaultMapping()) {
// mangle the message name
// REVISIT, do we put in the entire scope for mangling
msgName = new QName(definition.getTargetNamespace(), getScope().tail() + "." + operation.getName());
} else {
msgName = new QName(definition.getTargetNamespace(), operation.getName());
}
msg.setQName(msgName);
msg.setUndefined(false);
String inputName = operation.getName() + REQUEST_SUFFIX;
Input input = definition.createInput();
input.setName(inputName);
input.setMessage(msg);
BindingInput bindingInput = definition.createBindingInput();
bindingInput.setName(inputName);
bindingOperation.setBindingInput(bindingInput);
operation.setInput(input);
definition.addMessage(msg);
return msg;
}
use of javax.wsdl.Input in project cxf by apache.
the class AttributeVisitor method generateOperation.
private Operation generateOperation(String name, Message inputMsg, Message outputMsg) {
Input input = definition.createInput();
input.setName(inputMsg.getQName().getLocalPart());
input.setMessage(inputMsg);
Output output = definition.createOutput();
output.setName(outputMsg.getQName().getLocalPart());
output.setMessage(outputMsg);
Operation result = definition.createOperation();
result.setName(name);
result.setInput(input);
result.setOutput(output);
result.setUndefined(false);
portType.addOperation(result);
return result;
}
Aggregations