use of javax.wsdl.Message in project tdi-studio-se by Talend.
the class ComponentBuilder method buildOperation.
private OperationInfo buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
Operation oper = bindingOper.getOperation();
operationInfo.setTargetMethodName(oper.getName());
Vector operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else if (operElem != null && operElem instanceof SOAP12Operation) {
SOAP12Operation soapOperation = (SOAP12Operation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
}
BindingInput bindingInput = bindingOper.getBindingInput();
BindingOutput bindingOutput = bindingOper.getBindingOutput();
Vector bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.elementAt(0);
if (bodyElem != null && bodyElem instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) bodyElem;
List styles = soapBody.getEncodingStyles();
String encodingStyle = null;
if (styles != null) {
encodingStyle = styles.get(0).toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
} else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) bodyElem;
String encodingStyle = null;
if (soapBody.getEncodingStyle() != null) {
encodingStyle = soapBody.getEncodingStyle().toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
}
Input inDef = oper.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, inMsg, 1);
operationInfo.setInmessage(inMsg);
}
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
operationInfo.setOutputMessageName(outMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, outMsg, 2);
operationInfo.setOutmessage(outMsg);
}
}
return operationInfo;
}
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 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 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 AttributeVisitor method generateGetter.
private void generateGetter(AST typeNode, AST nameNode) {
// generate wrapped doc element in parameter
XmlSchemaElement inParameters = generateWrappedDocElement(null, GETTER_PREFIX + nameNode.toString(), PARAM_NAME);
// generate wrapped doc element out parameter
XmlSchemaElement outParameters = generateWrappedDocElement(typeNode, GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
// generate input message
Message inMsg = generateMessage(inParameters, GETTER_PREFIX + nameNode.toString());
// generate output message
Message outMsg = generateMessage(outParameters, GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
// generate operation
String name = GETTER_PREFIX + nameNode.toString();
Operation op = generateOperation(name, inMsg, outMsg);
// generate corba return param
ArgType corbaReturn = generateCorbaReturnParam(typeNode);
// generate corba operation
OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn);
// generate binding
generateCorbaBindingOperation(binding, op, corbaOp);
}
Aggregations