Boa tarde!
Através dos webservices do protheus (WSMATA410), via SOAPUI realizei o insert de pedido de venda com o metodo INCLUI a baixo:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://192.168.0.113:8079/">
<soapenv:Header/>
<soapenv:Body>
<ns:INCLUI>
<ns:SPEDIDOVENDA>
<ns:SCAB>
<ns:C5_CLIENTE>00000027</ns:C5_CLIENTE>
<ns:C5_CONDPAG>001</ns:C5_CONDPAG>
<ns:C5_EMPRESA>01</ns:C5_EMPRESA>
<ns:C5_FILIAL>01</ns:C5_FILIAL>
<ns:C5_LOJACLI>01</ns:C5_LOJACLI>
<ns:C5_TIPO>N</ns:C5_TIPO>
<ns:C5_TIPOCLI>F</ns:C5_TIPOCLI>
</ns:SCAB>
<ns:SCOR>
<!--Zero or more repetitions:-->
<ns:CTCORSC6>
<ns:C6_ITEM>1</ns:C6_ITEM>
<ns:C6_PRCVEN>10</ns:C6_PRCVEN>
<ns:C6_PRODUTO>000001</ns:C6_PRODUTO>
<ns:C6_QTDVEN>3</ns:C6_QTDVEN>
</ns:CTCORSC6>
</ns:SCOR>
</ns:SPEDIDOVENDA>
</ns:INCLUI>
</soapenv:Body>
</soapenv:Envelope>
Criei um DATASET SIMPLES no fluig pelo painel de controle para realizar o mesmo cadastro realizado via SOAPUI, e passei os parametros conforme exemplo do SOAPUI:
function createDataset(fields, constraints, sortFields) {
try {
return processResult(callService(fields, constraints, sortFields));
} catch(e) {
return processErrorResult(e, constraints);
}
}
function callService(fields, constraints, sortFields) {
var serviceData = data();
var params = serviceData.inputValues;
var assigns = serviceData.inputAssignments;
verifyConstraints(serviceData.inputValues, constraints);
var serviceHelper = ServiceManager.getService(serviceData.fluigService);
var serviceLocator = serviceHelper.instantiate(serviceData.locatorClass);
var service = serviceLocator.getWSMATA410SOAP();
var response = service.inclui(fillSTPEDIDOVENDA(serviceHelper, params.spedidovenda, assigns.spedidovenda));
return response;
}
function defineStructure() {
addColumn('response');
}
function onSync(lastSyncDate) {
var serviceData = data();
var synchronizedDataset = DatasetBuilder.newDataset();
try {
var resultDataset = processResult(callService());
if (resultDataset != null) {
var values = resultDataset.getValues();
for (var i = 0; i < values.length; i++) {
synchronizedDataset.addRow(values[i]);
}
}
} catch(e) {
log.info('Dataset synchronization error : ' + e.message);
}
return synchronizedDataset;
}
function verifyConstraints(params, constraints) {
if (constraints != null) {
for (var i = 0; i < constraints.length; i++) {
try {
params[constraints[i].fieldName] = JSON.parse(constraints[i].initialValue);
} catch(e) {
params[constraints[i].fieldName] = constraints[i].initialValue;
}
}
}
}
function processResult(result) {
var dataset = DatasetBuilder.newDataset();
dataset.addColumn("response");
dataset.addRow([result]);
return dataset;
}
function processErrorResult(error, constraints) {
var dataset = DatasetBuilder.newDataset();
var params = data().inputValues;
verifyConstraints(params, constraints);
dataset.addColumn('error');
dataset.addColumn('spedidovenda');
var spedidovenda = isPrimitive(params.spedidovenda) ? params.spedidovenda : JSONUtil.toJSON(params.spedidovenda);
dataset.addRow([error.message, spedidovenda]);
return dataset;
}
function getParamValue(param, assignment) {
if (assignment == 'VARIABLE') {
return getValue(param);
} else if (assignment == 'NULL') {
return null;
}
return param;
}
function hasValue(value) {
return value !== null && value !== undefined;
}
function isPrimitive(value) {
return ((typeof value === 'string') || value.substring !== undefined) || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'undefined';
}
function fillARADTPV(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.ARADTPV");
var fIENUM = getParamValue(params.fIENUM, assigns.fIENUM);
if (hasValue(fIENUM)) { result.setFIENUM(fIENUM); }
var fIEPARCEL = getParamValue(params.fIEPARCEL, assigns.fIEPARCEL);
if (hasValue(fIEPARCEL)) { result.setFIEPARCEL(fIEPARCEL); }
var fIEPREFIX = getParamValue(params.fIEPREFIX, assigns.fIEPREFIX);
if (hasValue(fIEPREFIX)) { result.setFIEPREFIX(fIEPREFIX); }
var fIETIPO = getParamValue(params.fIETIPO, assigns.fIETIPO);
if (hasValue(fIETIPO)) { result.setFIETIPO(fIETIPO); }
var fIEVALOR = getParamValue(params.fIEVALOR, assigns.fIEVALOR);
if (hasValue(fIEVALOR)) { result.setFIEVALOR(fIEVALOR); }
return result;
}
function fillARRAYOFARADTPV(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.ARRAYOFARADTPV");
for (var i = 0; i < params.length; i++) {
result.getARADTPV().add(fillARADTPV(serviceHelper, params[i], assigns[i]));
}
return result;
}
function fillSTCABSC5(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.STCABSC5");
var c5CLIENTE = getParamValue(params.c5CLIENTE, assigns.c5CLIENTE);
if (hasValue(c5CLIENTE)) { result.setC5CLIENTE(c5CLIENTE); }
var c5CONDPAG = getParamValue(params.c5CONDPAG, assigns.c5CONDPAG);
if (hasValue(c5CONDPAG)) { result.setC5CONDPAG(c5CONDPAG); }
var c5EMPRESA = getParamValue(params.c5EMPRESA, assigns.c5EMPRESA);
if (hasValue(c5EMPRESA)) { result.setC5EMPRESA(c5EMPRESA); }
var c5ESTPRES = getParamValue(params.c5ESTPRES, assigns.c5ESTPRES);
if (hasValue(c5ESTPRES)) { result.setC5ESTPRES(c5ESTPRES); }
var c5FILIAL = getParamValue(params.c5FILIAL, assigns.c5FILIAL);
if (hasValue(c5FILIAL)) { result.setC5FILIAL(c5FILIAL); }
var c5LOJACLI = getParamValue(params.c5LOJACLI, assigns.c5LOJACLI);
if (hasValue(c5LOJACLI)) { result.setC5LOJACLI(c5LOJACLI); }
var c5MUNPRES = getParamValue(params.c5MUNPRES, assigns.c5MUNPRES);
if (hasValue(c5MUNPRES)) { result.setC5MUNPRES(c5MUNPRES); }
var c5TIPO = getParamValue(params.c5TIPO, assigns.c5TIPO);
if (hasValue(c5TIPO)) { result.setC5TIPO(c5TIPO); }
var c5TIPOCLI = getParamValue(params.c5TIPOCLI, assigns.c5TIPOCLI);
if (hasValue(c5TIPOCLI)) { result.setC5TIPOCLI(c5TIPOCLI); }
return result;
}
function fillARRATCTBPV(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.ARRATCTBPV");
var aGGCC = getParamValue(params.aGGCC, assigns.aGGCC);
if (hasValue(aGGCC)) { result.setAGGCC(aGGCC); }
var aGGCLVL = getParamValue(params.aGGCLVL, assigns.aGGCLVL);
if (hasValue(aGGCLVL)) { result.setAGGCLVL(aGGCLVL); }
var aGGCONTA = getParamValue(params.aGGCONTA, assigns.aGGCONTA);
if (hasValue(aGGCONTA)) { result.setAGGCONTA(aGGCONTA); }
var aGGITEMCTA = getParamValue(params.aGGITEMCTA, assigns.aGGITEMCTA);
if (hasValue(aGGITEMCTA)) { result.setAGGITEMCTA(aGGITEMCTA); }
var aGGPERC = getParamValue(params.aGGPERC, assigns.aGGPERC);
if (hasValue(aGGPERC)) { result.setAGGPERC(aGGPERC); }
return result;
}
function fillARRAYOFARRATCTBPV(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.ARRAYOFARRATCTBPV");
for (var i = 0; i < params.length; i++) {
result.getARRATCTBPV().add(fillARRATCTBPV(serviceHelper, params[i], assigns[i]));
}
return result;
}
function fillCTCORSC6(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.CTCORSC6");
var c6CC = getParamValue(params.c6CC, assigns.c6CC);
if (hasValue(c6CC)) { result.setC6CC(c6CC); }
var c6EDTPMS = getParamValue(params.c6EDTPMS, assigns.c6EDTPMS);
if (hasValue(c6EDTPMS)) { result.setC6EDTPMS(c6EDTPMS); }
var c6ITEM = getParamValue(params.c6ITEM, assigns.c6ITEM);
if (hasValue(c6ITEM)) { result.setC6ITEM(c6ITEM); }
var c6PRCVEN = getParamValue(params.c6PRCVEN, assigns.c6PRCVEN);
if (hasValue(c6PRCVEN)) { result.setC6PRCVEN(c6PRCVEN); }
var c6PRODUTO = getParamValue(params.c6PRODUTO, assigns.c6PRODUTO);
if (hasValue(c6PRODUTO)) { result.setC6PRODUTO(c6PRODUTO); }
var c6PROJPMS = getParamValue(params.c6PROJPMS, assigns.c6PROJPMS);
if (hasValue(c6PROJPMS)) { result.setC6PROJPMS(c6PROJPMS); }
var c6QTDVEN = getParamValue(params.c6QTDVEN, assigns.c6QTDVEN);
if (hasValue(c6QTDVEN)) { result.setC6QTDVEN(c6QTDVEN); }
var c6TASKPMS = getParamValue(params.c6TASKPMS, assigns.c6TASKPMS);
if (hasValue(c6TASKPMS)) { result.setC6TASKPMS(c6TASKPMS); }
var c6TES = getParamValue(params.c6TES, assigns.c6TES);
if (hasValue(c6TES)) { result.setC6TES(c6TES); }
result.setARRAYOFARRATCTBPV(fillARRAYOFARRATCTBPV(serviceHelper, params.sRATCTBPV, assigns.sRATCTBPV));
return result;
}
function fillARRAYOFCTCORSC6(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.ARRAYOFCTCORSC6");
for (var i = 0; i < params.length; i++) {
result.getCTCORSC6().add(fillCTCORSC6(serviceHelper, params[i], assigns[i]));
}
return result;
}
function fillSTPEDIDOVENDA(serviceHelper, params, assigns) {
if (params == null) {
return null;
}
var result = serviceHelper.instantiate("_113._0._168._192._8079.STPEDIDOVENDA");
result.setARRAYOFARADTPV(fillARRAYOFARADTPV(serviceHelper, params.sADTPV, assigns.sADTPV));
result.setSCAB(fillSTCABSC5(serviceHelper, params.sCAB, assigns.sCAB));
result.setARRAYOFCTCORSC6(fillARRAYOFCTCORSC6(serviceHelper, params.sCOR, assigns.sCOR));
return result;
}
function getObjectFactory(serviceHelper) {
var objectFactory = serviceHelper.instantiate("_113._0._168._192._8079.ObjectFactory");
return objectFactory;
}
function data() {
return {
"fluigService" : "InserePedidoVenda_WSMATA410_SOAP",
"operation" : "inclui",
"soapService" : "WSMATA410",
"portType" : "WSMATA410SOAP",
"locatorClass" : "_113._0._168._192._8079.WSMATA410",
"portTypeMethod" : "getWSMATA410SOAP",
"parameters" : [ ],
"inputValues" : {
"spedidovenda" : {
"sADTPV" : null,
"sCAB" : {
"c5CLIENTE" : "00000027",
"c5CONDPAG" : "001",
"c5EMPRESA" : "01",
"c5ESTPRES" : null,
"c5FILIAL" : "01",
"c5LOJACLI" : "01",
"c5MUNPRES" : null,
"c5TIPO" : "N",
"c5TIPOCLI" : "F"
},
"sCOR" : {
"cTCORSC6" : [ {
"c6CC" : null,
"c6EDTPMS" : null,
"c6ITEM" : "1",
"c6PRCVEN" : 120,
"c6PRODUTO" : "000001",
"c6PROJPMS" : null,
"c6QTDVEN" : 2,
"c6TASKPMS" : null,
"c6TES" : null,
"sRATCTBPV" : null
} ]
}
}
},
"inputAssignments" : {
"spedidovenda" : {
"sADTPV" : "NULL",
"sCAB" : {
"c5CLIENTE" : "VALUE",
"c5CONDPAG" : "VALUE",
"c5EMPRESA" : "VALUE",
"c5ESTPRES" : "NULL",
"c5FILIAL" : "VALUE",
"c5LOJACLI" : "VALUE",
"c5MUNPRES" : "NULL",
"c5TIPO" : "VALUE",
"c5TIPOCLI" : "VALUE"
},
"sCOR" : [ {
"c6CC" : "NULL",
"c6EDTPMS" : "NULL",
"c6ITEM" : "VALUE",
"c6PRCVEN" : "VALUE",
"c6PRODUTO" : "VALUE",
"c6PROJPMS" : "NULL",
"c6QTDVEN" : "VALUE",
"c6TASKPMS" : "NULL",
"c6TES" : "NULL",
"sRATCTBPV" : "NULL"
} ]
}
},
"outputValues" : { },
"outputAssignments" : { },
"extraParams" : {
"enabled" : false
}
}
}
Problema que recebo a mensagem de erro quando tento consultar o dataset:
"Cannot found function setARRAYOFARADTPV in object...". Conforme imagem:
Alguma ideia?
-Ja preenchi os dados opcionais do inicio do metodo, porem nao tive sucesso!