In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

I need to implement Client SOAP with Xailer / xharbour

Xailer English public forum
Responder
Vladimir Zorrilla LLe
Mensajes: 16
Registrado: Sab Jul 22, 2006 1:37 pm

I need to implement Client SOAP with Xailer / xharbour

Mensaje por Vladimir Zorrilla LLe »

Friends
This I need to do
http://www.aduanet.gob.pe/aduanas/opera ... Services.h tm
In VFP already this ready one
Web Services from Visual Fox Pro
This example it can find in the following link
http://www.aduanet.gob.pe/js/app/WebSer ... teWSVisual FoxPro.zip
along with lib FoxCrypto.fll
The library FoxCrypto.fll
it contains function that codifies and decodifica in base 64
which allows to the work data type bytes.
Prueba.prg
SET LIBRARY TO FoxCrypto.FLL
PROCEDURE psEnviArchivo
***********************
*send file
PARAMETER pArc
tcInFile = IIF(EMPTY(pArc),"C:desaprgpruebaCDDEmbargoM4.htm", pArc)
lcInFile = FILETOSTR(tcInFile)
lcInFile64 = codifica(lcInFile)
***
doc = CreateObject("MSXML2.DOMDocument")
http = CreateObject("MSXML2.XMLHTTP")
http.Open("POST", "http://desweb1:8001/portafolio/portafolio", .F.)
http.SetRequestHeader("SOAPAction", "enviaArchivoWebService")
http.SetRequestHeader("Content-Type", "text/xml")
**load file
xml = fnArmaCadXml("A", "0091", "XXXX", "142", lcInFile64,
"CDDEmbargoM5.htm")
doc.LoadXML(xml)
http.Send(doc.xml)
res = CreateObject("MSXML2.DOMDocument")
response = http.responseText
*?response
res.LoadXML(http.responseText)
txt = res.selectSingleNode("//NroEnvioGenerado") &&Return
IF nvl(txt.text,' ') = " " THEN
TXT="ERROR EN WS "
ENDIF
wait window txt.text NOWAIT
*? txt.text
release doc
release http
release res
release response
RETURN
FUNCTION decodifica
PARAMETER pCadena
LOCAL lcBinary, lnHandle, lnSize
lnHandle = Base64DecoderCreate()
IF lnHandle > 0
Base64DecoderPut(lnHandle, pCadena)
Base64DecoderClose(lnHandle)
lnSize = Base64DecoderMaxRetrievable(lnHandle)
lcBinary = Base64DecoderGet(lnHandle, lnSize)
Base64DecoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBinary
FUNCTION codifica
PARAMETER pCadena
LOCAL lcBase64, lcInFile, lnHandle, lnSize
lnHandle = Base64EncoderCreate( .T. )
IF lnHandle > 0
Base64EncoderPut(lnHandle, pCadena)
Base64EncoderClose(lnHandle)
lnSize = Base64EncoderMaxRetrievable(lnHandle)
lcBase64 = Base64EncoderGet(lnHandle, lnSize)
Base64EncoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBase64
FUNCTION fnArmaCadXml
*********************
PARAMETER pTOpe, pOpe, pClave, pAdu, pArch, pNomArch
strxml = +
CHR(13)
strxml = strxml + [
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"] + CHR(13)
strxml = strxml + [ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"] +
CHR(13)
strxml = strxml + [ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">]
+ CHR(13)
strxml = strxml + [ <env:Header>] + CHR(13)
strxml = strxml + [ </env:Header>] + CHR(13)
strxml = strxml + [ <env:Body>] + CHR(13)
strxml = strxml + [ <m:enviaArchivoWebService
xmlns:m=" http://www.bea.com/education/webservice ... basic/java class"]
+ CHR(13)
strxml = strxml + [
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">] + CHR(13)
strxml = strxml + [ <toperador xsi:type="xsd:string">] + pTOpe +
+ CHR(13)
strxml = strxml + [ <operador xsi:type="xsd:string">] + pOpe +
+ CHR(13)
strxml = strxml + [ <clave xsi:type="xsd:string">] + pClave + +
CHR(13)
strxml = strxml + [ <aduana xsi:type="xsd:string">] + pAdu + +
CHR(13)
strxml = strxml + [ <archivoEnvioByte xsi:type="xsd:base64Binary">] + pArch
+ + CHR(13)
strxml = strxml + [ <nombreArchivo xsi:type="xsd:string">] + pNomArch+
[</nombreArchivo>] + CHR(13)
strxml = strxml + [ </m:enviaArchivoWebService>] + CHR(13)
strxml = strxml + [ </env:Body>] + CHR(13)
strxml = strxml + [</
Thanks
Vladimir Zorrilla
cps_net@hotmail.com
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5706
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

I need to implement Client SOAP with Xailer / xharbour

Mensaje por jfgimenez »

Vladimir,
already answered in the spanish forum.
--
Regards,
Jose F. Gimenez
http://www.xailer.com
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder