use of org.pentaho.di.trans.steps.webservices.wsdl.WsdlOperationContainer in project pentaho-kettle by pentaho.
the class WebServiceDialog method loadOperation.
private void loadOperation(String anOperationName) throws KettleException {
wsdlOperation = null;
inWsdlParamContainer = null;
outWsdlParamContainer = null;
if (wsdl != null) {
for (Iterator<WsdlOperation> vItOperation = wsdl.getOperations().iterator(); vItOperation.hasNext() && wsdlOperation == null; ) {
WsdlOperation vCurrentOperation = vItOperation.next();
if (vCurrentOperation.getOperationQName().getLocalPart().equals(anOperationName)) {
wsdlOperation = vCurrentOperation;
}
}
}
if (wsdlOperation != null) {
// figure out the request name
//
String request = "";
WsdlOpParameterList parameters = wsdlOperation.getParameters();
if (parameters != null && parameters.getOperation() != null && parameters.getOperation().getInput() != null && parameters.getOperation().getInput().getName() != null) {
request = wsdlOperation.getParameters().getOperation().getInput().getName().toString();
}
wOperationRequest.setText(request);
for (int cpt = 0; cpt < wsdlOperation.getParameters().size(); cpt++) {
WsdlOpParameter param = wsdlOperation.getParameters().get(cpt);
if (param.isArray()) {
// setInFieldArgumentName(param.getName().getLocalPart());
if (param.getItemXmlType() != null) {
ComplexType type = param.getItemComplexType();
if (type != null) {
for (Iterator<String> itrType = type.getElementNames().iterator(); itrType.hasNext(); ) {
String attributeName = itrType.next();
QName attributeType = type.getElementType(attributeName);
if (!WebServiceMeta.XSD_NS_URI.equals(attributeType.getNamespaceURI())) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0007.UnsupporteOperation.ComplexType"));
}
}
}
if (ParameterMode.IN.equals(param.getMode()) || ParameterMode.INOUT.equals(param.getMode()) || ParameterMode.UNDEFINED.equals(param.getMode())) {
if (inWsdlParamContainer != null) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0006.UnsupportedOperation.MultipleArrays"));
} else {
inWsdlParamContainer = new WsdlOpParameterContainer(param);
}
} else if (ParameterMode.OUT.equals(param.getMode()) || ParameterMode.INOUT.equals(param.getMode()) || ParameterMode.UNDEFINED.equals(param.getMode())) {
if (outWsdlParamContainer != null) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0006.UnsupportedOperation.MultipleArrays"));
} else {
outWsdlParamContainer = new WsdlOpParameterContainer(param);
}
}
}
} else {
if (ParameterMode.IN.equals(param.getMode()) || ParameterMode.INOUT.equals(param.getMode()) || ParameterMode.UNDEFINED.equals(param.getMode())) {
if (inWsdlParamContainer != null && !(inWsdlParamContainer instanceof WsdlOperationContainer)) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0008.UnsupportedOperation.IncorrectParams"));
} else {
inWsdlParamContainer = new WsdlOperationContainer(wsdlOperation, param.getMode());
}
} else if (ParameterMode.OUT.equals(param.getMode()) || ParameterMode.INOUT.equals(param.getMode()) || ParameterMode.UNDEFINED.equals(param.getMode())) {
if (outWsdlParamContainer != null && !(outWsdlParamContainer instanceof WsdlOperationContainer)) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0008.UnsupportedOperation.IncorrectParams"));
} else {
outWsdlParamContainer = new WsdlOperationContainer(wsdlOperation, param.getMode());
}
} else {
System.out.println("Parameter : " + param.getName().getLocalPart() + ", mode=" + param.getMode().toString() + ", is not considered");
}
}
}
if (wsdlOperation.getReturnType() != null) {
outWsdlParamContainer = new WsdlOpParameterContainer((WsdlOpParameter) wsdlOperation.getReturnType());
if (wsdlOperation.getReturnType().isArray()) {
if (wsdlOperation.getReturnType().getItemXmlType() != null) {
ComplexType type = wsdlOperation.getReturnType().getItemComplexType();
if (type != null) {
for (Iterator<String> itrType = type.getElementNames().iterator(); itrType.hasNext(); ) {
String attributeName = itrType.next();
QName attributeType = type.getElementType(attributeName);
if (!WebServiceMeta.XSD_NS_URI.equals(attributeType.getNamespaceURI())) {
throw new KettleStepException(BaseMessages.getString(PKG, "WebServiceDialog.ERROR0007.UnsupportedOperation.ComplexType"));
}
}
}
}
}
}
}
}
Aggregations