WebServices protheus afterstateleave

Hola, generé desde fluig en un evento de proceso la llamada a un web services de alta de estructura de producto en protheus. Desde SOAP funciona ok. Pero desde el evento afterstate leave no puedo encontrar la forma de que funcione. Vengo desde hace 1 semana probando alternativas y no logro que funcione.

Adjunto afterstateleave.js

Por otro lado adjunto WSDL de Protheus ( XESTRUCTURA.XML)

Agradeceré si pueden orientarme.

Saludos

:warning: Atenção: Esta publicação foi transferida automaticamente do fórum antigo, mas os anexos não foram incluídos.

Pude solucionar el tema, detallo como lo he resuelto.

try{

var processo = getValue("WKNumProces"); var campos = hAPI.getCardData(processo); var contador = campos.keySet().iterator(); var count = 0; var resultadoaltacomponentes = "";

// Busca webservice var packageName = "ESTRUCTURA_TOTVSDEV"; var direccion = '_4._40._168._192._8070'; var wsService = ServiceManager.getService(packageName); var serviceHelper = wsService.getBean(); var serviceLocator = serviceHelper.instantiate(direccion+".XESTRUCTURA");

var aSG1 = serviceHelper.instantiate(direccion+".ITEMSSG1"); var arrayaestructura = serviceHelper.instantiate(direccion+".ARRAYOFXESTRUCTURAATUALIZAR");

while (contador.hasNext()) { var id = contador.next();

if (id.match(/ccod__/)) { // aqui você pode colocar qualquer campo do seu Pai x Filho

var campo = campos.get(id); var seq = id.split(""); var codcomp = campos.get("c_cod" + seq[1]); var cantidadcomp = campos.get("ncantidad__" + seq[1]); var codpadre = hAPI.getCardValue("c_codigo"); var filial = "01"; var aEstructura = serviceHelper.instantiate(direccion+".XESTRUCTURAATUALIZAR"); aEstructura.setCANT(cantidadcomp); aEstructura.setCOD(codpadre); aEstructura.setCOMP(codcomp); aEstructura.setFILIAL(filial);

arrayaestructura.getXESTRUCTURAATUALIZAR().add(aEstructura);

} } log.dir(arrayaestructura); aSG1.setAITEMSSG1(arrayaestructura);

var service = serviceLocator.getXESTRUCTURASOAP(); //var service = serviceHelper.instantiate("_4._40._168._192._8070.XESTRUCTURASOAP"); log.dir("service "+service); //aSG1 = arrayaestructura; var response = service.atualizar(aSG1);

log.info("Estructura :"+response.isSTATUS()) ;

resultadoaltacomponentes = response.isSTATUS();

var mensaje = hAPI.getCardValue("c_mensaje"); mensaje +=" ##RESULTADO ALTA COMPONENTES : "+resultadoaltacomponentes; hAPI.setCardValue("c_mensaje",mensaje);

} catch(error) { log.error("ERROR WS ESTRUCTURA DE PRODUCTOS : "+error); var mensaje = hAPI.getCardValue("c_mensaje"); mensaje +=" ##RESULTADO ALTA COMPONENTES : "+error.toString().trim(); hAPI.setCardValue("c_mensaje",mensaje);

throw error; }