use of javax.wsdl.Message in project cxf by apache.
the class WSDLParameter method processWrappedOutputParams.
private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
Output output = operation.getOutput();
if (output != null) {
Message msg = output.getMessage();
Part part = (Part) msg.getOrderedParts(null).iterator().next();
XmlSchemaComplexType schemaType = null;
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el == null) {
return;
}
if (el.getSchemaType() != null) {
schemaType = (XmlSchemaComplexType) el.getSchemaType();
}
XmlSchemaSequence seq = (XmlSchemaSequence) schemaType.getParticle();
if (seq != null) {
for (XmlSchemaSequenceMember seqMember : seq.getItems()) {
if (seqMember instanceof XmlSchemaElement) {
el = (XmlSchemaElement) seqMember;
processWrappedOutputParam(wsdlToCorbaBinding, el, inputs, outputs);
}
}
}
}
}
use of javax.wsdl.Message in project cxf by apache.
the class WSDLParameter method processInputParams.
private void processInputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs) throws Exception {
Input input = operation.getInput();
if (input != null) {
Message msg = input.getMessage();
List<Part> parts = CastUtils.cast(msg.getOrderedParts(null));
for (Part part : parts) {
XmlSchemaType schemaType = null;
boolean isObjectRef = isObjectReference(xmlSchemaList, part.getElementName());
if (part.getElementName() != null && !isObjectRef) {
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el != null) {
if (el.getSchemaType() != null) {
schemaType = el.getSchemaType();
}
QName typeName = el.getSchemaTypeName();
if (typeName == null) {
typeName = el.getQName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
ParamType paramtype = createParam(wsdlToCorbaBinding, "in", part.getName(), idltype);
if (paramtype != null) {
inputs.add(paramtype);
}
}
} else if (part.getTypeName() != null) {
schemaType = getType(part, xmlSchemaList);
QName typeName = part.getTypeName();
if (isObjectRef) {
typeName = part.getElementName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
ParamType paramtype = createParam(wsdlToCorbaBinding, "in", part.getName(), idltype);
if (paramtype != null) {
inputs.add(paramtype);
}
}
}
}
}
use of javax.wsdl.Message in project cxf by apache.
the class WSDLParameter method processOutputParams.
private void processOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
Output output = operation.getOutput();
if (output != null) {
Message msg = output.getMessage();
List<Part> parts = CastUtils.cast(msg.getOrderedParts(null));
for (Part part : parts) {
XmlSchemaType schemaType = null;
// check if in input list
String mode = "out";
ParamType paramtype = null;
boolean isObjectRef = isObjectReference(xmlSchemaList, part.getElementName());
for (int x = 0; x < inputs.size(); x++) {
paramtype = null;
ParamType d2 = inputs.get(x);
if (part.getElementName() != null && !isObjectRef) {
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el != null) {
if (el.getSchemaType() != null) {
schemaType = el.getSchemaType();
}
QName typeName = el.getSchemaTypeName();
if (typeName == null) {
typeName = el.getQName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
inputs.remove(x);
paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
inputs.add(paramtype);
}
}
} else {
schemaType = getType(part, xmlSchemaList);
QName typeName = part.getTypeName();
if (isObjectRef) {
typeName = part.getElementName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
inputs.remove(x);
paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
inputs.add(paramtype);
}
}
}
if (paramtype == null) {
if (part.getElementName() != null && !isObjectRef) {
XmlSchemaElement el = getElement(part, xmlSchemaList);
QName typeName = el.getSchemaTypeName();
if (typeName == null) {
typeName = el.getQName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
} else {
QName typeName = part.getTypeName();
if (isObjectRef) {
typeName = part.getElementName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
}
if (paramtype != null) {
outputs.add(paramtype);
}
}
}
}
}
use of javax.wsdl.Message in project cxf by apache.
the class OperationVisitor method generateOutputMessage.
public Message generateOutputMessage(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() + RESPONSE_SUFFIX);
} else {
msgName = new QName(definition.getTargetNamespace(), operation.getName() + RESPONSE_SUFFIX);
}
msg.setQName(msgName);
msg.setUndefined(false);
String outputName = operation.getName() + RESPONSE_SUFFIX;
Output output = definition.createOutput();
output.setName(outputName);
output.setMessage(msg);
BindingOutput bindingOutput = definition.createBindingOutput();
bindingOutput.setName(outputName);
bindingOperation.setBindingOutput(bindingOutput);
operation.setOutput(output);
definition.addMessage(msg);
return msg;
}
use of javax.wsdl.Message in project cxf by apache.
the class OperationVisitor method createFaultMessage.
private void createFaultMessage(CorbaTypeImpl corbaType, Operation operation, BindingOperation bindingOperation, QName elementQName) {
String exceptionName = corbaType.getQName().getLocalPart();
Definition faultDef = manager.getWSDLDefinition(elementQName.getNamespaceURI());
if (faultDef == null) {
faultDef = definition;
}
Message faultMsg = faultDef.getMessage(new QName(faultDef.getTargetNamespace(), exceptionName));
if (faultMsg == null) {
throw new RuntimeException("Fault message for exception " + exceptionName + " not found");
}
// porttype - operation - fault
Fault fault = definition.createFault();
fault.setMessage(faultMsg);
fault.setName(faultMsg.getQName().getLocalPart());
operation.addFault(fault);
// binding - operation - corba:operation - corba:raises
RaisesType raisesType = new RaisesType();
raisesType.setException(new QName(typeMap.getTargetNamespace(), exceptionName));
corbaOperation.getRaises().add(raisesType);
// binding - operation - fault
BindingFault bindingFault = definition.createBindingFault();
bindingFault.setName(faultMsg.getQName().getLocalPart());
bindingOperation.addBindingFault(bindingFault);
// add the fault element namespace to the definition
String nsURI = elementQName.getNamespaceURI();
manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);
}
Aggregations